From: Stefan Berger Subject: [PATCH] For detecting resume operation in hotplug scripts Date: Thu, 02 Feb 2006 16:34:51 -0500 Message-ID: <1138916091.761.8.camel@jlfb-2.watson.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-nC9UqP4zwyqg7FUIFASH" 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@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --=-nC9UqP4zwyqg7FUIFASH Content-Type: text/plain Content-Transfer-Encoding: 7bit Hello! 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. Please let me know about comments. Signed-off-by: Stefan Berger --=-nC9UqP4zwyqg7FUIFASH Content-Disposition: attachment; filename=xend-domain-resume.diff Content-Type: text/x-patch; name=xend-domain-resume.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 @@ -251,13 +251,14 @@ def restore(config): log.debug("XendDomainInfo.restore(%s)", config) - vm = XendDomainInfo(parseConfig(config)) + vm = XendDomainInfo(parseConfig(config), None, None, False, False, True) try: vm.construct() vm.storeVmDetails() vm.createDevices() vm.createChannels() vm.storeDomDetails() + vm.endRestore() return vm except: vm.destroy() @@ -410,7 +411,7 @@ def dom_get(dom): class XendDomainInfo: def __init__(self, info, domid = None, dompath = None, augment = False, - priv = False): + priv = False, resume = False): self.info = info @@ -445,6 +446,7 @@ class XendDomainInfo: self.state_updated = threading.Condition() self.refresh_shutdown_lock = threading.Condition() + self.setResume(resume) ## private: @@ -758,6 +760,14 @@ class XendDomainInfo: """Get this domain's target memory size, in KB.""" return self.info['memory'] * 1024 + def getResume(self): + return "%s" % self.info['resume'] + + def endRestore(self): + self.setResume(False) + + def setResume(self, state): + self.info['resume'] = state def refreshShutdown(self, xeninfo = None): # If set at the end of this method, a restart is required, with the Index: root/xen-unstable.hg/tools/python/xen/xend/server/tpmif.py =================================================================== --- root.orig/xen-unstable.hg/tools/python/xen/xend/server/tpmif.py +++ root/xen-unstable.hg/tools/python/xen/xend/server/tpmif.py @@ -45,7 +45,8 @@ class TPMifController(DevController): log.info("The domain has a TPM with instance %d and devid %d.", inst, devid) - back = { 'pref_instance' : "%i" % inst } + back = { 'pref_instance' : "%i" % inst, + 'resume' : "%s" % (self.vm.getResume()) } front = { 'handle' : "%i" % devid } return (devid, back, front) --=-nC9UqP4zwyqg7FUIFASH 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 --=-nC9UqP4zwyqg7FUIFASH--