Transform instance.trigger_crash_dump notification
Co-Authored-By: Balazs Gibizer <balazs.gibizer@ericsson.com> Co-Authored-By: Gábor Antal <antal@inf.u-szeged.hu> Change-Id: I10f120e4ff227f96d6c3fdd4a7123f13b84c4337 Implements: bp versioned-notification-transformation-queens
This commit is contained in:
parent
8d21d71100
commit
cfa4bfedbb
@ -0,0 +1,91 @@
|
||||
{
|
||||
"event_type":"instance.trigger_crash_dump.end",
|
||||
"payload": {
|
||||
"nova_object.data": {
|
||||
"architecture": "x86_64",
|
||||
"auto_disk_config": "MANUAL",
|
||||
"availability_zone": "nova",
|
||||
"block_devices": [
|
||||
{
|
||||
"nova_object.data": {
|
||||
"boot_index": null,
|
||||
"delete_on_termination": false,
|
||||
"device_name": "/dev/sdb",
|
||||
"tag": null,
|
||||
"volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113"
|
||||
},
|
||||
"nova_object.name": "BlockDevicePayload",
|
||||
"nova_object.namespace": "nova",
|
||||
"nova_object.version": "1.0"
|
||||
}
|
||||
],
|
||||
"created_at": "2012-10-29T13:42:11Z",
|
||||
"deleted_at": null,
|
||||
"display_name": "some-server",
|
||||
"display_description": "some-server",
|
||||
"fault": null,
|
||||
"host": "compute",
|
||||
"host_name": "some-server",
|
||||
"ip_addresses": [{
|
||||
"nova_object.name": "IpPayload",
|
||||
"nova_object.namespace": "nova",
|
||||
"nova_object.version": "1.0",
|
||||
"nova_object.data": {
|
||||
"mac": "fa:16:3e:4c:2c:30",
|
||||
"address": "192.168.1.3",
|
||||
"port_uuid": "ce531f90-199f-48c0-816c-13e38010b442",
|
||||
"meta": {},
|
||||
"version": 4,
|
||||
"label": "private-network",
|
||||
"device_name": "tapce531f90-19"
|
||||
}
|
||||
}],
|
||||
"kernel_id": "",
|
||||
"key_name": "my-key",
|
||||
"launched_at": "2012-10-29T13:42:11Z",
|
||||
"updated_at": "2012-10-29T13:42:11Z",
|
||||
"image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6",
|
||||
"metadata": {},
|
||||
"locked": false,
|
||||
"node": "fake-mini",
|
||||
"os_type": null,
|
||||
"progress": 0,
|
||||
"ramdisk_id": "",
|
||||
"reservation_id": "r-npxv0e40",
|
||||
"state": "active",
|
||||
"task_state": null,
|
||||
"power_state": "running",
|
||||
"tenant_id": "6f70656e737461636b20342065766572",
|
||||
"terminated_at": null,
|
||||
"flavor": {
|
||||
"nova_object.name": "FlavorPayload",
|
||||
"nova_object.data": {
|
||||
"flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3",
|
||||
"name": "test_flavor",
|
||||
"root_gb": 1,
|
||||
"vcpus": 1,
|
||||
"ephemeral_gb": 0,
|
||||
"memory_mb": 512,
|
||||
"disabled": false,
|
||||
"projects": null,
|
||||
"rxtx_factor": 1.0,
|
||||
"extra_specs": {
|
||||
"hw:watchdog_action": "disabled"
|
||||
},
|
||||
"swap": 0,
|
||||
"is_public": true,
|
||||
"vcpu_weight": 0
|
||||
},
|
||||
"nova_object.version": "1.3",
|
||||
"nova_object.namespace": "nova"
|
||||
},
|
||||
"user_id": "fake",
|
||||
"uuid": "0ab886d0-7443-4107-9265-48371bfa662b"
|
||||
},
|
||||
"nova_object.name": "InstanceActionPayload",
|
||||
"nova_object.namespace": "nova",
|
||||
"nova_object.version": "1.5"
|
||||
},
|
||||
"priority": "INFO",
|
||||
"publisher_id": "nova-compute:compute"
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
{
|
||||
"event_type":"instance.trigger_crash_dump.start",
|
||||
"payload": {
|
||||
"nova_object.data": {
|
||||
"architecture": "x86_64",
|
||||
"auto_disk_config": "MANUAL",
|
||||
"availability_zone": "nova",
|
||||
"block_devices": [
|
||||
{
|
||||
"nova_object.data": {
|
||||
"boot_index": null,
|
||||
"delete_on_termination": false,
|
||||
"device_name": "/dev/sdb",
|
||||
"tag": null,
|
||||
"volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113"
|
||||
},
|
||||
"nova_object.name": "BlockDevicePayload",
|
||||
"nova_object.namespace": "nova",
|
||||
"nova_object.version": "1.0"
|
||||
}
|
||||
],
|
||||
"created_at": "2012-10-29T13:42:11Z",
|
||||
"deleted_at": null,
|
||||
"display_name": "some-server",
|
||||
"display_description": "some-server",
|
||||
"fault": null,
|
||||
"host": "compute",
|
||||
"host_name": "some-server",
|
||||
"ip_addresses": [{
|
||||
"nova_object.name": "IpPayload",
|
||||
"nova_object.namespace": "nova",
|
||||
"nova_object.version": "1.0",
|
||||
"nova_object.data": {
|
||||
"mac": "fa:16:3e:4c:2c:30",
|
||||
"address": "192.168.1.3",
|
||||
"port_uuid": "ce531f90-199f-48c0-816c-13e38010b442",
|
||||
"meta": {},
|
||||
"version": 4,
|
||||
"label": "private-network",
|
||||
"device_name": "tapce531f90-19"
|
||||
}
|
||||
}],
|
||||
"kernel_id": "",
|
||||
"key_name": "my-key",
|
||||
"launched_at": "2012-10-29T13:42:11Z",
|
||||
"updated_at": "2012-10-29T13:42:11Z",
|
||||
"image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6",
|
||||
"metadata": {},
|
||||
"locked": false,
|
||||
"node": "fake-mini",
|
||||
"os_type": null,
|
||||
"progress": 0,
|
||||
"ramdisk_id": "",
|
||||
"reservation_id": "r-npxv0e40",
|
||||
"state": "active",
|
||||
"task_state": null,
|
||||
"power_state": "running",
|
||||
"tenant_id": "6f70656e737461636b20342065766572",
|
||||
"terminated_at": null,
|
||||
"flavor": {
|
||||
"nova_object.name": "FlavorPayload",
|
||||
"nova_object.data": {
|
||||
"flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3",
|
||||
"name": "test_flavor",
|
||||
"root_gb": 1,
|
||||
"vcpus": 1,
|
||||
"ephemeral_gb": 0,
|
||||
"memory_mb": 512,
|
||||
"disabled": false,
|
||||
"projects": null,
|
||||
"rxtx_factor": 1.0,
|
||||
"extra_specs": {
|
||||
"hw:watchdog_action": "disabled"
|
||||
},
|
||||
"swap": 0,
|
||||
"is_public": true,
|
||||
"vcpu_weight": 0
|
||||
},
|
||||
"nova_object.version": "1.3",
|
||||
"nova_object.namespace": "nova"
|
||||
},
|
||||
"user_id": "fake",
|
||||
"uuid": "0ab886d0-7443-4107-9265-48371bfa662b"
|
||||
},
|
||||
"nova_object.name": "InstanceActionPayload",
|
||||
"nova_object.namespace": "nova",
|
||||
"nova_object.version": "1.5"
|
||||
},
|
||||
"priority": "INFO",
|
||||
"publisher_id": "nova-compute:compute"
|
||||
}
|
@ -2634,6 +2634,9 @@ class ComputeManager(manager.Manager):
|
||||
|
||||
self._notify_about_instance_usage(context, instance,
|
||||
"trigger_crash_dump.start")
|
||||
compute_utils.notify_about_instance_action(context, instance,
|
||||
self.host, action=fields.NotificationAction.TRIGGER_CRASH_DUMP,
|
||||
phase=fields.NotificationPhase.START)
|
||||
|
||||
# This method does not change task_state and power_state because the
|
||||
# effect of a trigger depends on user's configuration.
|
||||
@ -2641,6 +2644,9 @@ class ComputeManager(manager.Manager):
|
||||
|
||||
self._notify_about_instance_usage(context, instance,
|
||||
"trigger_crash_dump.end")
|
||||
compute_utils.notify_about_instance_action(context, instance,
|
||||
self.host, action=fields.NotificationAction.TRIGGER_CRASH_DUMP,
|
||||
phase=fields.NotificationPhase.END)
|
||||
|
||||
@wrap_exception()
|
||||
@reverts_task_state
|
||||
|
@ -450,8 +450,8 @@ class InstanceStateUpdatePayload(base.NotificationPayloadBase):
|
||||
@base.notification_sample('instance-shelve_offload-end.json')
|
||||
@base.notification_sample('instance-soft_delete-start.json')
|
||||
@base.notification_sample('instance-soft_delete-end.json')
|
||||
# @base.notification_sample('instance-trigger_crash_dump-start.json')
|
||||
# @base.notification_sample('instance-trigger_crash_dump-end.json')
|
||||
@base.notification_sample('instance-trigger_crash_dump-start.json')
|
||||
@base.notification_sample('instance-trigger_crash_dump-end.json')
|
||||
# @base.notification_sample('instance-unrescue-start.json')
|
||||
# @base.notification_sample('instance-unrescue-end.json')
|
||||
@base.notification_sample('instance-unshelve-start.json')
|
||||
|
@ -1026,7 +1026,24 @@ class TestInstanceNotificationSample(
|
||||
pass
|
||||
|
||||
def _test_trigger_crash_dump(self, server):
|
||||
pass
|
||||
post = {'trigger_crash_dump': None}
|
||||
self.api.post_server_action(server['id'], post)
|
||||
|
||||
self._wait_for_notification('instance.trigger_crash_dump.end')
|
||||
|
||||
self.assertEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS))
|
||||
self._verify_notification(
|
||||
'instance-trigger_crash_dump-start',
|
||||
replacements={
|
||||
'reservation_id': server['reservation_id'],
|
||||
'uuid': server['id']},
|
||||
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
|
||||
self._verify_notification(
|
||||
'instance-trigger_crash_dump-end',
|
||||
replacements={
|
||||
'reservation_id': server['reservation_id'],
|
||||
'uuid': server['id']},
|
||||
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
|
||||
|
||||
def _test_volume_detach_attach_server(self, server):
|
||||
self._detach_volume_from_server(server, self.cinder.SWAP_OLD_VOL)
|
||||
|
@ -4068,14 +4068,23 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
|
||||
mock_delete_instance.assert_called_once_with(
|
||||
self.context, instance, bdms)
|
||||
|
||||
@mock.patch('nova.compute.utils.notify_about_instance_action')
|
||||
@mock.patch.object(nova.compute.manager.ComputeManager,
|
||||
'_notify_about_instance_usage')
|
||||
def test_trigger_crash_dump(self, notify_mock):
|
||||
@mock.patch.object(compute_utils, 'EventReporter')
|
||||
def test_trigger_crash_dump(self, event_mock, notify_mock,
|
||||
mock_instance_action_notify):
|
||||
instance = fake_instance.fake_instance_obj(
|
||||
self.context, vm_state=vm_states.ACTIVE)
|
||||
|
||||
self.compute.trigger_crash_dump(self.context, instance)
|
||||
|
||||
mock_instance_action_notify.assert_has_calls([
|
||||
mock.call(self.context, instance, 'fake-mini',
|
||||
action='trigger_crash_dump', phase='start'),
|
||||
mock.call(self.context, instance, 'fake-mini',
|
||||
action='trigger_crash_dump', phase='end')])
|
||||
|
||||
notify_mock.assert_has_calls([
|
||||
mock.call(self.context, instance, 'trigger_crash_dump.start'),
|
||||
mock.call(self.context, instance, 'trigger_crash_dump.end')
|
||||
|
Loading…
x
Reference in New Issue
Block a user