ia64/xen-unstable

changeset 2677:b977ef66a19e

bitkeeper revision 1.1159.118.1 (417793c6qIRlR7frVP0OIQu1cEa0Tg)

Merge http://xen.bkbits.net:8080/xeno-unstable.bk
into gandalf.hpl.hp.com:/var/bk/xeno-unstable.bk
author xenbk@gandalf.hpl.hp.com
date Thu Oct 21 10:47:34 2004 +0000 (2004-10-21)
parents 15749c9317e9 ffc49e9c4837
children 4b6dc2da0d4c
files tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/server/SrvDomainDir.py tools/python/xen/xend/server/blkif.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Thu Oct 21 06:54:28 2004 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Oct 21 10:47:34 2004 +0000
     1.3 @@ -288,6 +288,18 @@ def append_deferred(dlist, v):
     1.4      if isinstance(v, defer.Deferred):
     1.5          dlist.append(v)
     1.6  
     1.7 +def dlist_err(val):
     1.8 +    """Error callback suitable for a deferred list.
     1.9 +    In a deferred list the error callback is called with with Failure((error, index)).
    1.10 +    This callback extracts the error and returns it.
    1.11 +
    1.12 +    @param val: Failure containing (error, index)
    1.13 +    @type val: twisted.internet.failure.Failure 
    1.14 +    """
    1.15 +    
    1.16 +    (error, index) = val.value
    1.17 +    return error
    1.18 +
    1.19  class XendDomainInfo:
    1.20      """Virtual machine object."""
    1.21  
    1.22 @@ -701,6 +713,10 @@ class XendDomainInfo:
    1.23          """Build the domain boot image.
    1.24          """
    1.25          if self.recreate or self.restore: return
    1.26 +        if not os.path.isfile(kernel):
    1.27 +            raise VmError('Kernel image does not exist: %s' % kernel)
    1.28 +        if ramdisk and not os.path.isfile(ramdisk):
    1.29 +            raise VmError('Kernel ramdisk does not exist: %s' % ramdisk)
    1.30          if len(cmdline) >= 256:
    1.31              log.warning('kernel cmdline too long, domain %d', self.dom)
    1.32          dom = self.dom
    1.33 @@ -726,11 +742,6 @@ class XendDomainInfo:
    1.34          @param ramdisk: kernel ramdisk
    1.35          @param cmdline: kernel commandline
    1.36          """
    1.37 -        if not self.recreate:
    1.38 -            if not os.path.isfile(kernel):
    1.39 -                raise VmError('Kernel image does not exist: %s' % kernel)
    1.40 -            if ramdisk and not os.path.isfile(ramdisk):
    1.41 -                raise VmError('Kernel ramdisk does not exist: %s' % ramdisk)
    1.42          #self.init_domain()
    1.43          if self.console:
    1.44              self.console.registerChannel()
    1.45 @@ -763,6 +774,7 @@ class XendDomainInfo:
    1.46              append_deferred(dlist, v)
    1.47              index[dev_name] = dev_index + 1
    1.48          deferred = defer.DeferredList(dlist, fireOnOneErrback=1)
    1.49 +        deferred.addErrback(dlist_err)
    1.50          return deferred
    1.51  
    1.52      def device_create(self, dev_config):
    1.53 @@ -994,6 +1006,7 @@ class XendDomainInfo:
    1.54                  log.warning("Unknown config field %s", field_name)
    1.55              index[field_name] = field_index + 1
    1.56          d = defer.DeferredList(dlist, fireOnOneErrback=1)
    1.57 +        d.addErrback(dlist_err)
    1.58          return d
    1.59  
    1.60  
    1.61 @@ -1007,7 +1020,7 @@ def vm_image_linux(vm, image):
    1.62      """
    1.63      kernel = sxp.child_value(image, "kernel")
    1.64      cmdline = ""
    1.65 -    ip = sxp.child_value(image, "ip", "dhcp")
    1.66 +    ip = sxp.child_value(image, "ip", None)
    1.67      if ip:
    1.68          cmdline += " ip=" + ip
    1.69      root = sxp.child_value(image, "root")
     2.1 --- a/tools/python/xen/xend/server/SrvDomainDir.py	Thu Oct 21 06:54:28 2004 +0000
     2.2 +++ b/tools/python/xen/xend/server/SrvDomainDir.py	Thu Oct 21 10:47:34 2004 +0000
     2.3 @@ -5,6 +5,7 @@ from StringIO import StringIO
     2.4  
     2.5  from twisted.protocols import http
     2.6  from twisted.web import error
     2.7 +from twisted.python.failure import Failure
     2.8  
     2.9  from xen.xend import sxp
    2.10  from xen.xend import XendDomain
    2.11 @@ -94,6 +95,8 @@ class SrvDomainDir(SrvDir):
    2.12      def _op_create_err(self, err, req):
    2.13          """Callback to handle errors in deferred domain creation.
    2.14          """
    2.15 +        if isinstance(err, Failure):
    2.16 +            err = err.getErrorMessage()
    2.17          print 'op_create> Deferred Exception creating domain:', err
    2.18          req.setResponseCode(http.BAD_REQUEST, "Error creating domain: " + str(err))
    2.19          return str(err)
    2.20 @@ -127,6 +130,8 @@ class SrvDomainDir(SrvDir):
    2.21              return val
    2.22  
    2.23      def _op_restore_err(self, err, req):
    2.24 +        if isinstance(err, Failure):
    2.25 +            err = err.getErrorMessage()
    2.26          print 'op_create> Deferred Exception restoring domain:', err
    2.27          req.setResponseCode(http.BAD_REQUEST, "Error restoring domain: "+ str(err))
    2.28          return str(err)
     3.1 --- a/tools/python/xen/xend/server/blkif.py	Thu Oct 21 06:54:28 2004 +0000
     3.2 +++ b/tools/python/xen/xend/server/blkif.py	Thu Oct 21 10:47:34 2004 +0000
     3.3 @@ -340,8 +340,8 @@ class BlkDev(controller.SplitDev):
     3.4          val = unpackMsg('blkif_be_vbd_grow_t', msg)
     3.5  	status = val['status']
     3.6  	if status != BLKIF_BE_STATUS_OKAY:
     3.7 -            raise XendError("Adding extent to vbd failed: device %d, error %d"
     3.8 -                            % (self.vdev, status))
     3.9 +            raise XendError("Adding extent to vbd failed: device %s, error %d"
    3.10 +                            % (sxp.to_string(self.config), status))
    3.11          return self
    3.12  
    3.13      def send_be_vbd_destroy(self):