Skip to contentSkip to conversation

Intercept some xm commands on HVM

RFC PATCH In review Stefan Berger 2 participants 2 messages Oct 20, 2006

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Intercept some xm commands on HVM

Hello!

I find some of the xm commands when applied to an HVM domain
misleading:

xm shutdown - behaves like 'xm destroy' unlike the
paravirtualized case that gracefully shuts down a domain; use 'destroy' instead for HVM
xm migrate / save - returns
Error: /usr/lib/xen/bin/xc-save ... failed

The attached patch intercepts only those commands now and returns a
'better' message.

xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py +10 -0
Index: root/xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py
===================================================================
@@ -956,6 +956,7 @@ class XendDomainInfo:
 
 
     def shutdown(self, reason):
+        self.unsupportedOnHVM("shutdown")
         if not reason in shutdown_reasons.values():
             raise XendError('Invalid reason: %s' % reason)
         if self.domid == 0:
@@ -1084,6 +1085,15 @@ class XendDomainInfo:
 
     ## private:
 
+    def unsupportedOnHVM(self, cmd):
+        if self.info['image'][0] == "hvm":
+           if cmd == "shutdown":
+               raise XendError("No graceful shutdown on HVM. Use "
+                               "'destroy' instead.")
+           elif cmd == "save":
+               raise XendError("Cannot save/migrate an HVM domain, yet")
+
+
     def createDevice(self, deviceClass, devconfig):
         return self.getDeviceController(deviceClass).createDevice(devconfig)
 
xen-unstable.hg/tools/python/xen/xend/XendCheckpoint.py +2 -0
Index: root/xen-unstable.hg/tools/python/xen/xend/XendCheckpoint.py
===================================================================
@@ -23,6 +23,7 @@ from XendError import XendError
 from XendLogging import log
 from XendDomainInfo import DEV_MIGRATE_STEP1, DEV_MIGRATE_STEP2
 from XendDomainInfo import DEV_MIGRATE_STEP3
+from XendDomainInfo import XendDomainInfo
 
 SIGNATURE = "LinuxGuestRecord"
 XC_SAVE = "xc_save"
@@ -55,6 +56,7 @@ def read_exact(fd, size, errmsg):
 
 
 def save(fd, dominfo, network, live, dst):
+    dominfo.unsupportedOnHVM("save")
     write_exact(fd, SIGNATURE, "could not write guest state file: signature")
 
     config = sxp.to_string(dominfo.sxpr())

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 12 lines · Stefan Berger

Hello!

I find some of the xm commands when applied to an HVM domain
misleading:

xm shutdown - behaves like 'xm destroy' unlike the
paravirtualized case that gracefully shuts down a domain; use 'destroy' instead for HVM
xm migrate / save - returns
Error: /usr/lib/xen/bin/xc-save ... failed

Quoted 2 lines

The attached patch intercepts only those commands now and returns a
'better' message.

These commands aren't necessarily unsupported for HVM domains -- they need PV driver support, but that's not a fundamental limitation. We need a decent mechanism for guest capability interrogation, that's for sure, so that we can give better diagnostics; I'd like to see this mechanism in Xen 3.0.4. For now, I don't think we can reject these commands unconditionally.

Ewan.