Go to quiesce state on checkstop/watchdog error

This change alters the behavior on a host
checkstop or watchdog error. Instead of simply
rebooting, go to the new quiesce state.

Change-Id: I4dd3a3d7a91607fc56a684873115d5f32de18f6a
Signed-off-by: Michael Tritz <mtritz@us.ibm.com>
diff --git a/hostcheckstop/host_checkstop_obj.c b/hostcheckstop/host_checkstop_obj.c
index 587896a..1782483 100644
--- a/hostcheckstop/host_checkstop_obj.c
+++ b/hostcheckstop/host_checkstop_obj.c
@@ -77,27 +77,28 @@
     gpio_close(&checkstop);
     if ((!gpio) && (is_host_booted(connection)))
     {
-        printf("Host Checkstop, rebooting host\n");
+        printf("Host Checkstop, going to quiesce\n");
         error = NULL;
         proxy = g_dbus_proxy_new_sync((GDBusConnection*)connection,
             G_DBUS_PROXY_FLAGS_NONE,
             NULL, /* GDBusInterfaceInfo* */
-            "org.openbmc.control.Chassis", /* name */
-            "/org/openbmc/control/chassis0", /* object path */
-            "org.openbmc.control.Chassis", /* interface name */
+            "org.freedesktop.systemd1", /* name */
+            "/org/freedesktop/systemd1", /* object path */
+            "org.freedesktop.systemd1.Manager", /* interface name */
             NULL, /* GCancellable */
             &error);
         g_assert_no_error(error);
 
         error = NULL;
         result = g_dbus_proxy_call_sync(proxy,
-            "reboot",
-            parm,
+            "StartUnit",
+            g_variant_new("(ss)", "obmc-quiesce-host@0.target", "replace"),
             G_DBUS_CALL_FLAGS_NONE,
             -1,
             NULL,
             &error);
         g_assert_no_error(error);
+        g_variant_unref(result);
     }
 
     return FALSE;
@@ -200,4 +201,3 @@
     g_main_loop_unref(loop);
     return 0;
 }
-
diff --git a/pychassisctl/chassis_control.py b/pychassisctl/chassis_control.py
index 3637d82..faf7d1d 100644
--- a/pychassisctl/chassis_control.py
+++ b/pychassisctl/chassis_control.py
@@ -167,6 +167,14 @@
         return None
 
     @dbus.service.method(DBUS_NAME,
+                         in_signature='', out_signature='')
+    def quiesce(self):
+        intf = self.getInterface('systemd')
+        f = getattr(intf, 'StartUnit')
+        f.call_async('obmc-quiesce-host@0.target', 'replace')
+        return None
+
+    @dbus.service.method(DBUS_NAME,
                          in_signature='', out_signature='i')
     def getPowerState(self):
         intf = self.getInterface('power_control')
@@ -199,9 +207,8 @@
         self.softReboot()
 
     def host_watchdog_signal_handler(self):
-        print "Watchdog Error, Hard Rebooting"
-        self.Set(DBUS_NAME, "reboot", 1)
-        self.powerOff()
+        print "Watchdog Error, Going to quiesce"
+        self.quiesce()
 
     def emergency_shutdown_signal_handler(self, message):
         print "Emergency Shutdown!"