mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
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 <jfehlig@novell.com>
This commit is contained in:
1 parent
961f9b1fc9
commit
13b49a3763
1 file changed
+7
-2
@@ -1393,9 +1393,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()
|
||||
@@ -1409,7 +1410,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')
|
||||
@@ -1440,11 +1441,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):
|
||||
|
||||