[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] HVM: Do not watch control/shutdown to force domain shutdowns when PV
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxx # Date 1176376376 -3600 # Node ID 95a9998ede92f589976479cd6663b3c419760440 # Parent 4c06bcd83c902cf9851e8ad7ada5c09207da3e91 HVM: Do not watch control/shutdown to force domain shutdowns when PV drivers are not present. The feature-foo mechanism does not actually work after save/restore since the fields do not get rewritten. And it doesn't work when we actually need the guest to be shutdown through Xen (e.g., on suspend). Since we can quite reasonably assume that the only entity to screw with control/shutdown is xend, and since the one place that does that now explicitly handles unenlightened HVM guests, we can simply strip all this stuff out. This has the nice benefit of making HVM save/restore with PV drivers much more reliable. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- linux-2.6-xen-sparse/drivers/xen/core/reboot.c | 3 - tools/python/xen/xend/XendDomainInfo.py | 1 tools/python/xen/xend/image.py | 75 ------------------------- 3 files changed, 1 insertion(+), 78 deletions(-) diff -r 4c06bcd83c90 -r 95a9998ede92 linux-2.6-xen-sparse/drivers/xen/core/reboot.c --- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c Thu Apr 12 12:09:58 2007 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c Thu Apr 12 12:12:56 2007 +0100 @@ -118,6 +118,7 @@ static void shutdown_handler(struct xenb err = xenbus_transaction_start(&xbt); if (err) return; + str = (char *)xenbus_read(xbt, "control", "shutdown", NULL); /* Ignore read errors and empty reads. */ if (XENBUS_IS_ERR_READ(str)) { @@ -206,14 +207,12 @@ static int setup_shutdown_watcher(void) printk(KERN_ERR "Failed to set shutdown watcher\n"); return err; } - xenbus_write(XBT_NIL, "control", "feature-reboot", "1"); err = register_xenbus_watch(&sysrq_watch); if (err) { printk(KERN_ERR "Failed to set sysrq watcher\n"); return err; } - xenbus_write(XBT_NIL, "control", "feature-sysrq", "1"); return 0; } diff -r 4c06bcd83c90 -r 95a9998ede92 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Thu Apr 12 12:09:58 2007 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Thu Apr 12 12:12:56 2007 +0100 @@ -1601,7 +1601,6 @@ class XendDomainInfo: self.image = image.create(self, self.info) if self.image: self.image.createDeviceModel(True) - self.image.register_shutdown_watch() self._storeDomDetails() self._registerWatches() self.refreshShutdown() diff -r 4c06bcd83c90 -r 95a9998ede92 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Thu Apr 12 12:09:58 2007 +0100 +++ b/tools/python/xen/xend/image.py Thu Apr 12 12:12:56 2007 +0100 @@ -283,9 +283,6 @@ class HVMImageHandler(ImageHandler): log.debug("pae = %d", self.pae) log.debug("acpi = %d", self.acpi) log.debug("apic = %d", self.apic) - - self.register_shutdown_watch() - self.register_reboot_feature_watch() return xc.hvm_build(domid = self.vm.getDomid(), image = self.kernel, @@ -448,13 +445,9 @@ class HVMImageHandler(ImageHandler): log.info("device model pid: %d", self.pid) def recreate(self): - self.register_shutdown_watch() - self.register_reboot_feature_watch() self.pid = self.vm.gatherDom(('image/device-model-pid', int)) def destroy(self, suspend = False): - self.unregister_shutdown_watch() - self.unregister_reboot_feature_watch(); if self.pid: try: sig = signal.SIGKILL @@ -473,74 +466,6 @@ class HVMImageHandler(ImageHandler): pass self.pid = None - def register_shutdown_watch(self): - """ add xen store watch on control/shutdown """ - self.shutdownWatch = xswatch(self.vm.dompath + "/control/shutdown", - self.hvm_shutdown) - log.debug("hvm shutdown watch registered") - - def unregister_shutdown_watch(self): - """Remove the watch on the control/shutdown, if any. Nothrow - guarantee.""" - - try: - if self.shutdownWatch: - self.shutdownWatch.unwatch() - except: - log.exception("Unwatching hvm shutdown watch failed.") - self.shutdownWatch = None - log.debug("hvm shutdown watch unregistered") - - def hvm_shutdown(self, _): - """ watch call back on node control/shutdown, - if node changed, this function will be called - """ - xd = xen.xend.XendDomain.instance() - try: - vm = xd.domain_lookup( self.vm.getDomid() ) - except XendError: - # domain isn't registered, no need to clean it up. - return False - - reason = vm.getShutdownReason() - log.debug("hvm_shutdown fired, shutdown reason=%s", reason) - if reason in REVERSE_DOMAIN_SHUTDOWN_REASONS: - vm.info['shutdown'] = 1 - vm.info['shutdown_reason'] = \ - REVERSE_DOMAIN_SHUTDOWN_REASONS[reason] - vm.refreshShutdown(vm.info) - - return True # Keep watching - - def register_reboot_feature_watch(self): - """ add xen store watch on control/feature-reboot """ - self.rebootFeatureWatch = xswatch(self.vm.dompath + "/control/feature-reboot", \ - self.hvm_reboot_feature) - log.debug("hvm reboot feature watch registered") - - def unregister_reboot_feature_watch(self): - """Remove the watch on the control/feature-reboot, if any. Nothrow - guarantee.""" - - try: - if self.rebootFeatureWatch: - self.rebootFeatureWatch.unwatch() - except: - log.exception("Unwatching hvm reboot feature watch failed.") - self.rebootFeatureWatch = None - log.debug("hvm reboot feature watch unregistered") - - def hvm_reboot_feature(self, _): - """ watch call back on node control/feature-reboot, - if node changed, this function will be called - """ - status = self.vm.readDom('control/feature-reboot') - log.debug("hvm_reboot_feature fired, module status=%s", status) - if status == '1': - self.unregister_shutdown_watch() - - return True # Keep watching - class IA64_HVM_ImageHandler(HVMImageHandler): _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |