ia64/xen-unstable
changeset 8751:0bd023cf351e
I have previously posted a patch with changes to the xenbus for being
able to detect the reason why a frontend is created, which can be either
due to domain creation or a restore. The attached patch now puts this
functionality into XenD and allows driver implementations in Xend to
read the state and see whether a domain is currently being resumed or
created and write this value into the xenstore for hotplug scripts to
read it. The state of a domain being resumed is set when a
XendDomainInfo object is created and reset at the end of the restore
function.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
able to detect the reason why a frontend is created, which can be either
due to domain creation or a restore. The attached patch now puts this
functionality into XenD and allows driver implementations in Xend to
read the state and see whether a domain is currently being resumed or
created and write this value into the xenstore for hotplug scripts to
read it. The state of a domain being resumed is set when a
XendDomainInfo object is created and reset at the end of the restore
function.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
author | kaf24@firebug.cl.cam.ac.uk |
---|---|
date | Fri Feb 03 11:54:05 2006 +0100 (2006-02-03) |
parents | 6d9b7a0ba238 |
children | 0e7bdd973e17 |
files | tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/server/tpmif.py |
line diff
1.1 --- a/tools/python/xen/xend/XendDomainInfo.py Fri Feb 03 11:51:39 2006 +0100 1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Fri Feb 03 11:54:05 2006 +0100 1.3 @@ -251,13 +251,14 @@ def restore(config): 1.4 1.5 log.debug("XendDomainInfo.restore(%s)", config) 1.6 1.7 - vm = XendDomainInfo(parseConfig(config)) 1.8 + vm = XendDomainInfo(parseConfig(config), None, None, False, False, True) 1.9 try: 1.10 vm.construct() 1.11 vm.storeVmDetails() 1.12 vm.createDevices() 1.13 vm.createChannels() 1.14 vm.storeDomDetails() 1.15 + vm.endRestore() 1.16 return vm 1.17 except: 1.18 vm.destroy() 1.19 @@ -410,7 +411,7 @@ def dom_get(dom): 1.20 class XendDomainInfo: 1.21 1.22 def __init__(self, info, domid = None, dompath = None, augment = False, 1.23 - priv = False): 1.24 + priv = False, resume = False): 1.25 1.26 self.info = info 1.27 1.28 @@ -445,6 +446,7 @@ class XendDomainInfo: 1.29 self.state_updated = threading.Condition() 1.30 self.refresh_shutdown_lock = threading.Condition() 1.31 1.32 + self.setResume(resume) 1.33 1.34 ## private: 1.35 1.36 @@ -758,6 +760,14 @@ class XendDomainInfo: 1.37 """Get this domain's target memory size, in KB.""" 1.38 return self.info['memory'] * 1024 1.39 1.40 + def getResume(self): 1.41 + return "%s" % self.info['resume'] 1.42 + 1.43 + def endRestore(self): 1.44 + self.setResume(False) 1.45 + 1.46 + def setResume(self, state): 1.47 + self.info['resume'] = state 1.48 1.49 def refreshShutdown(self, xeninfo = None): 1.50 # If set at the end of this method, a restart is required, with the
2.1 --- a/tools/python/xen/xend/server/tpmif.py Fri Feb 03 11:51:39 2006 +0100 2.2 +++ b/tools/python/xen/xend/server/tpmif.py Fri Feb 03 11:54:05 2006 +0100 2.3 @@ -45,7 +45,8 @@ class TPMifController(DevController): 2.4 2.5 log.info("The domain has a TPM with instance %d and devid %d.", 2.6 inst, devid) 2.7 - back = { 'pref_instance' : "%i" % inst } 2.8 + back = { 'pref_instance' : "%i" % inst, 2.9 + 'resume' : "%s" % (self.vm.getResume()) } 2.10 front = { 'handle' : "%i" % devid } 2.11 2.12 return (devid, back, front)