Follow up for Ib6f95c22ffd3ea235b60db4da32094d49c2efa2a
This patch removes the host parameter of the notify_about_instance_delete() call as it is always filled with CONF.host value. Change-Id: Iff3b605b9410d5a097b53f532870df65780bc1e4 Implements: bp versioned-notification-transformation-stein
This commit is contained in:
parent
e83dbe1205
commit
669d6499ee
@ -8,5 +8,5 @@
|
||||
}
|
||||
},
|
||||
"priority":"INFO",
|
||||
"publisher_id":"nova-compute:compute"
|
||||
"publisher_id":"nova-compute:fake-mini"
|
||||
}
|
||||
|
@ -8,5 +8,5 @@
|
||||
}
|
||||
},
|
||||
"priority":"INFO",
|
||||
"publisher_id":"nova-compute:compute"
|
||||
"publisher_id":"nova-compute:fake-mini"
|
||||
}
|
||||
|
@ -1833,7 +1833,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()
|
||||
@ -1891,7 +1891,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
|
||||
@ -1962,7 +1962,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'):
|
||||
@ -2111,7 +2111,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()
|
||||
|
@ -2824,7 +2824,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)
|
||||
|
@ -1156,7 +1156,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:
|
||||
@ -1168,7 +1168,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)
|
||||
@ -1181,7 +1181,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)
|
||||
|
@ -1419,7 +1419,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()
|
||||
|
@ -1712,7 +1712,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')
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user