From 470d165d04d2fb16eb4719033363c35f0a84204c Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Tue, 28 Nov 2017 17:17:15 +0100 Subject: [PATCH] Deduplicate instance.create notification samples This patch refactors the sample files of instance.create notifications. As these notifications use a different payload class as the most of the instance notifications a new common payload sample fragment was also needed. Change-Id: I7a8e9507ee30d404e075a46e48070a0f94276e33 --- .../InstanceCreatePayload.json | 23 +++++ .../instance-create-end.json | 88 +------------------ .../instance-create-error.json | 76 ++-------------- .../instance-create-start.json | 78 ++-------------- 4 files changed, 38 insertions(+), 227 deletions(-) create mode 100644 doc/notification_samples/common_payloads/InstanceCreatePayload.json diff --git a/doc/notification_samples/common_payloads/InstanceCreatePayload.json b/doc/notification_samples/common_payloads/InstanceCreatePayload.json new file mode 100644 index 000000000000..85cda5631538 --- /dev/null +++ b/doc/notification_samples/common_payloads/InstanceCreatePayload.json @@ -0,0 +1,23 @@ +{ + "$ref":"InstanceActionPayload.json", + "nova_object.data": { + "block_devices": [], + "keypairs": [ + { + "nova_object.version": "1.0", + "nova_object.namespace": "nova", + "nova_object.name": "KeypairPayload", + "nova_object.data": { + "user_id": "fake", + "name": "my-key", + "fingerprint": "1e:2c:9b:56:79:4b:45:77:f9:ca:7a:98:2c:b0:d5:3c", + "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDx8nkQv/zgGgB4rMYmIf+6A4l6Rr+o/6lHBQdW5aYd44bd8JttDCE/F/pNRr0lRE+PiqSPO8nDPHw0010JeMH9gYgnnFlyY3/OcJ02RhIPyyxYpv9FhY+2YiUkpwFOcLImyrxEsYXpD/0d3ac30bNH6Sw9JD9UZHYcpSxsIbECHw== Generated-by-Nova", + "type": "ssh" + } + } + ], + "tags": ["tag"] + }, + "nova_object.name":"InstanceCreatePayload", + "nova_object.version": "1.7" +} diff --git a/doc/notification_samples/instance-create-end.json b/doc/notification_samples/instance-create-end.json index 5a7e951ceb52..1fe8f8cacf6f 100644 --- a/doc/notification_samples/instance-create-end.json +++ b/doc/notification_samples/instance-create-end.json @@ -1,92 +1,6 @@ { "event_type":"instance.create.end", - "payload":{ - "nova_object.data":{ - "architecture":"x86_64", - "availability_zone": "nova", - "block_devices":[], - "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" - } - }], - "key_name": "my-key", - "keypairs": [{ - "nova_object.name": "KeypairPayload", - "nova_object.namespace": "nova", - "nova_object.version": "1.0", - "nova_object.data": { - "user_id": "fake", - "name": "my-key", - "fingerprint": "1e:2c:9b:56:79:4b:45:77:f9:ca:7a:98:2c:b0:d5:3c", - "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDx8nkQv/zgGgB4rMYmIf+6A4l6Rr+o/6lHBQdW5aYd44bd8JttDCE/F/pNRr0lRE+PiqSPO8nDPHw0010JeMH9gYgnnFlyY3/OcJ02RhIPyyxYpv9FhY+2YiUkpwFOcLImyrxEsYXpD/0d3ac30bNH6Sw9JD9UZHYcpSxsIbECHw== Generated-by-Nova", - "type": "ssh" - } - }], - "kernel_id":"", - "launched_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", - "tags":["tag"], - "tenant_id":"6f70656e737461636b20342065766572", - "terminated_at":null, - "auto_disk_config":"MANUAL", - "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, - "rxtx_factor": 1.0, - "extra_specs": { - "hw:watchdog_action": "disabled" - }, - "projects": null, - "swap": 0, - "is_public": true, - "vcpu_weight": 0, - "description":null - }, - "nova_object.version": "1.4", - "nova_object.namespace": "nova" - }, - "updated_at": "2012-10-29T13:42:11Z", - "user_id":"fake", - "uuid":"178b0921-8f85-4257-88b6-2e743b5a975c" - }, - "nova_object.name":"InstanceCreatePayload", - "nova_object.namespace":"nova", - "nova_object.version":"1.7" - }, + "payload":{"$ref":"common_payloads/InstanceCreatePayload.json#"}, "priority":"INFO", "publisher_id":"nova-compute:compute" } diff --git a/doc/notification_samples/instance-create-error.json b/doc/notification_samples/instance-create-error.json index f43a9cfbfb0f..4002dad620d6 100644 --- a/doc/notification_samples/instance-create-error.json +++ b/doc/notification_samples/instance-create-error.json @@ -1,14 +1,8 @@ { "event_type":"instance.create.error", "payload":{ - "nova_object.data":{ - "architecture":"x86_64", - "availability_zone": "nova", - "block_devices":[], - "created_at":"2012-10-29T13:42:11Z", - "deleted_at":null, - "display_name":"some-server", - "display_description":"some-server", + "$ref":"common_payloads/InstanceCreatePayload.json#", + "nova_object.data": { "fault": { "nova_object.data": { "exception": "FlavorDiskTooSmall", @@ -20,69 +14,11 @@ "nova_object.namespace": "nova", "nova_object.version": "1.0" }, - "host":"compute", - "host_name":"some-server", "ip_addresses": [], - "key_name": "my-key", - "keypairs": [{ - "nova_object.name": "KeypairPayload", - "nova_object.namespace": "nova", - "nova_object.version": "1.0", - "nova_object.data": { - "user_id": "fake", - "name": "my-key", - "fingerprint": "1e:2c:9b:56:79:4b:45:77:f9:ca:7a:98:2c:b0:d5:3c", - "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDx8nkQv/zgGgB4rMYmIf+6A4l6Rr+o/6lHBQdW5aYd44bd8JttDCE/F/pNRr0lRE+PiqSPO8nDPHw0010JeMH9gYgnnFlyY3/OcJ02RhIPyyxYpv9FhY+2YiUkpwFOcLImyrxEsYXpD/0d3ac30bNH6Sw9JD9UZHYcpSxsIbECHw== Generated-by-Nova", - "type": "ssh" - } - }], - "kernel_id":"", - "launched_at":null, - "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":"building", - "task_state":null, - "power_state":"pending", - "tags":["tag"], - "tenant_id":"6f70656e737461636b20342065766572", - "terminated_at":null, - "auto_disk_config":"MANUAL", - "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, - "rxtx_factor": 1.0, - "extra_specs": { - "hw:watchdog_action": "disabled" - }, - "projects": null, - "swap": 0, - "is_public": true, - "vcpu_weight": 0, - "description":null - }, - "nova_object.version": "1.4", - "nova_object.namespace": "nova" - }, - "updated_at": "2012-10-29T13:42:11Z", - "user_id":"fake", - "uuid":"178b0921-8f85-4257-88b6-2e743b5a975c" - }, - "nova_object.name":"InstanceCreatePayload", - "nova_object.namespace":"nova", - "nova_object.version":"1.7" + "launched_at": null, + "power_state": "pending", + "state": "building" + } }, "priority":"ERROR", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-create-start.json b/doc/notification_samples/instance-create-start.json index 4a67dc6a572f..5877fcabc2d0 100644 --- a/doc/notification_samples/instance-create-start.json +++ b/doc/notification_samples/instance-create-start.json @@ -1,78 +1,16 @@ { "event_type":"instance.create.start", "payload":{ - "nova_object.data":{ - "architecture":"x86_64", - "availability_zone": "nova", - "block_devices":[], - "created_at":"2012-10-29T13:42:11Z", - "deleted_at":null, - "display_name":"some-server", - "display_description":"some-server", - "fault":null, - "host":null, - "host_name":"some-server", + "$ref":"common_payloads/InstanceCreatePayload.json#", + "nova_object.data": { + "host": null, "ip_addresses": [], - "key_name": "my-key", - "keypairs": [{ - "nova_object.name": "KeypairPayload", - "nova_object.namespace": "nova", - "nova_object.version": "1.0", - "nova_object.data": { - "user_id": "fake", - "name": "my-key", - "fingerprint": "1e:2c:9b:56:79:4b:45:77:f9:ca:7a:98:2c:b0:d5:3c", - "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDx8nkQv/zgGgB4rMYmIf+6A4l6Rr+o/6lHBQdW5aYd44bd8JttDCE/F/pNRr0lRE+PiqSPO8nDPHw0010JeMH9gYgnnFlyY3/OcJ02RhIPyyxYpv9FhY+2YiUkpwFOcLImyrxEsYXpD/0d3ac30bNH6Sw9JD9UZHYcpSxsIbECHw== Generated-by-Nova", - "type": "ssh" - } - }], - "kernel_id":"", - "launched_at":null, - "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", - "metadata":{}, - "locked":false, - "node":null, - "os_type":null, - "progress":0, - "ramdisk_id":"", - "reservation_id":"r-npxv0e40", - "state":"building", - "task_state":null, - "power_state":"pending", - "tags":["tag"], - "tenant_id":"6f70656e737461636b20342065766572", - "terminated_at":null, - "auto_disk_config":"MANUAL", - "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, - "rxtx_factor": 1.0, - "extra_specs": { - "hw:watchdog_action": "disabled" - }, - "projects": null, - "swap": 0, - "is_public": true, - "vcpu_weight": 0, - "description":null - }, - "nova_object.version": "1.4", - "nova_object.namespace": "nova" - }, + "launched_at": null, + "node": null, "updated_at": null, - "user_id":"fake", - "uuid":"178b0921-8f85-4257-88b6-2e743b5a975c" - }, - "nova_object.name":"InstanceCreatePayload", - "nova_object.namespace":"nova", - "nova_object.version":"1.7" + "power_state": "pending", + "state": "building" + } }, "priority":"INFO", "publisher_id":"nova-compute:compute"