[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Catch RuntimeError inside initDomain, for better handling of out-of-memory, etc.



# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 8fb11d28df0f7b33ae8c2f2c5869218df68b5f82
# Parent  c7a46ec8d4dfbe7d99bedc95c1e399c619db1d76
Catch RuntimeError inside initDomain, for better handling of out-of-memory, etc.

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

diff -r c7a46ec8d4df -r 8fb11d28df0f tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Mon Nov 21 12:12:09 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Mon Nov 21 12:13:57 2005
@@ -1098,36 +1098,40 @@
         if not self.infoIsSet('image'):
             raise VmError('Missing image in configuration')
 
-        self.image = image.create(self,
-                                  self.info['image'],
-                                  self.info['device'])
-
-        xc.domain_setcpuweight(self.domid, self.info['cpu_weight'])
-
-        m = self.image.getDomainMemory(self.info['memory'] * 1024)
-        xc.domain_setmaxmem(self.domid, maxmem_kb = m)
-        xc.domain_memory_increase_reservation(self.domid, m, 0, 0)
-
-        cpu = self.info['cpu']
-        if cpu is not None and cpu != -1:
-            xc.domain_pincpu(self.domid, 0, 1 << cpu)
-
-        self.createChannels()
-
-        channel_details = self.image.createImage()
-
-        self.store_mfn = channel_details['store_mfn']
-        if 'console_mfn' in channel_details:
-            self.console_mfn = channel_details['console_mfn']
-
-        self.introduceDomain()
-
-        self.createDevices()
-
-        if self.info['bootloader']:
-            self.image.cleanupBootloading()
-
-        self.info['start_time'] = time.time()
+        try:
+            self.image = image.create(self,
+                                      self.info['image'],
+                                      self.info['device'])
+
+            xc.domain_setcpuweight(self.domid, self.info['cpu_weight'])
+
+            m = self.image.getDomainMemory(self.info['memory'] * 1024)
+            xc.domain_setmaxmem(self.domid, maxmem_kb = m)
+            xc.domain_memory_increase_reservation(self.domid, m, 0, 0)
+
+            cpu = self.info['cpu']
+            if cpu is not None and cpu != -1:
+                xc.domain_pincpu(self.domid, 0, 1 << cpu)
+
+            self.createChannels()
+
+            channel_details = self.image.createImage()
+
+            self.store_mfn = channel_details['store_mfn']
+            if 'console_mfn' in channel_details:
+                self.console_mfn = channel_details['console_mfn']
+
+            self.introduceDomain()
+
+            self.createDevices()
+
+            if self.info['bootloader']:
+                self.image.cleanupBootloading()
+
+            self.info['start_time'] = time.time()
+
+        except RuntimeError, exn:
+            raise VmError(str(exn))
 
 
     ## public:

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.