summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/exception.py3
-rw-r--r--nova/tests/test_compute.py3
-rw-r--r--nova/tests/test_libvirt.py9
-rw-r--r--nova/virt/libvirt/connection.py6
4 files changed, 14 insertions, 7 deletions
diff --git a/nova/exception.py b/nova/exception.py
index 38e705417..ea046b712 100644
--- a/nova/exception.py
+++ b/nova/exception.py
@@ -116,7 +116,8 @@ def wrap_exception(notifier=None, publisher_id=None, event_type=None,
notifier.notify(publisher_id, temp_type, temp_level,
payload)
- if not isinstance(e, Error):
+ if (not isinstance(e, Error) and
+ not isinstance(e, NovaException)):
#exc_type, exc_value, exc_traceback = sys.exc_info()
LOG.exception(_('Uncaught exception'))
#logging.error(traceback.extract_stack(exc_traceback))
diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py
index 2a8f33dd3..0ede4f469 100644
--- a/nova/tests/test_compute.py
+++ b/nova/tests/test_compute.py
@@ -583,8 +583,9 @@ class ComputeTestCase(test.TestCase):
the same host"""
instance_id = self._create_instance()
self.compute.run_instance(self.context, instance_id)
+ inst_ref = db.instance_get(self.context, instance_id)
self.assertRaises(exception.Error, self.compute.prep_resize,
- self.context, instance_id, 1)
+ self.context, inst_ref['uuid'], 1)
self.compute.terminate_instance(self.context, instance_id)
def test_migrate(self):
diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py
index ad0931a89..9a42556c2 100644
--- a/nova/tests/test_libvirt.py
+++ b/nova/tests/test_libvirt.py
@@ -412,6 +412,15 @@ class LibvirtConnTestCase(test.TestCase):
self.assertEquals(snapshot['status'], 'active')
self.assertEquals(snapshot['name'], snapshot_name)
+ def test_attach_invalid_device(self):
+ self.create_fake_libvirt_mock()
+ connection.LibvirtConnection._conn.lookupByName = self.fake_lookup
+ self.mox.ReplayAll()
+ conn = connection.LibvirtConnection(False)
+ self.assertRaises(exception.InvalidDevicePath,
+ conn.attach_volume,
+ "fake", "bad/device/path", "/dev/fake")
+
def test_multi_nic(self):
instance_data = dict(self.test_instance)
network_info = _create_network_info(2)
diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py
index 96f9c41f9..c27e92feb 100644
--- a/nova/virt/libvirt/connection.py
+++ b/nova/virt/libvirt/connection.py
@@ -351,7 +351,7 @@ class LibvirtConnection(driver.ComputeDriver):
virt_dom = self._lookup_by_name(instance_name)
mount_device = mountpoint.rpartition("/")[2]
(type, protocol, name) = \
- self._get_volume_device_info(vol['device_path'])
+ self._get_volume_device_info(device_path)
if type == 'block':
xml = """<disk type='block'>
<driver name='qemu' type='raw'/>
@@ -364,9 +364,6 @@ class LibvirtConnection(driver.ComputeDriver):
<source protocol='%s' name='%s'/>
<target dev='%s' bus='virtio'/>
</disk>""" % (protocol, name, mount_device)
- else:
- raise exception.InvalidDevicePath(path=device_path)
-
virt_dom.attachDevice(xml)
def _get_disk_xml(self, xml, device):
@@ -955,7 +952,6 @@ class LibvirtConnection(driver.ComputeDriver):
return True
return False
- @exception.wrap_exception
def _get_volume_device_info(self, device_path):
if device_path.startswith('/dev/'):
return ('block', None, None)