ia64/xen-unstable

changeset 2658:1314598e0d84

bitkeeper revision 1.1159.116.1 (4174f7a3e7Ch5VhvKs2lI48e7S4KzA)

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 Tue Oct 19 11:16:51 2004 +0000 (2004-10-19)
parents 6ca032e0b814 da2af6f3a95e
children ffc49e9c4837
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	Mon Oct 18 14:38:09 2004 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Oct 19 11:16:51 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 @@ -763,6 +775,7 @@ class XendDomainInfo:
    1.23              append_deferred(dlist, v)
    1.24              index[dev_name] = dev_index + 1
    1.25          deferred = defer.DeferredList(dlist, fireOnOneErrback=1)
    1.26 +        deferred.addErrback(dlist_err)
    1.27          return deferred
    1.28  
    1.29      def device_create(self, dev_config):
    1.30 @@ -994,6 +1007,7 @@ class XendDomainInfo:
    1.31                  log.warning("Unknown config field %s", field_name)
    1.32              index[field_name] = field_index + 1
    1.33          d = defer.DeferredList(dlist, fireOnOneErrback=1)
    1.34 +        d.addErrback(dlist_err)
    1.35          return d
    1.36  
    1.37  
    1.38 @@ -1007,7 +1021,7 @@ def vm_image_linux(vm, image):
    1.39      """
    1.40      kernel = sxp.child_value(image, "kernel")
    1.41      cmdline = ""
    1.42 -    ip = sxp.child_value(image, "ip", "dhcp")
    1.43 +    ip = sxp.child_value(image, "ip", None)
    1.44      if ip:
    1.45          cmdline += " ip=" + ip
    1.46      root = sxp.child_value(image, "root")
     2.1 --- a/tools/python/xen/xend/server/SrvDomainDir.py	Mon Oct 18 14:38:09 2004 +0000
     2.2 +++ b/tools/python/xen/xend/server/SrvDomainDir.py	Tue Oct 19 11:16:51 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	Mon Oct 18 14:38:09 2004 +0000
     3.2 +++ b/tools/python/xen/xend/server/blkif.py	Tue Oct 19 11:16:51 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):