[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Raise the VM_BAD_POWER_STATE error with VM.send_sysrq if the domain is not



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1173996912 0
# Node ID 3c418dbb71b29ececbe82351b963f9f90ff2fc3e
# Parent  edccebeea4a3e75fb5b536c294c821cbd5435c08
Raise the VM_BAD_POWER_STATE error with VM.send_sysrq if the domain is not
running.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendAPI.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff -r edccebeea4a3 -r 3c418dbb71b2 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Thu Mar 15 21:59:34 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Thu Mar 15 22:15:12 2007 +0000
@@ -1515,10 +1515,15 @@ class XendAPI(object):
                                      "domain_unpause", vm_ref)
 
     def VM_send_sysrq(self, _, vm_ref, req):
-        xendom = XendDomain.instance()
-        xeninfo = xendom.get_vm_by_uuid(vm_ref)
+        xeninfo = XendDomain.instance().get_vm_by_uuid(vm_ref)
+        if xeninfo.state != XEN_API_VM_POWER_STATE_RUNNING:
+            return xen_api_error(
+                ['VM_BAD_POWER_STATE', vm_ref,
+                 XendDomain.POWER_STATE_NAMES[XEN_API_VM_POWER_STATE_RUNNING],
+                 XendDomain.POWER_STATE_NAMES[xeninfo.state]])
         xeninfo.send_sysrq(req)
         return xen_api_success_void()
+
 
     # Xen API: Class VM_metrics
     # ----------------------------------------------------------------

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.