ia64/xen-unstable
changeset 7262:b5c5360a61d0
Regig the construction of new domains so that restore and create can share the
construct method. This ensures that the domain will have any stale paths in
the store removed on restore.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
construct method. This ensures that the domain will have any stale paths in
the store removed on restore.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
author | emellor@ewan |
---|---|
date | Fri Oct 07 13:34:10 2005 +0100 (2005-10-07) |
parents | 2a3e10a132a2 |
children | e9e10e783ccd |
files | tools/python/xen/xend/XendDomainInfo.py |
line diff
1.1 --- a/tools/python/xen/xend/XendDomainInfo.py Fri Oct 07 11:16:28 2005 +0100 1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Fri Oct 07 13:34:10 2005 +0100 1.3 @@ -153,6 +153,11 @@ def create(config): 1.4 vm = XendDomainInfo(getUuid(), parseConfig(config)) 1.5 try: 1.6 vm.construct() 1.7 + vm.initDomain() 1.8 + vm.construct_image() 1.9 + vm.configure() 1.10 + vm.storeVmDetails() 1.11 + vm.storeDomDetails() 1.12 vm.refreshShutdown() 1.13 return vm 1.14 except: 1.15 @@ -223,19 +228,14 @@ def restore(config): 1.16 except TypeError, exn: 1.17 raise VmError('Invalid ssidref in config: %s' % exn) 1.18 1.19 - domid = xc.domain_create(ssidref = ssidref) 1.20 - if domid < 0: 1.21 - raise VmError('Creating domain failed for restore') 1.22 + vm = XendDomainInfo(uuid, parseConfig(config)) 1.23 try: 1.24 - vm = XendDomainInfo(uuid, parseConfig(config), domid) 1.25 - except: 1.26 - xc.domain_destroy(domid) 1.27 - raise 1.28 - try: 1.29 - vm.storeVmDetails() 1.30 + vm.construct() 1.31 vm.configure() 1.32 vm.create_channel() 1.33 + vm.storeVmDetails() 1.34 vm.storeDomDetails() 1.35 + vm.refreshShutdown() 1.36 return vm 1.37 except: 1.38 vm.destroy() 1.39 @@ -1001,12 +1001,6 @@ class XendDomainInfo: 1.40 # shutdown_start_time from killing the domain, for example. 1.41 self.removeDom() 1.42 1.43 - self.initDomain() 1.44 - self.construct_image() 1.45 - self.configure() 1.46 - self.storeVmDetails() 1.47 - self.storeDomDetails() 1.48 - 1.49 1.50 def initDomain(self): 1.51 log.debug('XendDomainInfo.initDomain: %s %s %s', 1.52 @@ -1100,14 +1094,14 @@ class XendDomainInfo: 1.53 def destroyDomain(self): 1.54 log.debug("XendDomainInfo.destroyDomain(%s)", str(self.domid)) 1.55 1.56 - self.cleanupDomain() 1.57 - 1.58 try: 1.59 if self.domid is not None: 1.60 xc.domain_destroy(dom=self.domid) 1.61 except: 1.62 log.exception("XendDomainInfo.destroy: xc.domain_destroy failed.") 1.63 1.64 + self.cleanupDomain() 1.65 + 1.66 1.67 ## private: 1.68