ia64/xen-unstable
changeset 16886:7f9646fcffe8
Fix leaking of /vm/<uuid> path in xenstore on various VM lifecycle events.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Fri Jan 25 13:29:51 2008 +0000 (2008-01-25) |
parents | dc6264577b59 |
children | 923f2f736507 |
files | tools/python/xen/xend/XendCheckpoint.py tools/python/xen/xend/XendDomainInfo.py |
line diff
1.1 --- a/tools/python/xen/xend/XendCheckpoint.py Fri Jan 25 13:29:31 2008 +0000 1.2 +++ b/tools/python/xen/xend/XendCheckpoint.py Fri Jan 25 13:29:51 2008 +0000 1.3 @@ -125,10 +125,10 @@ def save(fd, dominfo, network, live, dst 1.4 if checkpoint: 1.5 dominfo.resumeDomain() 1.6 else: 1.7 - dominfo.destroyDomain() 1.8 + dominfo.destroy() 1.9 dominfo.testDeviceComplete() 1.10 try: 1.11 - dominfo.setName(domain_name) 1.12 + dominfo.setName(domain_name, False) 1.13 except VmError: 1.14 # Ignore this. The name conflict (hopefully) arises because we 1.15 # are doing localhost migration; if we are doing a suspend of a
2.1 --- a/tools/python/xen/xend/XendDomainInfo.py Fri Jan 25 13:29:31 2008 +0000 2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Fri Jan 25 13:29:51 2008 +0000 2.3 @@ -1125,10 +1125,11 @@ class XendDomainInfo: 2.4 def getDomid(self): 2.5 return self.domid 2.6 2.7 - def setName(self, name): 2.8 + def setName(self, name, to_store = True): 2.9 self._checkName(name) 2.10 self.info['name_label'] = name 2.11 - self.storeVm("name", name) 2.12 + if to_store: 2.13 + self.storeVm("name", name) 2.14 2.15 def getName(self): 2.16 return self.info['name_label'] 2.17 @@ -1399,7 +1400,7 @@ class XendDomainInfo: 2.18 new_dom_info = self._preserveForRestart() 2.19 else: 2.20 self._unwatchVm() 2.21 - self.destroyDomain() 2.22 + self.destroy() 2.23 2.24 # new_dom's VM will be the same as this domain's VM, except where 2.25 # the rename flag has instructed us to call preserveForRestart. 2.26 @@ -1413,9 +1414,6 @@ class XendDomainInfo: 2.27 new_dom_info) 2.28 new_dom.waitForDevices() 2.29 new_dom.unpause() 2.30 - rst_cnt = self._readVm('xend/restart_count') 2.31 - rst_cnt = int(rst_cnt) + 1 2.32 - self._writeVm('xend/restart_count', str(rst_cnt)) 2.33 new_dom._removeVm(RESTART_IN_PROGRESS) 2.34 except: 2.35 if new_dom: 2.36 @@ -1441,13 +1439,19 @@ class XendDomainInfo: 2.37 new_name, new_uuid) 2.38 self._unwatchVm() 2.39 self._releaseDevices() 2.40 + # Remove existing vm node in xenstore 2.41 + self._removeVm() 2.42 new_dom_info = self.info.copy() 2.43 new_dom_info['name_label'] = self.info['name_label'] 2.44 new_dom_info['uuid'] = self.info['uuid'] 2.45 self.info['name_label'] = new_name 2.46 self.info['uuid'] = new_uuid 2.47 self.vmpath = XS_VMROOT + new_uuid 2.48 + # Write out new vm node to xenstore 2.49 self._storeVmDetails() 2.50 + rst_cnt = self._readVm('xend/restart_count') 2.51 + rst_cnt = int(rst_cnt) + 1 2.52 + self._writeVm('xend/restart_count', str(rst_cnt)) 2.53 self._preserve() 2.54 return new_dom_info 2.55