[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-tools] [PATCH] fix xend block-create crash
This patch fixes a crash in xend when adding a block device by doing an "xm block-create" operation: # xm block-create foobar phy:/dev/hdb1 hda1 ro Traceback (most recent call last): File "/usr/sbin/xm", line 10, in ? main.main(sys.argv) File "/usr/lib/python/xen/xm/main.py", line 721, in main handle_xend_error(argv[1], args[0], ex) File "/usr/lib/python/xen/xm/main.py", line 162, in handle_xend_error raise ex xen.xend.XendProtocol.XendError: Internal server error This stack trace is a result of the new blkif xenstore setup code returning None, instead of a device object with a getConfig() method. The fix implemented is to resume creating a Blkif object, but without sending the event channel setup messages. This also results in a functioning block-list xm command. Signed-off-by: Dan Smith <danms@xxxxxxxxxx> diff -r 8af8ddf91078 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Wed Aug 31 14:53:43 2005 +++ b/tools/python/xen/xend/XendDomainInfo.py Wed Aug 31 11:10:26 2005 @@ -414,21 +414,25 @@ db['backend-id'] = "%i" % backdom.id backdb['frontend'] = db.getPath() - (type, params) = string.split(sxp.child_value(devconfig, 'uname'), ':', 1) - node = Blkctl.block('bind', type, params) + (vbdtype, params) = string.split(sxp.child_value(devconfig, 'uname'), ':', 1) + node = Blkctl.block('bind', vbdtype, params) backdb['frontend-id'] = "%i" % self.id backdb['physical-device'] = "%li" % blkdev_name_to_number(node) backdb.saveDB(save=True) # Ok, super gross, this really doesn't belong in the frontend db... - db['type'] = type + db['type'] = vbdtype db['node'] = node db['params'] = params db.saveDB(save=True) - - return - - if type == 'vif': + + ctrl = self.findDeviceController(type) + device = ctrl.createDevice(devconfig, recreate=self.recreate, + change=change) + device.setNode(node) + return device + + elif type == 'vif': backdom = domain_exists(sxp.child_value(devconfig, 'backend', '0')) log.error(devconfig) @@ -457,9 +461,10 @@ db.saveDB(save=True) return - - ctrl = self.findDeviceController(type) - return ctrl.createDevice(devconfig, recreate=self.recreate, + + else: + ctrl = self.findDeviceController(type) + return ctrl.createDevice(devconfig, recreate=self.recreate, change=change) def configureDevice(self, type, id, devconfig): diff -r 8af8ddf91078 tools/python/xen/xend/server/blkif.py --- a/tools/python/xen/xend/server/blkif.py Wed Aug 31 14:53:43 2005 +++ b/tools/python/xen/xend/server/blkif.py Wed Aug 31 11:10:26 2005 @@ -255,12 +255,6 @@ return self.config def attach(self, recreate=False, change=False): - if recreate: - pass - else: - node = Blkctl.block('bind', self.type, self.params) - self.setNode(node) - self.attachBackend() if change: self.interfaceChanged() @@ -351,7 +345,6 @@ self.destroyed = True log.debug("Destroying vbd domain=%d id=%s", self.frontendDomain, self.id) - self.send_be_vbd_destroy() if change: self.interfaceChanged() self.unbind() @@ -362,36 +355,6 @@ """ self.getBackend().interfaceChanged() - def attachBackend(self): - """Attach the device to its controller. - - """ - self.getBackend().connect() - self.send_be_vbd_create() - - def send_be_vbd_create(self): - msg = packMsg('blkif_be_vbd_create_t', - { 'domid' : self.frontendDomain, - 'blkif_handle' : self.backendId, - 'pdevice' : self.device, - 'dev_handle' : self.dev_handle, - 'vdevice' : self.vdev, - 'readonly' : self.readonly() }) - msg = self.backendChannel.requestResponse(msg) - - val = unpackMsg('blkif_be_vbd_create_t', msg) - status = val['status'] - if status != BLKIF_BE_STATUS_OKAY: - raise XendError("Creating vbd failed: device %s, error %d" - % (sxp.to_string(self.config), status)) - - def send_be_vbd_destroy(self): - msg = packMsg('blkif_be_vbd_destroy_t', - { 'domid' : self.frontendDomain, - 'blkif_handle' : self.backendId, - 'vdevice' : self.vdev }) - return self.backendChannel.writeRequest(msg) - class BlkifController(DevController): """Block device interface controller. Handles all block devices for a domain. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@xxxxxxxxxx _______________________________________________ Xen-tools mailing list Xen-tools@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-tools
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |