remove FlavorCreateFailed exception

After flavors were objectified in
I86432720b600e479d8d8b7f7531a2c85ab364319 (2 years ago) the only place
that this exception was raised was removed from the code. This removes
all additional references to it in code and tests.

Change-Id: Ic848db8c3df75054c389e87b2405134262b531e2
This commit is contained in:
Sean Dague 2016-05-17 08:33:52 -04:00
parent e9a3bca866
commit c414b715f3
5 changed files with 3 additions and 35 deletions

View File

@ -54,7 +54,7 @@ class FlavorManageController(wsgi.Controller):
# NOTE(oomichi): Return 200 for backwards compatibility but should be 201
# as this operation complete the creation of flavor resource.
@wsgi.action("create")
@extensions.expected_errors((400, 409, 500))
@extensions.expected_errors((400, 409))
@validation.schema(flavor_manage.create_v20, '2.0', '2.0')
@validation.schema(flavor_manage.create, '2.1')
def _create(self, req, body):
@ -88,9 +88,6 @@ class FlavorManageController(wsgi.Controller):
except exception.ObjectActionError:
raise webob.exc.HTTPConflict(explanation=_(
'Not all flavors have been migrated to the API database'))
except exception.FlavorCreateFailed as err:
raise webob.exc.HTTPInternalServerError(explanation=
err.format_message())
return self._view_builder.show(req, flavor)

View File

@ -93,9 +93,6 @@ class FlavorManageController(wsgi.Controller):
'Not all flavors have been migrated to the API database'))
except exception.InvalidInput as exc:
raise webob.exc.HTTPBadRequest(explanation=exc.format_message())
except exception.FlavorCreateFailed as exc:
raise webob.exc.HTTPInternalServerError(explanation=
exc.format_message())
return self._view_builder.show(req, flavor)

View File

@ -1492,10 +1492,6 @@ class AggregateHostExists(NovaException):
msg_fmt = _("Aggregate %(aggregate_id)s already has host %(host)s.")
class FlavorCreateFailed(NovaException):
msg_fmt = _("Unable to create flavor")
class InstancePasswordSetFailed(NovaException):
msg_fmt = _("Failed to set admin password on %(instance)s "
"because %(reason)s")

View File

@ -15,7 +15,6 @@
import datetime
import mock
from oslo_serialization import jsonutils
import six
import webob
@ -321,27 +320,6 @@ class FlavorManageTestV21(test.NoDBTestCase):
self.assertRaises(webob.exc.HTTPConflict, self.controller._create,
self._get_http_request(), body=expected)
@mock.patch('nova.compute.flavors.create',
side_effect=exception.FlavorCreateFailed)
def test_flavor_create_db_failed(self, mock_create):
request_dict = {
"flavor": {
"name": "test",
'id': "12345",
"ram": 512,
"vcpus": 2,
"disk": 1,
"OS-FLV-EXT-DATA:ephemeral": 1,
"swap": 512,
"rxtx_factor": 1,
"os-flavor-access:is_public": True,
}
}
ex = self.assertRaises(webob.exc.HTTPInternalServerError,
self.controller._create,
self._get_http_request(), body=request_dict)
self.assertIn('Unable to create flavor', ex.explanation)
def test_invalid_memory_mb(self):
"""Check negative and decimal number can't be accepted."""

View File

@ -444,14 +444,14 @@ class CreateInstanceTypeTest(test.TestCase):
self.assertEqual(f.flavorid, new_list[i].flavorid)
def test_duplicate_names_fail(self):
# Ensures that name duplicates raise FlavorCreateFailed.
# Ensures that name duplicates raise FlavorExists
flavors.create('flavor', 256, 1, 120, 200, 'flavor1')
self.assertRaises(exception.FlavorExists,
flavors.create,
'flavor', 64, 1, 120)
def test_duplicate_flavorids_fail(self):
# Ensures that flavorid duplicates raise FlavorCreateFailed.
# Ensures that flavorid duplicates raise FlavorExists
flavors.create('flavor1', 64, 1, 120, flavorid='flavorid')
self.assertRaises(exception.FlavorIdExists,
flavors.create,