WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Clean up domains if creation/restoration fails.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Clean up domains if creation/restoration fails.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 04 Oct 2005 17:32:11 +0000
Delivery-date: Tue, 04 Oct 2005 17:29:40 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User emellor@ewan
# Node ID 00037ba13f0bb8efe4b2c3efe40200eac21c68dd
# Parent  db651da378993509fa67e57ded1869c918356f4a
Clean up domains if creation/restoration fails.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r db651da37899 -r 00037ba13f0b tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Tue Oct  4 16:54:33 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Tue Oct  4 17:23:58 2005
@@ -129,9 +129,13 @@
     log.debug("XendDomainInfo.create(%s)", config)
 
     vm = XendDomainInfo(getUuid(), parseConfig(config))
-    vm.construct()
-    vm.refreshShutdown()
-    return vm
+    try:
+        vm.construct()
+        vm.refreshShutdown()
+        return vm
+    except:
+        vm.destroy()
+        raise
 
 
 def recreate(xeninfo):
@@ -195,13 +199,23 @@
     except TypeError, exn:
         raise VmError('Invalid ssidref in config: %s' % exn)
 
-    vm = XendDomainInfo(uuid, parseConfig(config),
-                        xc.domain_create(ssidref = ssidref))
-    vm.storeVmDetails()
-    vm.configure()
-    vm.create_channel()
-    vm.storeDomDetails()
-    return vm
+    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
+    try:
+        vm.storeVmDetails()
+        vm.configure()
+        vm.create_channel()
+        vm.storeDomDetails()
+        return vm
+    except:
+        vm.destroy()
+        raise
 
 
 def parseConfig(config):

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Clean up domains if creation/restoration fails., Xen patchbot -unstable <=