ia64/xen-unstable

changeset 12051:c3b004aef317

[HVM][LINUX][TOOLS] Split control/reboot_module into control/feature-reboot
and control/feature-sysrq. This is more consistent with the other
PV device protocols.

Signed-off-by: Steven Smith <sos22@cam.ac.uk>
author Steven Smith <ssmith@xensource.com>
date Tue Oct 31 10:11:53 2006 +0000 (2006-10-31)
parents eb3fe0620e3d
children e0942ef72b8e
files linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c linux-2.6-xen-sparse/drivers/xen/core/reboot.c tools/python/xen/xend/image.py
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c	Tue Oct 31 09:54:49 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c	Tue Oct 31 10:11:53 2006 +0000
     1.3 @@ -59,10 +59,6 @@ EXPORT_SYMBOL(machine_restart);
     1.4  EXPORT_SYMBOL(machine_halt);
     1.5  EXPORT_SYMBOL(machine_power_off);
     1.6  
     1.7 -#endif /* defined(__i386__) || defined(__x86_64__) */
     1.8 -
     1.9 -#if defined(__i386__) || defined(__x86_64__)
    1.10 -
    1.11  /* Ensure we run on the idle task page tables so that we will
    1.12     switch page tables before running user space. This is needed
    1.13     on architectures with separate kernel and user page tables
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c	Tue Oct 31 09:54:49 2006 +0000
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c	Tue Oct 31 10:11:53 2006 +0000
     2.3 @@ -164,10 +164,14 @@ static int setup_shutdown_watcher(struct
     2.4  	err = register_xenbus_watch(&shutdown_watch);
     2.5  	if (err)
     2.6  		printk(KERN_ERR "Failed to set shutdown watcher\n");
     2.7 +	else
     2.8 +		xenbus_write(XBT_NIL, "control", "feature-reboot", "1");
     2.9  
    2.10  	err = register_xenbus_watch(&sysrq_watch);
    2.11  	if (err)
    2.12  		printk(KERN_ERR "Failed to set sysrq watcher\n");
    2.13 +	else
    2.14 +		xenbus_write(XBT_NIL, "control", "feature-sysrq", "1");
    2.15  
    2.16  	return NOTIFY_DONE;
    2.17  }
    2.18 @@ -179,10 +183,6 @@ static int __init setup_shutdown_event(v
    2.19  	};
    2.20  	register_xenstore_notifier(&xenstore_notifier);
    2.21  
    2.22 -	if (!is_initial_xendomain()) {
    2.23 -		xenbus_write(XBT_NIL, "control", "reboot_module", "installed");
    2.24 -	}
    2.25 -
    2.26  	return 0;
    2.27  }
    2.28  
     3.1 --- a/tools/python/xen/xend/image.py	Tue Oct 31 09:54:49 2006 +0000
     3.2 +++ b/tools/python/xen/xend/image.py	Tue Oct 31 10:11:53 2006 +0000
     3.3 @@ -282,7 +282,7 @@ class HVMImageHandler(ImageHandler):
     3.4          log.debug("apic           = %d", self.apic)
     3.5  
     3.6          self.register_shutdown_watch()
     3.7 -        self.register_reboot_module_watch()
     3.8 +        self.register_reboot_feature_watch()
     3.9  
    3.10          return xc.hvm_build(dom            = self.vm.getDomid(),
    3.11                              image          = self.kernel,
    3.12 @@ -417,7 +417,7 @@ class HVMImageHandler(ImageHandler):
    3.13  
    3.14      def destroy(self):
    3.15          self.unregister_shutdown_watch();
    3.16 -        self.unregister_reboot_module_watch();
    3.17 +        self.unregister_reboot_feature_watch();
    3.18          if not self.pid:
    3.19              return
    3.20          os.kill(self.pid, signal.SIGKILL)
    3.21 @@ -460,34 +460,34 @@ class HVMImageHandler(ImageHandler):
    3.22  
    3.23          return 1 # Keep watching
    3.24  
    3.25 -    def register_reboot_module_watch(self):
    3.26 -        """ add xen store watch on control/reboot_module """
    3.27 -        self.rebootModuleWatch = xswatch(self.vm.dompath + "/control/reboot_module", \
    3.28 -                                    self.hvm_reboot_module)
    3.29 -        log.debug("hvm reboot module watch registered")
    3.30 +    def register_reboot_feature_watch(self):
    3.31 +        """ add xen store watch on control/feature-reboot """
    3.32 +        self.rebootModuleWatch = xswatch(self.vm.dompath + "/control/feature-reboot", \
    3.33 +                                         self.hvm_reboot_feature)
    3.34 +        log.debug("hvm reboot feature watch registered")
    3.35  
    3.36 -    def unregister_reboot_module_watch(self):
    3.37 -        """Remove the watch on the control/reboot_module, if any. Nothrow
    3.38 +    def unregister_reboot_feature_watch(self):
    3.39 +        """Remove the watch on the control/feature-reboot, if any. Nothrow
    3.40          guarantee."""
    3.41  
    3.42          try:
    3.43 -            if self.rebootModuleWatch:
    3.44 -                self.rebootModuleWatch.unwatch()
    3.45 +            if self.rebootFeatureWatch:
    3.46 +                self.rebootFeatureWatch.unwatch()
    3.47          except:
    3.48 -            log.exception("Unwatching hvm reboot module watch failed.")
    3.49 -        self.rebootModuleWatch = None
    3.50 -        log.debug("hvm reboot module watch unregistered")
    3.51 +            log.exception("Unwatching hvm reboot feature watch failed.")
    3.52 +        self.rebootFeatureWatch = None
    3.53 +        log.debug("hvm reboot feature watch unregistered")
    3.54  
    3.55 -    def hvm_reboot_module(self, _):
    3.56 -        """ watch call back on node control/reboot_module,
    3.57 +    def hvm_reboot_feature(self, _):
    3.58 +        """ watch call back on node control/feature-reboot,
    3.59              if node changed, this function will be called
    3.60          """
    3.61          xd = xen.xend.XendDomain.instance()
    3.62          vm = xd.domain_lookup( self.vm.getDomid() )
    3.63  
    3.64 -        reboot_module_status = vm.readDom('control/reboot_module')
    3.65 -        log.debug("hvm_reboot_module fired, module status=%s", reboot_module_status)
    3.66 -        if reboot_module_status == 'installed':
    3.67 +        status = vm.readDom('control/feature-reboot')
    3.68 +        log.debug("hvm_reboot_feature fired, module status=%s", status)
    3.69 +        if status == '1':
    3.70              self.unregister_shutdown_watch()
    3.71  
    3.72          return 1 # Keep watching