Merge "Follow up for Ib6f95c22ffd3ea235b60db4da32094d49c2efa2a"
This commit is contained in:
commit
ba509fddd5
@ -8,5 +8,5 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"priority":"INFO",
|
"priority":"INFO",
|
||||||
"publisher_id":"nova-compute:compute"
|
"publisher_id":"nova-compute:fake-mini"
|
||||||
}
|
}
|
||||||
|
@ -8,5 +8,5 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"priority":"INFO",
|
"priority":"INFO",
|
||||||
"publisher_id":"nova-compute:compute"
|
"publisher_id":"nova-compute:fake-mini"
|
||||||
}
|
}
|
||||||
|
@ -1800,7 +1800,7 @@ class API(base.Base):
|
|||||||
# FIXME: When the instance context is targeted,
|
# FIXME: When the instance context is targeted,
|
||||||
# we can remove this
|
# we can remove this
|
||||||
with compute_utils.notify_about_instance_delete(
|
with compute_utils.notify_about_instance_delete(
|
||||||
self.notifier, cctxt, instance, CONF.host):
|
self.notifier, cctxt, instance):
|
||||||
instance.destroy()
|
instance.destroy()
|
||||||
else:
|
else:
|
||||||
instance.destroy()
|
instance.destroy()
|
||||||
@ -1858,7 +1858,7 @@ class API(base.Base):
|
|||||||
try:
|
try:
|
||||||
# Now destroy the instance from the cell it lives in.
|
# Now destroy the instance from the cell it lives in.
|
||||||
with compute_utils.notify_about_instance_delete(
|
with compute_utils.notify_about_instance_delete(
|
||||||
self.notifier, context, instance, CONF.host):
|
self.notifier, context, instance):
|
||||||
instance.destroy()
|
instance.destroy()
|
||||||
except exception.InstanceNotFound:
|
except exception.InstanceNotFound:
|
||||||
pass
|
pass
|
||||||
@ -1929,7 +1929,7 @@ class API(base.Base):
|
|||||||
if not instance.host and not may_have_ports_or_volumes:
|
if not instance.host and not may_have_ports_or_volumes:
|
||||||
try:
|
try:
|
||||||
with compute_utils.notify_about_instance_delete(
|
with compute_utils.notify_about_instance_delete(
|
||||||
self.notifier, context, instance, CONF.host,
|
self.notifier, context, instance,
|
||||||
delete_type
|
delete_type
|
||||||
if delete_type != 'soft_delete'
|
if delete_type != 'soft_delete'
|
||||||
else 'delete'):
|
else 'delete'):
|
||||||
@ -2090,7 +2090,7 @@ class API(base.Base):
|
|||||||
LOG.warning("instance's host %s is down, deleting from "
|
LOG.warning("instance's host %s is down, deleting from "
|
||||||
"database", instance.host, instance=instance)
|
"database", instance.host, instance=instance)
|
||||||
with compute_utils.notify_about_instance_delete(
|
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'):
|
delete_type if delete_type != 'soft_delete' else 'delete'):
|
||||||
|
|
||||||
elevated = context.elevated()
|
elevated = context.elevated()
|
||||||
|
@ -2823,7 +2823,7 @@ class ComputeManager(manager.Manager):
|
|||||||
def soft_delete_instance(self, context, instance):
|
def soft_delete_instance(self, context, instance):
|
||||||
"""Soft delete an instance on this host."""
|
"""Soft delete an instance on this host."""
|
||||||
with compute_utils.notify_about_instance_delete(
|
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):
|
source=fields.NotificationSource.COMPUTE):
|
||||||
try:
|
try:
|
||||||
self.driver.soft_delete(instance)
|
self.driver.soft_delete(instance)
|
||||||
|
@ -1180,7 +1180,7 @@ class UnlimitedSemaphore(object):
|
|||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def notify_about_instance_delete(notifier, context, instance, host,
|
def notify_about_instance_delete(notifier, context, instance,
|
||||||
delete_type='delete',
|
delete_type='delete',
|
||||||
source=fields.NotificationSource.API):
|
source=fields.NotificationSource.API):
|
||||||
try:
|
try:
|
||||||
@ -1192,7 +1192,7 @@ def notify_about_instance_delete(notifier, context, instance, host,
|
|||||||
notify_about_instance_action(
|
notify_about_instance_action(
|
||||||
context,
|
context,
|
||||||
instance,
|
instance,
|
||||||
host=host,
|
host=CONF.host,
|
||||||
source=source,
|
source=source,
|
||||||
action=delete_type,
|
action=delete_type,
|
||||||
phase=fields.NotificationPhase.START)
|
phase=fields.NotificationPhase.START)
|
||||||
@ -1205,7 +1205,7 @@ def notify_about_instance_delete(notifier, context, instance, host,
|
|||||||
notify_about_instance_action(
|
notify_about_instance_action(
|
||||||
context,
|
context,
|
||||||
instance,
|
instance,
|
||||||
host=host,
|
host=CONF.host,
|
||||||
source=source,
|
source=source,
|
||||||
action=delete_type,
|
action=delete_type,
|
||||||
phase=fields.NotificationPhase.END)
|
phase=fields.NotificationPhase.END)
|
||||||
|
@ -1426,7 +1426,7 @@ class ComputeTaskManager(base.Base):
|
|||||||
# bdm, tags and instance record.
|
# bdm, tags and instance record.
|
||||||
with obj_target_cell(instance, cell) as cctxt:
|
with obj_target_cell(instance, cell) as cctxt:
|
||||||
with compute_utils.notify_about_instance_delete(
|
with compute_utils.notify_about_instance_delete(
|
||||||
self.notifier, cctxt, instance, CONF.host,
|
self.notifier, cctxt, instance,
|
||||||
source=fields.NotificationSource.CONDUCTOR):
|
source=fields.NotificationSource.CONDUCTOR):
|
||||||
try:
|
try:
|
||||||
instance.destroy()
|
instance.destroy()
|
||||||
|
@ -1732,7 +1732,7 @@ class _ComputeAPIUnitTestMixIn(object):
|
|||||||
_lookup_instance.assert_called_once_with(
|
_lookup_instance.assert_called_once_with(
|
||||||
self.context, instance.uuid)
|
self.context, instance.uuid)
|
||||||
notify_mock.assert_called_once_with(
|
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()
|
destroy_mock.assert_called_once_with()
|
||||||
|
|
||||||
@mock.patch.object(context, 'target_cell')
|
@mock.patch.object(context, 'target_cell')
|
||||||
|
@ -1107,7 +1107,7 @@ class ComputeUtilsTestCase(test.NoDBTestCase):
|
|||||||
instance = fake_instance.fake_instance_obj(
|
instance = fake_instance.fake_instance_obj(
|
||||||
self.context, expected_attrs=('system_metadata',))
|
self.context, expected_attrs=('system_metadata',))
|
||||||
with compute_utils.notify_about_instance_delete(
|
with compute_utils.notify_about_instance_delete(
|
||||||
mock.sentinel.notifier, self.context, instance, "fake-mini"):
|
mock.sentinel.notifier, self.context, instance):
|
||||||
instance.destroy()
|
instance.destroy()
|
||||||
expected_notify_calls = [
|
expected_notify_calls = [
|
||||||
mock.call(mock.sentinel.notifier, self.context, instance,
|
mock.call(mock.sentinel.notifier, self.context, instance,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user