Merge "Follow up for Ib6f95c22ffd3ea235b60db4da32094d49c2efa2a"

This commit is contained in:
Zuul 2018-10-02 08:57:36 +00:00 committed by Gerrit Code Review
commit ba509fddd5
8 changed files with 13 additions and 13 deletions

View File

@ -8,5 +8,5 @@
}
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"
"publisher_id":"nova-compute:fake-mini"
}

View File

@ -8,5 +8,5 @@
}
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"
"publisher_id":"nova-compute:fake-mini"
}

View File

@ -1800,7 +1800,7 @@ class API(base.Base):
# FIXME: When the instance context is targeted,
# we can remove this
with compute_utils.notify_about_instance_delete(
self.notifier, cctxt, instance, CONF.host):
self.notifier, cctxt, instance):
instance.destroy()
else:
instance.destroy()
@ -1858,7 +1858,7 @@ class API(base.Base):
try:
# Now destroy the instance from the cell it lives in.
with compute_utils.notify_about_instance_delete(
self.notifier, context, instance, CONF.host):
self.notifier, context, instance):
instance.destroy()
except exception.InstanceNotFound:
pass
@ -1929,7 +1929,7 @@ class API(base.Base):
if not instance.host and not may_have_ports_or_volumes:
try:
with compute_utils.notify_about_instance_delete(
self.notifier, context, instance, CONF.host,
self.notifier, context, instance,
delete_type
if delete_type != 'soft_delete'
else 'delete'):
@ -2090,7 +2090,7 @@ class API(base.Base):
LOG.warning("instance's host %s is down, deleting from "
"database", instance.host, instance=instance)
with compute_utils.notify_about_instance_delete(
self.notifier, context, instance, CONF.host,
self.notifier, context, instance,
delete_type if delete_type != 'soft_delete' else 'delete'):
elevated = context.elevated()

View File

@ -2823,7 +2823,7 @@ class ComputeManager(manager.Manager):
def soft_delete_instance(self, context, instance):
"""Soft delete an instance on this host."""
with compute_utils.notify_about_instance_delete(
self.notifier, context, instance, self.host, 'soft_delete',
self.notifier, context, instance, 'soft_delete',
source=fields.NotificationSource.COMPUTE):
try:
self.driver.soft_delete(instance)

View File

@ -1180,7 +1180,7 @@ class UnlimitedSemaphore(object):
@contextlib.contextmanager
def notify_about_instance_delete(notifier, context, instance, host,
def notify_about_instance_delete(notifier, context, instance,
delete_type='delete',
source=fields.NotificationSource.API):
try:
@ -1192,7 +1192,7 @@ def notify_about_instance_delete(notifier, context, instance, host,
notify_about_instance_action(
context,
instance,
host=host,
host=CONF.host,
source=source,
action=delete_type,
phase=fields.NotificationPhase.START)
@ -1205,7 +1205,7 @@ def notify_about_instance_delete(notifier, context, instance, host,
notify_about_instance_action(
context,
instance,
host=host,
host=CONF.host,
source=source,
action=delete_type,
phase=fields.NotificationPhase.END)

View File

@ -1426,7 +1426,7 @@ class ComputeTaskManager(base.Base):
# bdm, tags and instance record.
with obj_target_cell(instance, cell) as cctxt:
with compute_utils.notify_about_instance_delete(
self.notifier, cctxt, instance, CONF.host,
self.notifier, cctxt, instance,
source=fields.NotificationSource.CONDUCTOR):
try:
instance.destroy()

View File

@ -1732,7 +1732,7 @@ class _ComputeAPIUnitTestMixIn(object):
_lookup_instance.assert_called_once_with(
self.context, instance.uuid)
notify_mock.assert_called_once_with(
self.compute_api.notifier, self.context, instance, 'fake-mini')
self.compute_api.notifier, self.context, instance)
destroy_mock.assert_called_once_with()
@mock.patch.object(context, 'target_cell')

View File

@ -1107,7 +1107,7 @@ class ComputeUtilsTestCase(test.NoDBTestCase):
instance = fake_instance.fake_instance_obj(
self.context, expected_attrs=('system_metadata',))
with compute_utils.notify_about_instance_delete(
mock.sentinel.notifier, self.context, instance, "fake-mini"):
mock.sentinel.notifier, self.context, instance):
instance.destroy()
expected_notify_calls = [
mock.call(mock.sentinel.notifier, self.context, instance,