# HG changeset patch
# User Ante Karamatić <ante.karama...@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/

Reply via email to