Merge "Change invalid input error code to 400"
This commit is contained in:
commit
505ce767ad
|
@ -22,7 +22,6 @@ from oslo_utils.strutils import bool_from_string
|
|||
from blazar import context
|
||||
from blazar.db import api as db_api
|
||||
from blazar.db import utils as db_utils
|
||||
from blazar import exceptions
|
||||
from blazar.manager import exceptions as mgr_exceptions
|
||||
from blazar.plugins import base
|
||||
from blazar.plugins import instances as plugin
|
||||
|
@ -315,8 +314,8 @@ class VirtualInstancePlugin(base.BasePlugin, nova.NovaClientWrapper):
|
|||
# TODO(masahito) the instance reservation plugin only supports
|
||||
# anti-affinity rule in short-term goal.
|
||||
if bool_from_string(values['affinity']):
|
||||
raise exceptions.BlazarException('affinity = True is not '
|
||||
'supported.')
|
||||
raise mgr_exceptions.MalformedParameter(
|
||||
param='affinity (only affinity = False is supported)')
|
||||
|
||||
hosts = self.pickup_hosts(reservation_id, values)
|
||||
|
||||
|
@ -383,8 +382,8 @@ class VirtualInstancePlugin(base.BasePlugin, nova.NovaClientWrapper):
|
|||
# TODO(masahito) the instance reservation plugin only supports
|
||||
# anti-affinity rule in short-term goal.
|
||||
if bool_from_string(new_values.get('affinity', None)):
|
||||
raise exceptions.BlazarException('affinity = True is not '
|
||||
'supported.')
|
||||
raise mgr_exceptions.MalformedParameter(
|
||||
param='affinity (only affinity = False is supported)')
|
||||
|
||||
reservation = db_api.reservation_get(reservation_id)
|
||||
lease = db_api.lease_get(reservation['lease_id'])
|
||||
|
|
|
@ -22,7 +22,6 @@ import six
|
|||
from blazar import context
|
||||
from blazar.db import api as db_api
|
||||
from blazar.db import utils as db_utils
|
||||
from blazar import exceptions
|
||||
from blazar.manager import exceptions as mgr_exceptions
|
||||
from blazar.plugins import instances
|
||||
from blazar.plugins.instances import instance_plugin
|
||||
|
@ -127,9 +126,9 @@ class TestVirtualInstancePlugin(tests.TestCase):
|
|||
inputs = self.get_input_values(2, 4018, 10, 1, True,
|
||||
'2030-01-01 08:00', '2030-01-01 08:00',
|
||||
'lease-1', '')
|
||||
self.assertRaises(exceptions.BlazarException, plugin.reserve_resource,
|
||||
'reservation_id', inputs)
|
||||
self.assertRaises(exceptions.BlazarException,
|
||||
self.assertRaises(mgr_exceptions.MalformedParameter,
|
||||
plugin.reserve_resource, 'reservation_id', inputs)
|
||||
self.assertRaises(mgr_exceptions.MalformedParameter,
|
||||
plugin.update_reservation, 'reservation_id', inputs)
|
||||
|
||||
def test_filter_hosts_by_reservation_with_exclude(self):
|
||||
|
|
Loading…
Reference in New Issue