Merge "raise exception ComputeHostNotFound if host is not found"
This commit is contained in:
commit
1913050fd1
@ -333,6 +333,7 @@ class ComputeTaskManager(base.Base):
|
|||||||
try:
|
try:
|
||||||
task.execute()
|
task.execute()
|
||||||
except (exception.NoValidHost,
|
except (exception.NoValidHost,
|
||||||
|
exception.ComputeHostNotFound,
|
||||||
exception.ComputeServiceUnavailable,
|
exception.ComputeServiceUnavailable,
|
||||||
exception.InvalidHypervisorType,
|
exception.InvalidHypervisorType,
|
||||||
exception.InvalidCPUInfo,
|
exception.InvalidCPUInfo,
|
||||||
|
@ -83,10 +83,7 @@ class LiveMigrationTask(base.TaskBase):
|
|||||||
method='live migrate')
|
method='live migrate')
|
||||||
|
|
||||||
def _check_host_is_up(self, host):
|
def _check_host_is_up(self, host):
|
||||||
try:
|
service = objects.Service.get_by_compute_host(self.context, host)
|
||||||
service = objects.Service.get_by_compute_host(self.context, host)
|
|
||||||
except exception.NotFound:
|
|
||||||
raise exception.ComputeServiceUnavailable(host=host)
|
|
||||||
|
|
||||||
if not self.servicegroup_api.service_is_up(service):
|
if not self.servicegroup_api.service_is_up(service):
|
||||||
raise exception.ComputeServiceUnavailable(host=host)
|
raise exception.ComputeServiceUnavailable(host=host)
|
||||||
|
@ -93,7 +93,7 @@ class NovaException(Exception):
|
|||||||
# log the issue and the kwargs
|
# log the issue and the kwargs
|
||||||
LOG.exception(_LE('Exception in string format operation'))
|
LOG.exception(_LE('Exception in string format operation'))
|
||||||
for name, value in six.iteritems(kwargs):
|
for name, value in six.iteritems(kwargs):
|
||||||
LOG.error("%s: %s" % (name, value)) # noqa
|
LOG.error("%s: %s" % (name, value)) # noqa
|
||||||
|
|
||||||
if CONF.fatal_exception_format_errors:
|
if CONF.fatal_exception_format_errors:
|
||||||
six.reraise(*exc_info)
|
six.reraise(*exc_info)
|
||||||
|
@ -138,10 +138,11 @@ class LiveMigrationTaskTestCase(test.NoDBTestCase):
|
|||||||
self.mox.StubOutWithMock(objects.Service, 'get_by_compute_host')
|
self.mox.StubOutWithMock(objects.Service, 'get_by_compute_host')
|
||||||
|
|
||||||
objects.Service.get_by_compute_host(
|
objects.Service.get_by_compute_host(
|
||||||
self.context, "host").AndRaise(exception.NotFound)
|
self.context, "host").AndRaise(
|
||||||
|
exception.ComputeHostNotFound(host='host'))
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
self.assertRaises(exception.ComputeServiceUnavailable,
|
self.assertRaises(exception.ComputeHostNotFound,
|
||||||
self.task._check_host_is_up, "host")
|
self.task._check_host_is_up, "host")
|
||||||
|
|
||||||
def test_check_requested_destination(self):
|
def test_check_requested_destination(self):
|
||||||
@ -187,10 +188,11 @@ class LiveMigrationTaskTestCase(test.NoDBTestCase):
|
|||||||
self.mox.StubOutWithMock(objects.Service, 'get_by_compute_host')
|
self.mox.StubOutWithMock(objects.Service, 'get_by_compute_host')
|
||||||
|
|
||||||
objects.Service.get_by_compute_host(
|
objects.Service.get_by_compute_host(
|
||||||
self.context, self.destination).AndRaise(exception.NotFound)
|
self.context, self.destination).AndRaise(
|
||||||
|
exception.ComputeHostNotFound(host='host'))
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
self.assertRaises(exception.ComputeServiceUnavailable,
|
self.assertRaises(exception.ComputeHostNotFound,
|
||||||
self.task._check_requested_destination)
|
self.task._check_requested_destination)
|
||||||
|
|
||||||
def test_check_requested_destination_fails_with_not_enough_memory(self):
|
def test_check_requested_destination_fails_with_not_enough_memory(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user