Merge "Fixing immediate delete after boot on Libvirt"

This commit is contained in:
Jenkins
2011年11月03日 19:55:18 +00:00
committed by Gerrit Code Review

View File

@@ -1075,6 +1075,18 @@ class LibvirtConnTestCase(test.TestCase):
compute_driver = driver.ComputeDriver()
self.assertRaises(NotImplementedError, compute_driver.reboot, *args)
def test_immediate_delete(self):
# Skip if non-libvirt environment
if not self.lazy_load_library_exists():
return
conn = connection.LibvirtConnection(False)
self.mox.StubOutWithMock(connection.LibvirtConnection, '_conn')
connection.LibvirtConnection._conn.lookupByName = lambda x: None
instance = db.instance_create(self.context, self.test_instance)
conn.destroy(instance, {})
class NWFilterFakes:
def __init__(self):

View File

@@ -304,18 +304,18 @@ class LibvirtConnection(driver.ComputeDriver):
locals())
raise
try:
# NOTE(justinsb): We remove the domain definition. We probably
# would do better to keep it if cleanup=False (e.g. volumes?)
# (e.g. #2 - not losing machines on failure)
virt_dom.undefine()
except libvirt.libvirtError as e:
errcode = e.get_error_code()
LOG.warning(_("Error from libvirt during undefine of "
"%(instance_name)s. Code=%(errcode)s"
"Error=%(e)s") %
locals())
raise
try:
# NOTE(justinsb): We remove the domain definition. We probably
# would do better to keep it if cleanup=False (e.g. volumes?)
# (e.g. #2 - not losing machines on failure)
virt_dom.undefine()
except libvirt.libvirtError as e:
errcode = e.get_error_code()
LOG.warning(_("Error from libvirt during undefine of "
"%(instance_name)s. Code=%(errcode)s"
"Error=%(e)s") %
locals())
raise
for (network, mapping) in network_info:
self.vif_driver.unplug(instance, network, mapping)
Reference in New Issue
openstack/nova
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.

The note is not visible to the blocked user.