diff options
author | emellor@ewan <emellor@ewan> | 2005-10-07 13:34:10 +0100 |
---|---|---|
committer | emellor@ewan <emellor@ewan> | 2005-10-07 13:34:10 +0100 |
commit | a87cea82c01ef77692e4132865b6bdf7147d4acd (patch) | |
tree | 7cd507d4dbe7cbeabc510c951cc73a04d8e641bd /tools | |
parent | e8c790c70c319ada47554e4e089b896e92186e73 (diff) | |
download | xen-a87cea82c01ef77692e4132865b6bdf7147d4acd.tar.gz xen-a87cea82c01ef77692e4132865b6bdf7147d4acd.tar.bz2 xen-a87cea82c01ef77692e4132865b6bdf7147d4acd.zip |
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/python/xen/xend/XendDomainInfo.py | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index be6b6fe89c..2b3bf06667 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -153,6 +153,11 @@ def create(config): vm = XendDomainInfo(getUuid(), parseConfig(config)) try: vm.construct() + vm.initDomain() + vm.construct_image() + vm.configure() + vm.storeVmDetails() + vm.storeDomDetails() vm.refreshShutdown() return vm except: @@ -223,19 +228,14 @@ def restore(config): except TypeError, exn: raise VmError('Invalid ssidref in config: %s' % exn) - domid = xc.domain_create(ssidref = ssidref) - if domid < 0: - raise VmError('Creating domain failed for restore') - try: - vm = XendDomainInfo(uuid, parseConfig(config), domid) - except: - xc.domain_destroy(domid) - raise + vm = XendDomainInfo(uuid, parseConfig(config)) try: - vm.storeVmDetails() + vm.construct() vm.configure() vm.create_channel() + vm.storeVmDetails() vm.storeDomDetails() + vm.refreshShutdown() return vm except: vm.destroy() @@ -1001,12 +1001,6 @@ class XendDomainInfo: # shutdown_start_time from killing the domain, for example. self.removeDom() - self.initDomain() - self.construct_image() - self.configure() - self.storeVmDetails() - self.storeDomDetails() - def initDomain(self): log.debug('XendDomainInfo.initDomain: %s %s %s', @@ -1100,14 +1094,14 @@ class XendDomainInfo: def destroyDomain(self): log.debug("XendDomainInfo.destroyDomain(%s)", str(self.domid)) - self.cleanupDomain() - try: if self.domid is not None: xc.domain_destroy(dom=self.domid) except: log.exception("XendDomainInfo.destroy: xc.domain_destroy failed.") + self.cleanupDomain() + ## private: |