Merge "migrate server doesn't raise correct exception"
This commit is contained in:
@@ -132,6 +132,8 @@ class AdminActionsController(wsgi.Controller):
|
|||||||
except exception.InstanceInvalidState as state_error:
|
except exception.InstanceInvalidState as state_error:
|
||||||
common.raise_http_conflict_for_instance_invalid_state(state_error,
|
common.raise_http_conflict_for_instance_invalid_state(state_error,
|
||||||
'migrate')
|
'migrate')
|
||||||
|
except exception.InstanceNotFound as e:
|
||||||
|
raise exc.HTTPNotFound(explanation=e.format_message())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_("Error in migrate %s"), e)
|
LOG.exception(_("Error in migrate %s"), e)
|
||||||
raise exc.HTTPBadRequest()
|
raise exc.HTTPBadRequest()
|
||||||
@@ -301,6 +303,8 @@ class AdminActionsController(wsgi.Controller):
|
|||||||
exception.UnableToMigrateToSelf,
|
exception.UnableToMigrateToSelf,
|
||||||
exception.DestinationHypervisorTooOld) as ex:
|
exception.DestinationHypervisorTooOld) as ex:
|
||||||
raise exc.HTTPBadRequest(explanation=ex.format_message())
|
raise exc.HTTPBadRequest(explanation=ex.format_message())
|
||||||
|
except exception.InstanceNotFound as e:
|
||||||
|
raise exc.HTTPNotFound(explanation=e.format_message())
|
||||||
except Exception:
|
except Exception:
|
||||||
if host is None:
|
if host is None:
|
||||||
msg = _("Live migration of instance %s to another host "
|
msg = _("Live migration of instance %s to another host "
|
||||||
|
@@ -169,8 +169,12 @@ class AdminActionsTest(CommonMixin, test.NoDBTestCase):
|
|||||||
def test_actions_with_non_existed_instance(self):
|
def test_actions_with_non_existed_instance(self):
|
||||||
actions = ['pause', 'unpause', 'suspend', 'resume',
|
actions = ['pause', 'unpause', 'suspend', 'resume',
|
||||||
'resetNetwork', 'injectNetworkInfo', 'lock',
|
'resetNetwork', 'injectNetworkInfo', 'lock',
|
||||||
'unlock', 'os-resetState']
|
'unlock', 'os-resetState', 'migrate']
|
||||||
body_map = {'os-resetState': {'state': 'active'}}
|
body_map = {'os-resetState': {'state': 'active'},
|
||||||
|
'os-migrateLive':
|
||||||
|
{'host': 'hostname',
|
||||||
|
'block_migration': False,
|
||||||
|
'disk_over_commit': False}}
|
||||||
for action in actions:
|
for action in actions:
|
||||||
self._test_non_existing_instance(action,
|
self._test_non_existing_instance(action,
|
||||||
body_map=body_map)
|
body_map=body_map)
|
||||||
|
Reference in New Issue
Block a user