From: Stefan Berger Subject: [PATCH] [RFC] Intercept some xm commands on HVM Date: Fri, 20 Oct 2006 17:12:36 -0400 Message-ID: <1161378756.17852.12.camel@lt2.watson.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-BgD3oEGVRrxP2T64AsO9" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen-devel List-Id: xen-devel@lists.xenproject.org --=-BgD3oEGVRrxP2T64AsO9 Content-Type: text/plain Content-Transfer-Encoding: 7bit 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. Signed-off-by: Stefan Berger --=-BgD3oEGVRrxP2T64AsO9 Content-Disposition: attachment; filename=xm-block-commands-for-hvm.diff Content-Type: text/x-patch; name=xm-block-commands-for-hvm.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: root/xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- root.orig/xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py +++ 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) Index: root/xen-unstable.hg/tools/python/xen/xend/XendCheckpoint.py =================================================================== --- root.orig/xen-unstable.hg/tools/python/xen/xend/XendCheckpoint.py +++ 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()) --=-BgD3oEGVRrxP2T64AsO9 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-BgD3oEGVRrxP2T64AsO9--