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:
|
||||
task.execute()
|
||||
except (exception.NoValidHost,
|
||||
exception.ComputeHostNotFound,
|
||||
exception.ComputeServiceUnavailable,
|
||||
exception.InvalidHypervisorType,
|
||||
exception.InvalidCPUInfo,
|
||||
|
@ -83,10 +83,7 @@ class LiveMigrationTask(base.TaskBase):
|
||||
method='live migrate')
|
||||
|
||||
def _check_host_is_up(self, host):
|
||||
try:
|
||||
service = objects.Service.get_by_compute_host(self.context, host)
|
||||
except exception.NotFound:
|
||||
raise exception.ComputeServiceUnavailable(host=host)
|
||||
service = objects.Service.get_by_compute_host(self.context, host)
|
||||
|
||||
if not self.servicegroup_api.service_is_up(service):
|
||||
raise exception.ComputeServiceUnavailable(host=host)
|
||||
|
@ -93,7 +93,7 @@ class NovaException(Exception):
|
||||
# log the issue and the kwargs
|
||||
LOG.exception(_LE('Exception in string format operation'))
|
||||
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:
|
||||
six.reraise(*exc_info)
|
||||
|
@ -138,10 +138,11 @@ class LiveMigrationTaskTestCase(test.NoDBTestCase):
|
||||
self.mox.StubOutWithMock(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.assertRaises(exception.ComputeServiceUnavailable,
|
||||
self.assertRaises(exception.ComputeHostNotFound,
|
||||
self.task._check_host_is_up, "host")
|
||||
|
||||
def test_check_requested_destination(self):
|
||||
@ -187,10 +188,11 @@ class LiveMigrationTaskTestCase(test.NoDBTestCase):
|
||||
self.mox.StubOutWithMock(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.assertRaises(exception.ComputeServiceUnavailable,
|
||||
self.assertRaises(exception.ComputeHostNotFound,
|
||||
self.task._check_requested_destination)
|
||||
|
||||
def test_check_requested_destination_fails_with_not_enough_memory(self):
|
||||
|
Loading…
Reference in New Issue
Block a user