ia64/xen-unstable
changeset 16987:def2adbce510
xend: Restore values of /vm/uuid/xend/* to recreated domains.
When guest domains are restarted, previous values of /vm/uuid/xend/*
in xenstore are lost. (e.g. previous_restart_time,
last_shutdown_reason). This patch restores them to restarting domains.
And we should update /vm/uuid/xend/restart_count of restarting
domains, not previous domains.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
When guest domains are restarted, previous values of /vm/uuid/xend/*
in xenstore are lost. (e.g. previous_restart_time,
last_shutdown_reason). This patch restores them to restarting domains.
And we should update /vm/uuid/xend/restart_count of restarting
domains, not previous domains.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Tue Feb 05 10:39:35 2008 +0000 (2008-02-05) |
parents | 32e9c52fc6d9 |
children | df6b8bed2845 |
files | tools/python/xen/xend/XendDomainInfo.py |
line diff
1.1 --- a/tools/python/xen/xend/XendDomainInfo.py Tue Feb 05 10:29:19 2008 +0000 1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Tue Feb 05 10:39:35 2008 +0000 1.3 @@ -879,6 +879,9 @@ class XendDomainInfo: 1.4 def _gatherVm(self, *args): 1.5 return xstransact.Gather(self.vmpath, *args) 1.6 1.7 + def _listRecursiveVm(self, *args): 1.8 + return xstransact.ListRecursive(self.vmpath, *args) 1.9 + 1.10 def storeVm(self, *args): 1.11 return xstransact.Store(self.vmpath, *args) 1.12 1.13 @@ -1393,6 +1396,7 @@ class XendDomainInfo: 1.14 1.15 self._writeVm('xend/previous_restart_time', str(now)) 1.16 1.17 + prev_vm_xend = self._listRecursiveVm('xend') 1.18 new_dom_info = self.info 1.19 try: 1.20 if rename: 1.21 @@ -1411,8 +1415,13 @@ class XendDomainInfo: 1.22 try: 1.23 new_dom = XendDomain.instance().domain_create_from_dict( 1.24 new_dom_info) 1.25 + for x in prev_vm_xend[0][1]: 1.26 + new_dom._writeVm('xend/%s' % x[0], x[1]) 1.27 new_dom.waitForDevices() 1.28 new_dom.unpause() 1.29 + rst_cnt = new_dom._readVm('xend/restart_count') 1.30 + rst_cnt = int(rst_cnt) + 1 1.31 + new_dom._writeVm('xend/restart_count', str(rst_cnt)) 1.32 new_dom._removeVm(RESTART_IN_PROGRESS) 1.33 except: 1.34 if new_dom: 1.35 @@ -1448,9 +1457,6 @@ class XendDomainInfo: 1.36 self.vmpath = XS_VMROOT + new_uuid 1.37 # Write out new vm node to xenstore 1.38 self._storeVmDetails() 1.39 - rst_cnt = self._readVm('xend/restart_count') 1.40 - rst_cnt = int(rst_cnt) + 1 1.41 - self._writeVm('xend/restart_count', str(rst_cnt)) 1.42 self._preserve() 1.43 return new_dom_info 1.44