diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-02-05 10:39:35 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-02-05 10:39:35 +0000 |
commit | 3ad6af357a3dab88d57fe13e18b917f9017d5683 (patch) | |
tree | 5810990a21196d4653f2f87f4007c929477d735c /tools | |
parent | 054ccca730a664d2f1c44f2bf3c22db6bdbf5d25 (diff) | |
download | xen-3ad6af357a3dab88d57fe13e18b917f9017d5683.tar.gz xen-3ad6af357a3dab88d57fe13e18b917f9017d5683.tar.bz2 xen-3ad6af357a3dab88d57fe13e18b917f9017d5683.zip |
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/python/xen/xend/XendDomainInfo.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 97f51d2383..3d795f2d0c 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -879,6 +879,9 @@ class XendDomainInfo: def _gatherVm(self, *args): return xstransact.Gather(self.vmpath, *args) + def _listRecursiveVm(self, *args): + return xstransact.ListRecursive(self.vmpath, *args) + def storeVm(self, *args): return xstransact.Store(self.vmpath, *args) @@ -1393,6 +1396,7 @@ class XendDomainInfo: self._writeVm('xend/previous_restart_time', str(now)) + prev_vm_xend = self._listRecursiveVm('xend') new_dom_info = self.info try: if rename: @@ -1411,8 +1415,13 @@ class XendDomainInfo: try: new_dom = XendDomain.instance().domain_create_from_dict( new_dom_info) + for x in prev_vm_xend[0][1]: + new_dom._writeVm('xend/%s' % x[0], x[1]) new_dom.waitForDevices() new_dom.unpause() + rst_cnt = new_dom._readVm('xend/restart_count') + rst_cnt = int(rst_cnt) + 1 + new_dom._writeVm('xend/restart_count', str(rst_cnt)) new_dom._removeVm(RESTART_IN_PROGRESS) except: if new_dom: @@ -1448,9 +1457,6 @@ class XendDomainInfo: self.vmpath = XS_VMROOT + new_uuid # Write out new vm node to xenstore self._storeVmDetails() - rst_cnt = self._readVm('xend/restart_count') - rst_cnt = int(rst_cnt) + 1 - self._writeVm('xend/restart_count', str(rst_cnt)) self._preserve() return new_dom_info |