Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux-HA: Dev

[PATCH] Medium: Use the resource timeout as an override to the default dbus timeout for upstart RA

 

 

Linux-HA dev RSS feed   Index | Next | Previous | View Threaded


ivoks at ubuntu

Feb 16, 2012, 11:52 PM

Post #1 of 7 (993 views)
Permalink
[PATCH] Medium: Use the resource timeout as an override to the default dbus timeout for upstart RA

# HG changeset patch
# User Ante Karamatić <ante.karamatic [at] canonical>
# Date 1329463546 -3600
# Node ID 097ca775d3740a94591fbe0dd50124a51f140fff
# Parent d8c154589a16cb99ab16f36a27756ba94eefdbee
Medium: Use the resource timeout as an override to the default dbus timeout for upstart RA

diff --git a/lib/plugins/lrm/raexecupstart.c b/lib/plugins/lrm/raexecupstart.c
--- a/lib/plugins/lrm/raexecupstart.c
+++ b/lib/plugins/lrm/raexecupstart.c
@@ -169,7 +169,7 @@
/* It'd be better if it returned GError, so we can distinguish
* between failure modes (can't contact upstart, no such job,
* or failure to do action. */
- if (upstart_job_do(rsc_type, cmd)) {
+ if (upstart_job_do(rsc_type, cmd, timeout)) {
exit(EXECRA_OK);
} else {
exit(EXECRA_NO_RA);
diff --git a/lib/plugins/lrm/upstart-dbus.c b/lib/plugins/lrm/upstart-dbus.c
--- a/lib/plugins/lrm/upstart-dbus.c
+++ b/lib/plugins/lrm/upstart-dbus.c
@@ -319,7 +319,7 @@
}

gboolean
-upstart_job_do(const gchar *name, UpstartJobCommand cmd)
+upstart_job_do(const gchar *name, UpstartJobCommand cmd, const int timeout)
{
DBusGConnection *conn;
DBusGProxy *manager;
@@ -342,7 +342,8 @@
switch (cmd) {
case UPSTART_JOB_START:
cmd_name = "Start";
- dbus_g_proxy_call (job, cmd_name, &error,
+ dbus_g_proxy_call_with_timeout (job, cmd_name,
+ timeout, &error,
G_TYPE_STRV, no_args,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_INVALID,
@@ -352,7 +353,8 @@
break;
case UPSTART_JOB_STOP:
cmd_name = "Stop";
- dbus_g_proxy_call(job, cmd_name, &error,
+ dbus_g_proxy_call_with_timeout(job, cmd_name,
+ timeout, &error,
G_TYPE_STRV, no_args,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_INVALID,
@@ -360,7 +362,8 @@
break;
case UPSTART_JOB_RESTART:
cmd_name = "Restart";
- dbus_g_proxy_call (job, cmd_name, &error,
+ dbus_g_proxy_call_with_timeout (job, cmd_name,
+ timeout, &error,
G_TYPE_STRV, no_args,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_INVALID,
diff --git a/lib/plugins/lrm/upstart-dbus.h b/lib/plugins/lrm/upstart-dbus.h
--- a/lib/plugins/lrm/upstart-dbus.h
+++ b/lib/plugins/lrm/upstart-dbus.h
@@ -29,7 +29,7 @@
} UpstartJobCommand;

G_GNUC_INTERNAL gchar **upstart_get_all_jobs(void);
-G_GNUC_INTERNAL gboolean upstart_job_do(const gchar *name, UpstartJobCommand cmd);
+G_GNUC_INTERNAL gboolean upstart_job_do(const gchar *name, UpstartJobCommand cmd, const int timeout);
G_GNUC_INTERNAL gboolean upstart_job_is_running (const gchar *name);

#endif /* _UPSTART_DBUS_H_ */
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


andrew at beekhof

Feb 17, 2012, 2:20 AM

Post #2 of 7 (938 views)
Permalink
Re: [PATCH] Medium: Use the resource timeout as an override to the default dbus timeout for upstart RA [In reply to]

Tangential question... but does upstart also implement the "service" binary?
As in "service pacemaker start" ?

On Fri, Feb 17, 2012 at 6:52 PM, Ante Karamatic <ivoks [at] ubuntu> wrote:
> # HG changeset patch
> # User Ante Karamatić <ante.karamatic [at] canonical>
> # Date 1329463546 -3600
> # Node ID 097ca775d3740a94591fbe0dd50124a51f140fff
> # Parent  d8c154589a16cb99ab16f36a27756ba94eefdbee
> Medium: Use the resource timeout as an override to the default dbus timeout for upstart RA
>
> diff --git a/lib/plugins/lrm/raexecupstart.c b/lib/plugins/lrm/raexecupstart.c
> --- a/lib/plugins/lrm/raexecupstart.c
> +++ b/lib/plugins/lrm/raexecupstart.c
> @@ -169,7 +169,7 @@
>        /* It'd be better if it returned GError, so we can distinguish
>         * between failure modes (can't contact upstart, no such job,
>         * or failure to do action. */
> -       if (upstart_job_do(rsc_type, cmd)) {
> +       if (upstart_job_do(rsc_type, cmd, timeout)) {
>                exit(EXECRA_OK);
>        } else {
>                exit(EXECRA_NO_RA);
> diff --git a/lib/plugins/lrm/upstart-dbus.c b/lib/plugins/lrm/upstart-dbus.c
> --- a/lib/plugins/lrm/upstart-dbus.c
> +++ b/lib/plugins/lrm/upstart-dbus.c
> @@ -319,7 +319,7 @@
>  }
>
>  gboolean
> -upstart_job_do(const gchar *name, UpstartJobCommand cmd)
> +upstart_job_do(const gchar *name, UpstartJobCommand cmd, const int timeout)
>  {
>        DBusGConnection *conn;
>        DBusGProxy *manager;
> @@ -342,7 +342,8 @@
>                switch (cmd) {
>                case UPSTART_JOB_START:
>                        cmd_name = "Start";
> -                       dbus_g_proxy_call (job, cmd_name, &error,
> +                       dbus_g_proxy_call_with_timeout (job, cmd_name,
> +                               timeout, &error,
>                                G_TYPE_STRV, no_args,
>                                G_TYPE_BOOLEAN, TRUE,
>                                G_TYPE_INVALID,
> @@ -352,7 +353,8 @@
>                        break;
>                case UPSTART_JOB_STOP:
>                        cmd_name = "Stop";
> -                       dbus_g_proxy_call(job, cmd_name, &error,
> +                       dbus_g_proxy_call_with_timeout(job, cmd_name,
> +                               timeout, &error,
>                                G_TYPE_STRV, no_args,
>                                G_TYPE_BOOLEAN, TRUE,
>                                G_TYPE_INVALID,
> @@ -360,7 +362,8 @@
>                        break;
>                case UPSTART_JOB_RESTART:
>                        cmd_name = "Restart";
> -                       dbus_g_proxy_call (job, cmd_name, &error,
> +                       dbus_g_proxy_call_with_timeout (job, cmd_name,
> +                               timeout, &error,
>                                G_TYPE_STRV, no_args,
>                                G_TYPE_BOOLEAN, TRUE,
>                                G_TYPE_INVALID,
> diff --git a/lib/plugins/lrm/upstart-dbus.h b/lib/plugins/lrm/upstart-dbus.h
> --- a/lib/plugins/lrm/upstart-dbus.h
> +++ b/lib/plugins/lrm/upstart-dbus.h
> @@ -29,7 +29,7 @@
>  } UpstartJobCommand;
>
>  G_GNUC_INTERNAL gchar **upstart_get_all_jobs(void);
> -G_GNUC_INTERNAL gboolean upstart_job_do(const gchar *name, UpstartJobCommand cmd);
> +G_GNUC_INTERNAL gboolean upstart_job_do(const gchar *name, UpstartJobCommand cmd, const int timeout);
>  G_GNUC_INTERNAL gboolean upstart_job_is_running (const gchar *name);
>
>  #endif /* _UPSTART_DBUS_H_ */
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


dejan at suse

Feb 17, 2012, 2:51 AM

Post #3 of 7 (940 views)
Permalink
Re: [PATCH] Medium: Use the resource timeout as an override to the default dbus timeout for upstart RA [In reply to]

Hi Ante,

Patch applied. Many thanks for the contribution!

Cheers,

Dejan

On Fri, Feb 17, 2012 at 08:52:06AM +0100, Ante Karamatic wrote:
> # HG changeset patch
> # User Ante Karamatić <ante.karamatic [at] canonical>
> # Date 1329463546 -3600
> # Node ID 097ca775d3740a94591fbe0dd50124a51f140fff
> # Parent d8c154589a16cb99ab16f36a27756ba94eefdbee
> Medium: Use the resource timeout as an override to the default dbus timeout for upstart RA
>
> diff --git a/lib/plugins/lrm/raexecupstart.c b/lib/plugins/lrm/raexecupstart.c
> --- a/lib/plugins/lrm/raexecupstart.c
> +++ b/lib/plugins/lrm/raexecupstart.c
> @@ -169,7 +169,7 @@
> /* It'd be better if it returned GError, so we can distinguish
> * between failure modes (can't contact upstart, no such job,
> * or failure to do action. */
> - if (upstart_job_do(rsc_type, cmd)) {
> + if (upstart_job_do(rsc_type, cmd, timeout)) {
> exit(EXECRA_OK);
> } else {
> exit(EXECRA_NO_RA);
> diff --git a/lib/plugins/lrm/upstart-dbus.c b/lib/plugins/lrm/upstart-dbus.c
> --- a/lib/plugins/lrm/upstart-dbus.c
> +++ b/lib/plugins/lrm/upstart-dbus.c
> @@ -319,7 +319,7 @@
> }
>
> gboolean
> -upstart_job_do(const gchar *name, UpstartJobCommand cmd)
> +upstart_job_do(const gchar *name, UpstartJobCommand cmd, const int timeout)
> {
> DBusGConnection *conn;
> DBusGProxy *manager;
> @@ -342,7 +342,8 @@
> switch (cmd) {
> case UPSTART_JOB_START:
> cmd_name = "Start";
> - dbus_g_proxy_call (job, cmd_name, &error,
> + dbus_g_proxy_call_with_timeout (job, cmd_name,
> + timeout, &error,
> G_TYPE_STRV, no_args,
> G_TYPE_BOOLEAN, TRUE,
> G_TYPE_INVALID,
> @@ -352,7 +353,8 @@
> break;
> case UPSTART_JOB_STOP:
> cmd_name = "Stop";
> - dbus_g_proxy_call(job, cmd_name, &error,
> + dbus_g_proxy_call_with_timeout(job, cmd_name,
> + timeout, &error,
> G_TYPE_STRV, no_args,
> G_TYPE_BOOLEAN, TRUE,
> G_TYPE_INVALID,
> @@ -360,7 +362,8 @@
> break;
> case UPSTART_JOB_RESTART:
> cmd_name = "Restart";
> - dbus_g_proxy_call (job, cmd_name, &error,
> + dbus_g_proxy_call_with_timeout (job, cmd_name,
> + timeout, &error,
> G_TYPE_STRV, no_args,
> G_TYPE_BOOLEAN, TRUE,
> G_TYPE_INVALID,
> diff --git a/lib/plugins/lrm/upstart-dbus.h b/lib/plugins/lrm/upstart-dbus.h
> --- a/lib/plugins/lrm/upstart-dbus.h
> +++ b/lib/plugins/lrm/upstart-dbus.h
> @@ -29,7 +29,7 @@
> } UpstartJobCommand;
>
> G_GNUC_INTERNAL gchar **upstart_get_all_jobs(void);
> -G_GNUC_INTERNAL gboolean upstart_job_do(const gchar *name, UpstartJobCommand cmd);
> +G_GNUC_INTERNAL gboolean upstart_job_do(const gchar *name, UpstartJobCommand cmd, const int timeout);
> G_GNUC_INTERNAL gboolean upstart_job_is_running (const gchar *name);
>
> #endif /* _UPSTART_DBUS_H_ */
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


ivoks at ubuntu

Feb 17, 2012, 5:00 AM

Post #4 of 7 (930 views)
Permalink
Re: [PATCH] Medium: Use the resource timeout as an override to the default dbus timeout for upstart RA [In reply to]

On 17.02.2012 11:20, Andrew Beekhof wrote:

> Tangential question... but does upstart also implement the "service" binary?
> As in "service pacemaker start" ?

It does, but the exit status is always '0', which makes 'service' binary
unusable for monitoring the status of the service without parsing the
command output.
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


andrew at beekhof

Feb 20, 2012, 2:57 AM

Post #5 of 7 (929 views)
Permalink
Re: [PATCH] Medium: Use the resource timeout as an override to the default dbus timeout for upstart RA [In reply to]

On Sat, Feb 18, 2012 at 12:00 AM, Ante Karamatic <ivoks [at] ubuntu> wrote:
> On 17.02.2012 11:20, Andrew Beekhof wrote:
>
>> Tangential question... but does upstart also implement the "service" binary?
>> As in "service pacemaker start" ?
>
> It does, but the exit status is always '0', which makes 'service' binary
> unusable for monitoring the status of the service without parsing the
> command output.

10 head
20 desk
30 add
40 goto 10
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


florian at hastexo

Feb 20, 2012, 6:41 AM

Post #6 of 7 (916 views)
Permalink
Re: [PATCH] Medium: Use the resource timeout as an override to the default dbus timeout for upstart RA [In reply to]

On Mon, Feb 20, 2012 at 11:57 AM, Andrew Beekhof <andrew [at] beekhof> wrote:
>> It does, but the exit status is always '0', which makes 'service' binary
>> unusable for monitoring the status of the service without parsing the
>> command output.
>
> 10 head
> 20 desk
> 30 add
> 40 goto 10

I believe you went through that same loop months ago when you found
out about this on IRC. Looks like premature cache invalidation of the
result.

Florian

--
Need help with High Availability?
http://www.hastexo.com/now
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


andrew at beekhof

Feb 20, 2012, 3:34 PM

Post #7 of 7 (911 views)
Permalink
Re: [PATCH] Medium: Use the resource timeout as an override to the default dbus timeout for upstart RA [In reply to]

On Tue, Feb 21, 2012 at 1:41 AM, Florian Haas <florian [at] hastexo> wrote:
> On Mon, Feb 20, 2012 at 11:57 AM, Andrew Beekhof <andrew [at] beekhof> wrote:
>>> It does, but the exit status is always '0', which makes 'service' binary
>>> unusable for monitoring the status of the service without parsing the
>>> command output.
>>
>> 10 head
>> 20 desk
>> 30 add
>> 40 goto 10
>
> I believe you went through that same loop months ago when you found
> out about this on IRC. Looks like premature cache invalidation of the
> result.

I like to think it was an optimistic pipelining problem, because
no-one would /leave/ the services binary like that.
Would they?
Not once they knew.
Right?

Sigh.
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Linux-HA dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.