summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-08-04 22:51:14 +0000
committerGerrit Code Review <review@openstack.org>2012-08-04 22:51:14 +0000
commitc2ef8ad7c01b2cb5e0cceb676ea34f7afee828aa (patch)
treeb30200c44e43d743a8d92f2fd4cf54150c5232f4
parentef306fe4c342cf5e54b4512e46b67c80fbb414ab (diff)
parent25f50d9aa5000248959073fd47814f05efea3a3e (diff)
Merge "Update list_instances to catch libvirtError."
-rw-r--r--nova/tests/test_libvirt.py4
-rw-r--r--nova/virt/libvirt/driver.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py
index 99e81add2..db00334ea 100644
--- a/nova/tests/test_libvirt.py
+++ b/nova/tests/test_libvirt.py
@@ -912,10 +912,10 @@ class LibvirtConnTestCase(test.TestCase):
# Only one should be listed, since domain with ID 0 must be skiped
self.assertEquals(len(instances), 1)
- def test_list_instances_when_not_found(self):
+ def test_list_instances_when_instance_deleted(self):
def fake_lookup(instance_name):
- raise exception.InstanceNotFound()
+ raise libvirt.libvirtError("we deleted an instance!")
self.mox.StubOutWithMock(libvirt_driver.LibvirtDriver, '_conn')
libvirt_driver.LibvirtDriver._conn.lookupByID = fake_lookup
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index c19896171..7c7ed9543 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -416,7 +416,7 @@ class LibvirtDriver(driver.ComputeDriver):
if domain_id != 0:
domain = self._conn.lookupByID(domain_id)
names.append(domain.name())
- except exception.InstanceNotFound:
+ except libvirt.libvirtError:
# Instance was deleted while listing... ignore it
pass
return names