]> xenbits.xensource.com Git - people/pauldu/xeniface.git/commitdiff
xenagent: use spec. compliant control/feature-XXX keys
authorPaul Durrant <paul.durrant@citrix.com>
Fri, 29 Jul 2016 14:22:37 +0000 (15:22 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Mon, 1 Aug 2016 08:51:47 +0000 (09:51 +0100)
control/feature-shutdown is not documented in Xen's xenstore-paths
documentation. The correct keys are feature-poweroff, feature-reboot,
feature-s3 and feature-s4. Also the values that the toolstack should
write control/shutdown are poweroff, reboot, s3 and s4 so the xenagent
should only respond to these values.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Cc: Owen Smith <owen.smith@citrix.com>
src/xenagent/messages.mc
src/xenagent/service.cpp

index 0289c448932775dde3d7fc1300851e00c7cc2c2c..6b60c8dcc9bdacf2829ce8d1d5ed55731abe32a8 100644 (file)
@@ -20,9 +20,9 @@ The tools requested that the local VM reboot.
 MessageId=0x0003
 Facility=XenUser
 Severity=Informational
-SymbolicName=EVENT_XENUSER_HIBERNATE
+SymbolicName=EVENT_XENUSER_S4
 Language=English
-The tools requested that the local VM hibernate itself.
+The tools requested that the local VM enter power state S4.
 .
 
 MessageId=0x0004
index 182752f1a60beaf60d2175f224602c24fb937a03..80aac1187d3b1dc74a7ca665fd7196bd747b7833 100644 (file)
@@ -220,7 +220,10 @@ CXenAgent::~CXenAgent()
 
         // shutdown
         m_device->StoreAddWatch("control/shutdown", m_evt_shutdown, &m_ctxt_shutdown);
-        m_device->StoreWrite("control/feature-shutdown", "1");
+        m_device->StoreWrite("control/feature-poweroff", "1");
+        m_device->StoreWrite("control/feature-reboot", "1");
+        m_device->StoreWrite("control/feature-s3", "1");
+        m_device->StoreWrite("control/feature-s4", "1");
 
         // suspend
         m_device->SuspendRegister(m_evt_suspend, &m_ctxt_suspend);
@@ -241,7 +244,10 @@ CXenAgent::~CXenAgent()
         m_ctxt_suspend = NULL;
 
         // shutdown
-        m_device->StoreRemove("control/feature-shutdown");
+        m_device->StoreRemove("control/feature-poweroff");
+        m_device->StoreRemove("control/feature-reboot");
+        m_device->StoreRemove("control/feature-s3");
+        m_device->StoreRemove("control/feature-s4");
         if (m_ctxt_shutdown)
             m_device->StoreRemoveWatch(m_ctxt_shutdown);
         m_ctxt_shutdown = NULL;
@@ -451,7 +457,7 @@ void CXenAgent::OnShutdown()
 
     CXenAgent::Log("OnShutdown(%ws) = %s\n", m_device->Path(), type.c_str());
 
-    if (type == "poweroff" || type == "halt") {
+    if (type == "poweroff") {
         EventLog(EVENT_XENUSER_POWEROFF);
 
         m_device->StoreWrite("control/shutdown", "");
@@ -473,8 +479,8 @@ void CXenAgent::OnShutdown()
                                       SHTDN_REASON_FLAG_PLANNED)) {
             CXenAgent::Log("InitiateSystemShutdownEx failed %08x\n", GetLastError());
         }
-    } else if (type == "hibernate") {
-        EventLog(EVENT_XENUSER_HIBERNATE);
+    } else if (type == "s4") {
+        EventLog(EVENT_XENUSER_S4);
 
         m_device->StoreWrite("control/shutdown", "");
         AcquireShutdownPrivilege();
@@ -507,7 +513,11 @@ void CXenAgent::OnSuspend()
     m_ctxt_shutdown = NULL;
 
     m_device->StoreAddWatch("control/shutdown", m_evt_shutdown, &m_ctxt_shutdown);
-    m_device->StoreWrite("control/feature-shutdown", "1");
+    m_device->StoreWrite("control/feature-poweroff", "1");
+    m_device->StoreWrite("control/feature-reboot", "1");
+    m_device->StoreWrite("control/feature-s3", "1");
+    m_device->StoreWrite("control/feature-s4", "1");
+
 
     SetXenTime();
 }