xend: On block-attach, remove device information when VmError occurs.

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.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
This commit is contained in:
Keir Fraser committed 2008-01-22 09:51:49 +00:00
1 parent 92765dcf80
commit bf4b59a4c7
1 file changed
+5
+5
View File
@@ -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
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.