Remove the duplicate flavor disable check
We moved the admin role check to db api side, so common users will get a NotFound error, if they try to get a disabled flavor. Also we check whether the flavor disabled on api side, if so, we will raise a FlavorDisabled error to admin users. Change-Id: I4b4595bab266a7041b860e582c64a0198e50c322
This commit is contained in:
parent
dd5f08210b
commit
98fd7160e7
@ -82,8 +82,6 @@ class API(object):
|
||||
requested_networks, user_data,
|
||||
key_name, max_count):
|
||||
"""Verify all the input parameters"""
|
||||
if flavor['disabled']:
|
||||
raise exception.FlavorNotFound(flavor_id=flavor['uuid'])
|
||||
|
||||
if user_data:
|
||||
l = len(user_data)
|
||||
|
@ -70,26 +70,6 @@ class ComputeAPIUnitTest(base.DbTestCase):
|
||||
self.assertEqual('test_az', base_opts['availability_zone'])
|
||||
self.assertIsNone(key_pair)
|
||||
|
||||
def test__validate_and_build_base_options_flavor_disabled(self):
|
||||
flavor = self._create_flavor()
|
||||
flavor.disabled = True
|
||||
flavor.save()
|
||||
|
||||
self.assertRaises(
|
||||
exception.FlavorNotFound,
|
||||
self.engine_api._validate_and_build_base_options,
|
||||
self.context,
|
||||
flavor,
|
||||
'fake-uuid',
|
||||
'fake-name',
|
||||
'fake-descritpion',
|
||||
'test_az',
|
||||
{'k1', 'v1'},
|
||||
[{'uuid': 'fake'}],
|
||||
None,
|
||||
None,
|
||||
1)
|
||||
|
||||
@mock.patch('mogan.network.api.get_client')
|
||||
def test__check_requested_networks(self, mock_get_client):
|
||||
mock_get_client.return_value = mock.MagicMock()
|
||||
|
Loading…
Reference in New Issue
Block a user