[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] Fix "xm list --long" listing for removed devices
This patch makes xend clean up information about devices at removal so that the long xm listing is consistent with reality. This will close bug #416. Signed-off-by: Dan Smith <danms@xxxxxxxxxx> # HG changeset patch # User dan@xxxxxxxxxxxxxxxxxxxxxxxxxxx # Node ID c7b558e88f08037f68ba2fc5f6c5361517075f62 # Parent 2b45f4c5a565b24c06e0a25e920ff104eeb6eb62 Finish up bug #416. Remove devices from the config stored inside XendDomainInfo so that "xm list --long" is consistent with reality. diff -r 2b45f4c5a565 -r c7b558e88f08 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Wed Nov 30 20:19:15 2005 +++ b/tools/python/xen/xend/XendDomainInfo.py Wed Nov 30 20:21:15 2005 @@ -31,7 +31,7 @@ import xen.lowlevel.xc from xen.util import asserts -from xen.util.blkif import blkdev_uname_to_file +from xen.util.blkif import blkdev_uname_to_file, blkdev_name_to_number from xen.xend import image from xen.xend import sxp @@ -1275,6 +1275,33 @@ self.info['device'].append((dev_type, dev_config)) return self.getDeviceController(dev_type).sxpr(devid) + + def device_destroy(self, type, dev): + """Destroy a device. + + @param type: device type + @param dev: device id + """ + + try: + device = int(dev) + except: + device = blkdev_name_to_number(dev) + + for t,c in self.info['device']: + if t == type: + + currentDev = sxp.child_value(c, "dev") + try: + currentDev = int(currentDev) + except: + currentDev = blkdev_name_to_number(currentDev) + + if currentDev == device: + self.info['device'].remove((t,c)) + break + + self.destroyDevice(type, dev) def device_configure(self, dev_config, devid): """Configure an existing device. diff -r 2b45f4c5a565 -r c7b558e88f08 tools/python/xen/xend/server/SrvDomain.py --- a/tools/python/xen/xend/server/SrvDomain.py Wed Nov 30 20:19:15 2005 +++ b/tools/python/xen/xend/server/SrvDomain.py Wed Nov 30 20:21:15 2005 @@ -155,7 +155,7 @@ req) def op_device_destroy(self, _, req): - return self.call(self.dom.destroyDevice, + return self.call(self.dom.device_destroy, [['type', 'str'], ['dev', 'str']], req) -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@xxxxxxxxxx _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |