Handles exception when unsupported virt-type given
When a wrong virt type is configured in nova configuration files there is no mechaninsm to tell to the user about the unsupported virt type. This fix throws an unsupported virt type expection to the user if a wrong virt type is configured in the configs. Change-Id: I794a7c37d7a6224235a7fcb649f7db418687a794 Closes-Bug: #1425571
This commit is contained in:
parent
e5ed57dc3f
commit
2ffcd15192
|
@ -654,6 +654,13 @@ class LibvirtBlockInfoTest(test.NoDBTestCase):
|
|||
for res, args in expected:
|
||||
self.assertEqual(res, blockinfo.get_disk_bus_for_disk_dev(*args))
|
||||
|
||||
def test_fail_get_disk_bus_for_disk_dev_unsupported_virt_type(self):
|
||||
image_meta = {}
|
||||
self.assertRaises(exception.UnsupportedVirtType,
|
||||
blockinfo.get_disk_bus_for_device_type,
|
||||
'kvm1',
|
||||
image_meta)
|
||||
|
||||
def test_fail_get_disk_bus_for_disk_dev(self):
|
||||
self.assertRaises(exception.NovaException,
|
||||
blockinfo.get_disk_bus_for_disk_dev, 'inv', 'val')
|
||||
|
|
|
@ -266,6 +266,9 @@ def get_disk_bus_for_device_type(virt_type,
|
|||
return "ide"
|
||||
elif device_type == "disk":
|
||||
return "sata"
|
||||
else:
|
||||
# If virt-type not in list then it is unsupported
|
||||
raise exception.UnsupportedVirtType(virt=virt_type)
|
||||
|
||||
return None
|
||||
|
||||
|
|
Loading…
Reference in New Issue