diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index ed44746924..02d2fcdb58 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -726,6 +726,7 @@ class ServersController(wsgi.Controller): exception.MemoryPageSizeInvalid, exception.MemoryPageSizeForbidden, exception.PciRequestAliasNotDefined, + exception.PciInvalidAlias, exception.RealtimeConfigurationInvalid, exception.RealtimeMaskNotFoundOrInvalid, exception.SnapshotNotFound, diff --git a/nova/tests/unit/api/openstack/compute/test_serversV21.py b/nova/tests/unit/api/openstack/compute/test_serversV21.py index 170a54c7ba..93fb95dfa0 100644 --- a/nova/tests/unit/api/openstack/compute/test_serversV21.py +++ b/nova/tests/unit/api/openstack/compute/test_serversV21.py @@ -6068,8 +6068,18 @@ class ServersControllerCreateTest(test.TestCase): alias='fake_name')) def test_create_instance_pci_alias_not_defined(self, mock_create): # Tests that PciRequestAliasNotDefined is translated to a 400 error. - self.assertRaises(webob.exc.HTTPBadRequest, - self._test_create_extra, {}) + ex = self.assertRaises(webob.exc.HTTPBadRequest, + self._test_create_extra, {}) + self.assertIn('PCI alias fake_name is not defined', six.text_type(ex)) + + @mock.patch.object(compute_api.API, 'create', + side_effect=exception.PciInvalidAlias( + reason='just because')) + def test_create_instance_pci_invalid_alias(self, mock_create): + # Tests that PciInvalidAlias is translated to a 400 error. + ex = self.assertRaises(webob.exc.HTTPBadRequest, + self._test_create_extra, {}) + self.assertIn('Invalid PCI alias definition', six.text_type(ex)) def test_create_instance_with_user_data(self): value = base64.encode_as_text("A random string")