Remove device information when VmError occurred
PATCH 1/1 Remove device information when VmError occurred
Hi,
I tested xm block-attach command with a wrong parameter(file:). Naturally a command error occurred.
Then I retested xm block-attach command with a correct parameter(phy:). But a command error occurred again.
The second command error occurred because Xend did not remove device information from self.info when the first command error occurred.
# xm block-attach vm1 file:/dev/hda4 hdb1 w Error: Device 833 (vbd) could not be connected. /dev/hda4 does not exist. Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode> [BackDomain]
Create a new virtual block device.
# xm block-attach vm1 phy:/dev/hda4 hdb1 w Error: The file "/dev/hda4" is already used Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode> [BackDomain]
Create a new virtual block device.
# xm block-list vm1 Vdev BE handle state evt-ch ring-ref BE-path 769 0 0 4 6 8 /local/domain/0/backend/vbd/1/769 #
This patch fixes the issue. The test result is as follows.
# xm block-attach vm1 file:/dev/hda4 hdb1 w Error: Device 833 (vbd) could not be connected. /dev/hda4 does not exist. Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode> [BackDomain]
Create a new virtual block device.
# xm block-attach vm1 phy:/dev/hda4 hdb1 w # xm block-list vm1 Vdev BE handle state evt-ch ring-ref BE-path 769 0 0 4 6 8 /local/domain/0/backend/vbd/2/769 833 0 0 4 8 833 /local/domain/0/backend/vbd/2/833 #
Signed-off-by Masaki Kanno <[email protected]>
Best regards,
Kan
tools/python/xen/xend/XendDomainInfo.py +5 -0
@@ -535,6 +535,11 @@ class XendDomainInfo: self._createDevice(dev_type, dev_config_dict) self._waitForDevice(dev_type, devid) except VmError, ex: + del self.info['devices'][dev_uuid] + if dev_type == 'tap': + self.info['vbd_refs'].remove(dev_uuid) + else: + self.info['%s_refs' % dev_type].remove(dev_uuid) raise ex else: devid = None
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel