# HG changeset patch # User Keir Fraser # Date 1201267747 0 # Node ID 367902a19412ba2cb6b3dff88a83ba624457e8e0 # Parent 666573856c5928371435b72d907dd7f06965965f Fix 'on_*=rename-restart' domain configuration option. When setting e.g. 'on_crash=rename-restart' option in domain config and crashing guest OS running in the domain, the new domain is restarted with same name as renamed domain. jfehlig4: # xm li Name ID Mem VCPUs State Time(s) Domain-0 0 1233 4 r----- 937.9 Domain-e64b12a0-0493-44d7-afde-55c776513426 21 384 1 ---c- 14.3 Domain-e64b12a0-0493-44d7-afde-55c776513426 22 384 1 r----- 7.3 This patch copies the domain info prior to setting new name and uuid in the crashed domain info and uses the copied domain info to construct the restarted domain. Signed-off-by: Jim Fehlig Index: xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- xen-3.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py @@ -1391,9 +1391,10 @@ class XendDomainInfo: self._writeVm('xend/previous_restart_time', str(now)) + new_dom_info = self.info try: if rename: - self._preserveForRestart() + new_dom_info = self._preserveForRestart() else: self._unwatchVm() self.destroyDomain() @@ -1407,7 +1408,7 @@ class XendDomainInfo: new_dom = None try: new_dom = XendDomain.instance().domain_create_from_dict( - self.info) + new_dom_info) new_dom.waitForDevices() new_dom.unpause() rst_cnt = self._readVm('xend/restart_count') @@ -1438,11 +1439,15 @@ class XendDomainInfo: new_name, new_uuid) self._unwatchVm() self._releaseDevices() + new_dom_info = self.info.copy() + new_dom_info['name_label'] = self.info['name_label'] + new_dom_info['uuid'] = self.info['uuid'] self.info['name_label'] = new_name self.info['uuid'] = new_uuid self.vmpath = XS_VMROOT + new_uuid self._storeVmDetails() self._preserve() + return new_dom_info def _preserve(self):