Mailing List Archive

[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@canonical.com>
# 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@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
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@ubuntu.com> wrote:
> # HG changeset patch
> # User Ante Karamatić <ante.karamatic@canonical.com>
> # 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@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
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@canonical.com>
> # 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@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
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@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
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@ubuntu.com> 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@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
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@beekhof.net> 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@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
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@hastexo.com> wrote:
> On Mon, Feb 20, 2012 at 11:57 AM, Andrew Beekhof <andrew@beekhof.net> 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@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/