direct-io.hg

changeset 14400:3c418dbb71b2

Raise the VM_BAD_POWER_STATE error with VM.send_sysrq if the domain is not
running.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Thu Mar 15 22:15:12 2007 +0000 (2007-03-15)
parents edccebeea4a3
children cd8d2a4d46e4
files tools/python/xen/xend/XendAPI.py
line diff
     1.1 --- a/tools/python/xen/xend/XendAPI.py	Thu Mar 15 21:59:34 2007 +0000
     1.2 +++ b/tools/python/xen/xend/XendAPI.py	Thu Mar 15 22:15:12 2007 +0000
     1.3 @@ -1515,11 +1515,16 @@ class XendAPI(object):
     1.4                                       "domain_unpause", vm_ref)
     1.5  
     1.6      def VM_send_sysrq(self, _, vm_ref, req):
     1.7 -        xendom = XendDomain.instance()
     1.8 -        xeninfo = xendom.get_vm_by_uuid(vm_ref)
     1.9 +        xeninfo = XendDomain.instance().get_vm_by_uuid(vm_ref)
    1.10 +        if xeninfo.state != XEN_API_VM_POWER_STATE_RUNNING:
    1.11 +            return xen_api_error(
    1.12 +                ['VM_BAD_POWER_STATE', vm_ref,
    1.13 +                 XendDomain.POWER_STATE_NAMES[XEN_API_VM_POWER_STATE_RUNNING],
    1.14 +                 XendDomain.POWER_STATE_NAMES[xeninfo.state]])
    1.15          xeninfo.send_sysrq(req)
    1.16          return xen_api_success_void()
    1.17  
    1.18 +
    1.19      # Xen API: Class VM_metrics
    1.20      # ----------------------------------------------------------------
    1.21