ia64/xen-unstable

changeset 7949:8fb11d28df0f

Catch RuntimeError inside initDomain, for better handling of out-of-memory, etc.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Mon Nov 21 13:13:57 2005 +0100 (2005-11-21)
parents c7a46ec8d4df
children 64e43d615167
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Nov 21 13:12:09 2005 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Nov 21 13:13:57 2005 +0100
     1.3 @@ -1098,36 +1098,40 @@ class XendDomainInfo:
     1.4          if not self.infoIsSet('image'):
     1.5              raise VmError('Missing image in configuration')
     1.6  
     1.7 -        self.image = image.create(self,
     1.8 -                                  self.info['image'],
     1.9 -                                  self.info['device'])
    1.10 +        try:
    1.11 +            self.image = image.create(self,
    1.12 +                                      self.info['image'],
    1.13 +                                      self.info['device'])
    1.14  
    1.15 -        xc.domain_setcpuweight(self.domid, self.info['cpu_weight'])
    1.16 +            xc.domain_setcpuweight(self.domid, self.info['cpu_weight'])
    1.17  
    1.18 -        m = self.image.getDomainMemory(self.info['memory'] * 1024)
    1.19 -        xc.domain_setmaxmem(self.domid, maxmem_kb = m)
    1.20 -        xc.domain_memory_increase_reservation(self.domid, m, 0, 0)
    1.21 +            m = self.image.getDomainMemory(self.info['memory'] * 1024)
    1.22 +            xc.domain_setmaxmem(self.domid, maxmem_kb = m)
    1.23 +            xc.domain_memory_increase_reservation(self.domid, m, 0, 0)
    1.24  
    1.25 -        cpu = self.info['cpu']
    1.26 -        if cpu is not None and cpu != -1:
    1.27 -            xc.domain_pincpu(self.domid, 0, 1 << cpu)
    1.28 +            cpu = self.info['cpu']
    1.29 +            if cpu is not None and cpu != -1:
    1.30 +                xc.domain_pincpu(self.domid, 0, 1 << cpu)
    1.31 +
    1.32 +            self.createChannels()
    1.33  
    1.34 -        self.createChannels()
    1.35 -
    1.36 -        channel_details = self.image.createImage()
    1.37 +            channel_details = self.image.createImage()
    1.38  
    1.39 -        self.store_mfn = channel_details['store_mfn']
    1.40 -        if 'console_mfn' in channel_details:
    1.41 -            self.console_mfn = channel_details['console_mfn']
    1.42 +            self.store_mfn = channel_details['store_mfn']
    1.43 +            if 'console_mfn' in channel_details:
    1.44 +                self.console_mfn = channel_details['console_mfn']
    1.45 +
    1.46 +            self.introduceDomain()
    1.47  
    1.48 -        self.introduceDomain()
    1.49 +            self.createDevices()
    1.50  
    1.51 -        self.createDevices()
    1.52 +            if self.info['bootloader']:
    1.53 +                self.image.cleanupBootloading()
    1.54  
    1.55 -        if self.info['bootloader']:
    1.56 -            self.image.cleanupBootloading()
    1.57 +            self.info['start_time'] = time.time()
    1.58  
    1.59 -        self.info['start_time'] = time.time()
    1.60 +        except RuntimeError, exn:
    1.61 +            raise VmError(str(exn))
    1.62  
    1.63  
    1.64      ## public: