From bb7d5214a459571460dfa1ff7dbda964e36dc068 Mon Sep 17 00:00:00 2001 From: Sujitha Date: Wed, 11 Jan 2017 21:43:07 +0000 Subject: [PATCH] Adding auto_disk_config field to InstancePayload Add auto_disk_config field to InstancePayload based on instance.auto_disk_config boolean value. If true, set it to AUTO else MANUAL. Implements: bp additional-notification-fields-for-searchlight Change-Id: I18af99479562e2fe5e74e6e1252b804b074fee58 --- .../instance-create-end.json | 3 ++- .../instance-create-error.json | 3 ++- .../instance-create-start.json | 3 ++- .../instance-delete-end.json | 3 ++- .../instance-delete-start.json | 3 ++- doc/notification_samples/instance-pause-end.json | 3 ++- .../instance-pause-start.json | 3 ++- .../instance-power_off-end.json | 3 ++- .../instance-power_off-start.json | 3 ++- .../instance-power_on-end.json | 3 ++- .../instance-power_on-start.json | 3 ++- .../instance-reboot-end.json | 3 ++- .../instance-reboot-error.json | 3 ++- .../instance-reboot-start.json | 3 ++- .../instance-rebuild-end.json | 3 ++- .../instance-rebuild-error.json | 3 ++- .../instance-rebuild-start.json | 5 +++-- .../instance-resize-end.json | 3 ++- .../instance-resize-start.json | 3 ++- .../instance-resize_finish-end.json | 3 ++- .../instance-resize_finish-start.json | 3 ++- .../instance-restore-end.json | 3 ++- .../instance-restore-start.json | 3 ++- .../instance-resume-end.json | 3 ++- .../instance-resume-start.json | 3 ++- .../instance-shelve-end.json | 3 ++- .../instance-shelve-start.json | 3 ++- .../instance-shelve_offload-end.json | 3 ++- .../instance-shelve_offload-start.json | 3 ++- .../instance-shutdown-end.json | 3 ++- .../instance-shutdown-start.json | 3 ++- .../instance-snapshot-end.json | 3 ++- .../instance-snapshot-start.json | 3 ++- .../instance-suspend-end.json | 3 ++- .../instance-suspend-start.json | 3 ++- .../instance-unpause-end.json | 3 ++- .../instance-unpause-start.json | 3 ++- .../instance-unshelve-end.json | 3 ++- .../instance-unshelve-start.json | 3 ++- doc/notification_samples/instance-update.json | 3 ++- .../instance-volume_swap-end.json | 3 ++- .../instance-volume_swap-error.json | 3 ++- .../instance-volume_swap-start.json | 3 ++- nova/notifications/objects/instance.py | 14 ++++++++++---- nova/objects/fields.py | 16 ++++++++++++++++ nova/tests/unit/compute/test_compute_utils.py | 3 ++- .../notifications/objects/test_notification.py | 9 +++++---- 47 files changed, 120 insertions(+), 53 deletions(-) diff --git a/doc/notification_samples/instance-create-end.json b/doc/notification_samples/instance-create-end.json index 5b2c008f5362..5f635887cfc8 100644 --- a/doc/notification_samples/instance-create-end.json +++ b/doc/notification_samples/instance-create-end.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "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 8907ce02bc6f..87e4c169e350 100644 --- a/doc/notification_samples/instance-create-error.json +++ b/doc/notification_samples/instance-create-error.json @@ -37,6 +37,7 @@ "power_state":"pending", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -64,7 +65,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "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 fbdb4a2f81c4..47a475b3becc 100644 --- a/doc/notification_samples/instance-create-start.json +++ b/doc/notification_samples/instance-create-start.json @@ -27,6 +27,7 @@ "power_state":"pending", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -54,7 +55,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-delete-end.json b/doc/notification_samples/instance-delete-end.json index 98bdefdfbaf8..0d78d37e6c5c 100644 --- a/doc/notification_samples/instance-delete-end.json +++ b/doc/notification_samples/instance-delete-end.json @@ -27,6 +27,7 @@ "power_state":"pending", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":"2012-10-29T13:42:11Z", + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -54,7 +55,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-delete-start.json b/doc/notification_samples/instance-delete-start.json index 137d802c2a42..3c50b4af0dfb 100644 --- a/doc/notification_samples/instance-delete-start.json +++ b/doc/notification_samples/instance-delete-start.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-pause-end.json b/doc/notification_samples/instance-pause-end.json index 4d20ee5c6c82..12acaba14049 100644 --- a/doc/notification_samples/instance-pause-end.json +++ b/doc/notification_samples/instance-pause-end.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-pause-start.json b/doc/notification_samples/instance-pause-start.json index dd4df0dc4455..ee5173745f20 100644 --- a/doc/notification_samples/instance-pause-start.json +++ b/doc/notification_samples/instance-pause-start.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-power_off-end.json b/doc/notification_samples/instance-power_off-end.json index 4dff7a054fcf..323a5a04cce2 100644 --- a/doc/notification_samples/instance-power_off-end.json +++ b/doc/notification_samples/instance-power_off-end.json @@ -40,6 +40,7 @@ "power_state":"shutdown", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-power_off-start.json b/doc/notification_samples/instance-power_off-start.json index 60f19a5cecfc..dc652418fe0c 100644 --- a/doc/notification_samples/instance-power_off-start.json +++ b/doc/notification_samples/instance-power_off-start.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-power_on-end.json b/doc/notification_samples/instance-power_on-end.json index 1ba3817a8e64..e98d3a24ae64 100644 --- a/doc/notification_samples/instance-power_on-end.json +++ b/doc/notification_samples/instance-power_on-end.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-power_on-start.json b/doc/notification_samples/instance-power_on-start.json index 7f4adc5206e2..90b463a7a937 100644 --- a/doc/notification_samples/instance-power_on-start.json +++ b/doc/notification_samples/instance-power_on-start.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-reboot-end.json b/doc/notification_samples/instance-reboot-end.json index 58b4d63ee879..f2700dbe0211 100644 --- a/doc/notification_samples/instance-reboot-end.json +++ b/doc/notification_samples/instance-reboot-end.json @@ -25,6 +25,7 @@ "device_name": "tapce531f90-19" } }], + "auto_disk_config":"MANUAL", "kernel_id":"", "launched_at":"2012-10-29T13:42:11Z", "image_uuid": "a2459075-d96c-40d5-893e-577ff92e721c", @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-reboot-error.json b/doc/notification_samples/instance-reboot-error.json index 016c104da19b..c54a440c96b2 100644 --- a/doc/notification_samples/instance-reboot-error.json +++ b/doc/notification_samples/instance-reboot-error.json @@ -35,6 +35,7 @@ "device_name": "tapce531f90-19" } }], + "auto_disk_config":"MANUAL", "kernel_id":"", "launched_at":"2012-10-29T13:42:11Z", "image_uuid": "a2459075-d96c-40d5-893e-577ff92e721c", @@ -77,7 +78,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"ERROR", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-reboot-start.json b/doc/notification_samples/instance-reboot-start.json index 13386f7111ee..16538f17d0f6 100644 --- a/doc/notification_samples/instance-reboot-start.json +++ b/doc/notification_samples/instance-reboot-start.json @@ -25,6 +25,7 @@ "device_name": "tapce531f90-19" } }], + "auto_disk_config":"MANUAL", "kernel_id":"", "launched_at":"2012-10-29T13:42:11Z", "image_uuid": "a2459075-d96c-40d5-893e-577ff92e721c", @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-rebuild-end.json b/doc/notification_samples/instance-rebuild-end.json index 82eccf7eccf6..0523ef147785 100755 --- a/doc/notification_samples/instance-rebuild-end.json +++ b/doc/notification_samples/instance-rebuild-end.json @@ -3,7 +3,7 @@ "publisher_id": "nova-compute:compute", "payload": { "nova_object.namespace": "nova", - "nova_object.version": "1.1", + "nova_object.version":"1.2", "nova_object.data": { "node": "fake-mini", "fault": null, @@ -12,6 +12,7 @@ "image_uuid": "a2459075-d96c-40d5-893e-577ff92e721c", "display_name": "some-server", "display_description": "some-server", + "auto_disk_config":"MANUAL", "tenant_id": "6f70656e737461636b20342065766572", "kernel_id": "", "created_at": "2012-10-29T13:42:11Z", diff --git a/doc/notification_samples/instance-rebuild-error.json b/doc/notification_samples/instance-rebuild-error.json index 4939ede390d2..cf083da9243e 100755 --- a/doc/notification_samples/instance-rebuild-error.json +++ b/doc/notification_samples/instance-rebuild-error.json @@ -11,6 +11,7 @@ "task_state": "rebuilding", "deleted_at": null, "architecture": null, + "auto_disk_config":"MANUAL", "ramdisk_id": "", "locked": false, "created_at": "2012-10-29T13:42:11Z", @@ -76,7 +77,7 @@ "nova_object.namespace": "nova" } }, - "nova_object.version": "1.1", + "nova_object.version":"1.2", "nova_object.namespace": "nova" }, "publisher_id": "nova-compute:compute", diff --git a/doc/notification_samples/instance-rebuild-start.json b/doc/notification_samples/instance-rebuild-start.json index 23dc36132591..4ca41f3db445 100755 --- a/doc/notification_samples/instance-rebuild-start.json +++ b/doc/notification_samples/instance-rebuild-start.json @@ -5,13 +5,14 @@ "payload": { "nova_object.name": "InstanceActionPayload", "nova_object.namespace": "nova", - "nova_object.version": "1.1", + "nova_object.version":"1.2", "nova_object.data": { "display_description": "some-server", "reservation_id": "r-rqe0mlje", "progress": 0, "user_id": "fake", "task_state": "rebuilding", + "auto_disk_config":"MANUAL", "node": "fake-mini", "created_at": "2012-10-29T13:42:11Z", "kernel_id": "", @@ -71,4 +72,4 @@ "fault": null } } -} \ No newline at end of file +} diff --git a/doc/notification_samples/instance-resize-end.json b/doc/notification_samples/instance-resize-end.json index 3f515bf9a1d1..3a3deeba4521 100644 --- a/doc/notification_samples/instance-resize-end.json +++ b/doc/notification_samples/instance-resize-end.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-resize-start.json b/doc/notification_samples/instance-resize-start.json index 13a9c1fe8875..211145bd136e 100644 --- a/doc/notification_samples/instance-resize-start.json +++ b/doc/notification_samples/instance-resize-start.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-resize_finish-end.json b/doc/notification_samples/instance-resize_finish-end.json index a1de07edf8b8..9d4fc41f9014 100644 --- a/doc/notification_samples/instance-resize_finish-end.json +++ b/doc/notification_samples/instance-resize_finish-end.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-resize_finish-start.json b/doc/notification_samples/instance-resize_finish-start.json index ae951f1e4bc8..859f4f4f01a2 100644 --- a/doc/notification_samples/instance-resize_finish-start.json +++ b/doc/notification_samples/instance-resize_finish-start.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-restore-end.json b/doc/notification_samples/instance-restore-end.json index b37f59e40063..89d574a99b59 100644 --- a/doc/notification_samples/instance-restore-end.json +++ b/doc/notification_samples/instance-restore-end.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-restore-start.json b/doc/notification_samples/instance-restore-start.json index ed36345156da..6b2cc7b03b46 100644 --- a/doc/notification_samples/instance-restore-start.json +++ b/doc/notification_samples/instance-restore-start.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-resume-end.json b/doc/notification_samples/instance-resume-end.json index 28fe0ba87cbc..731578c1fcd4 100644 --- a/doc/notification_samples/instance-resume-end.json +++ b/doc/notification_samples/instance-resume-end.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-resume-start.json b/doc/notification_samples/instance-resume-start.json index 2fb61188d486..0df7ab050fa7 100644 --- a/doc/notification_samples/instance-resume-start.json +++ b/doc/notification_samples/instance-resume-start.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-shelve-end.json b/doc/notification_samples/instance-shelve-end.json index 0a9c8a5d9f9b..ac1008219791 100644 --- a/doc/notification_samples/instance-shelve-end.json +++ b/doc/notification_samples/instance-shelve-end.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-shelve-start.json b/doc/notification_samples/instance-shelve-start.json index 4f2179bd6d53..3eabe47437fe 100644 --- a/doc/notification_samples/instance-shelve-start.json +++ b/doc/notification_samples/instance-shelve-start.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-shelve_offload-end.json b/doc/notification_samples/instance-shelve_offload-end.json index ee7c5c8faf68..f618a9952491 100644 --- a/doc/notification_samples/instance-shelve_offload-end.json +++ b/doc/notification_samples/instance-shelve_offload-end.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-shelve_offload-start.json b/doc/notification_samples/instance-shelve_offload-start.json index c7b709b8f718..7fe572cef83a 100644 --- a/doc/notification_samples/instance-shelve_offload-start.json +++ b/doc/notification_samples/instance-shelve_offload-start.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-shutdown-end.json b/doc/notification_samples/instance-shutdown-end.json index 9a9e87aadb0d..cd03d9a56288 100644 --- a/doc/notification_samples/instance-shutdown-end.json +++ b/doc/notification_samples/instance-shutdown-end.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-shutdown-start.json b/doc/notification_samples/instance-shutdown-start.json index e71263b53d23..fa857fac01df 100644 --- a/doc/notification_samples/instance-shutdown-start.json +++ b/doc/notification_samples/instance-shutdown-start.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-snapshot-end.json b/doc/notification_samples/instance-snapshot-end.json index b48a9379bb90..9a0a48b5fe69 100644 --- a/doc/notification_samples/instance-snapshot-end.json +++ b/doc/notification_samples/instance-snapshot-end.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-snapshot-start.json b/doc/notification_samples/instance-snapshot-start.json index 8c2c416306c8..024d60334fab 100644 --- a/doc/notification_samples/instance-snapshot-start.json +++ b/doc/notification_samples/instance-snapshot-start.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-suspend-end.json b/doc/notification_samples/instance-suspend-end.json index b6c6e1eeac09..3b6432fbb25c 100644 --- a/doc/notification_samples/instance-suspend-end.json +++ b/doc/notification_samples/instance-suspend-end.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-suspend-start.json b/doc/notification_samples/instance-suspend-start.json index c6855b7c6cf1..07c85240cb77 100644 --- a/doc/notification_samples/instance-suspend-start.json +++ b/doc/notification_samples/instance-suspend-start.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-unpause-end.json b/doc/notification_samples/instance-unpause-end.json index e9f707c3d1b7..9ae72c920d1c 100644 --- a/doc/notification_samples/instance-unpause-end.json +++ b/doc/notification_samples/instance-unpause-end.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-unpause-start.json b/doc/notification_samples/instance-unpause-start.json index 94f4e6f3a129..0a99fb10e257 100644 --- a/doc/notification_samples/instance-unpause-start.json +++ b/doc/notification_samples/instance-unpause-start.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-unshelve-end.json b/doc/notification_samples/instance-unshelve-end.json index 88ffb588a59a..3569a015cc75 100644 --- a/doc/notification_samples/instance-unshelve-end.json +++ b/doc/notification_samples/instance-unshelve-end.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-unshelve-start.json b/doc/notification_samples/instance-unshelve-start.json index 4dfe58ef4e14..d879c79dc8e4 100644 --- a/doc/notification_samples/instance-unshelve-start.json +++ b/doc/notification_samples/instance-unshelve-start.json @@ -40,6 +40,7 @@ "power_state":"running", "tenant_id":"6f70656e737461636b20342065766572", "terminated_at":null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -67,7 +68,7 @@ }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", - "nova_object.version":"1.1" + "nova_object.version":"1.2" }, "priority":"INFO", "publisher_id":"nova-compute:compute" diff --git a/doc/notification_samples/instance-update.json b/doc/notification_samples/instance-update.json index 2a3ef6b80ce9..10b68406715f 100644 --- a/doc/notification_samples/instance-update.json +++ b/doc/notification_samples/instance-update.json @@ -45,6 +45,7 @@ "nova_object.version": "1.0"}, "tenant_id": "6f70656e737461636b20342065766572", "terminated_at": null, + "auto_disk_config":"MANUAL", "flavor": { "nova_object.name": "FlavorPayload", "nova_object.data": { @@ -72,7 +73,7 @@ "uuid": "c03c0bf9-f46e-4e4f-93f1-817568567ee2"}, "nova_object.name": "InstanceUpdatePayload", "nova_object.namespace": "nova", - "nova_object.version": "1.2"}, + "nova_object.version": "1.3"}, "priority": "INFO", "publisher_id": "nova-compute:fake-mini" } diff --git a/doc/notification_samples/instance-volume_swap-end.json b/doc/notification_samples/instance-volume_swap-end.json index ed645546d5a2..0ec52b7ae0e6 100644 --- a/doc/notification_samples/instance-volume_swap-end.json +++ b/doc/notification_samples/instance-volume_swap-end.json @@ -64,12 +64,13 @@ "task_state": null, "tenant_id": "6f70656e737461636b20342065766572", "terminated_at": null, + "auto_disk_config":"MANUAL", "user_id": "fake", "uuid": "0ab886d0-7443-4107-9265-48371bfa662b" }, "nova_object.name": "InstanceActionVolumeSwapPayload", "nova_object.namespace": "nova", - "nova_object.version": "1.1" + "nova_object.version": "1.2" }, "priority": "INFO", "publisher_id": "nova-compute:compute" diff --git a/doc/notification_samples/instance-volume_swap-error.json b/doc/notification_samples/instance-volume_swap-error.json index 6de10ad3e212..04dc7d5a0e07 100644 --- a/doc/notification_samples/instance-volume_swap-error.json +++ b/doc/notification_samples/instance-volume_swap-error.json @@ -74,12 +74,13 @@ "task_state": null, "tenant_id": "6f70656e737461636b20342065766572", "terminated_at": null, + "auto_disk_config":"MANUAL", "user_id": "fake", "uuid": "0ab886d0-7443-4107-9265-48371bfa662b" }, "nova_object.name": "InstanceActionVolumeSwapPayload", "nova_object.namespace": "nova", - "nova_object.version": "1.1" + "nova_object.version": "1.2" }, "priority": "ERROR", "publisher_id": "nova-compute:compute" diff --git a/doc/notification_samples/instance-volume_swap-start.json b/doc/notification_samples/instance-volume_swap-start.json index 1ac7efc411e1..222f087339da 100644 --- a/doc/notification_samples/instance-volume_swap-start.json +++ b/doc/notification_samples/instance-volume_swap-start.json @@ -64,12 +64,13 @@ "task_state": null, "tenant_id": "6f70656e737461636b20342065766572", "terminated_at": null, + "auto_disk_config":"MANUAL", "user_id": "fake", "uuid": "0ab886d0-7443-4107-9265-48371bfa662b" }, "nova_object.name": "InstanceActionVolumeSwapPayload", "nova_object.namespace": "nova", - "nova_object.version": "1.1" + "nova_object.version": "1.2" }, "priority": "INFO", "publisher_id": "nova-compute:compute" diff --git a/nova/notifications/objects/instance.py b/nova/notifications/objects/instance.py index 96461aa6c453..e0bd27795a52 100644 --- a/nova/notifications/objects/instance.py +++ b/nova/notifications/objects/instance.py @@ -49,10 +49,12 @@ class InstancePayload(base.NotificationPayloadBase): 'metadata': ('instance', 'metadata'), 'locked': ('instance', 'locked'), + 'auto_disk_config': ('instance', 'auto_disk_config') } # Version 1.0: Initial version # Version 1.1: add locked and display_description field - VERSION = '1.1' + # Version 1.2: Add auto_disk_config field + VERSION = '1.2' fields = { 'uuid': fields.UUIDField(), 'user_id': fields.StringField(nullable=True), @@ -87,6 +89,7 @@ class InstancePayload(base.NotificationPayloadBase): 'metadata': fields.DictOfStringsField(), 'locked': fields.BooleanField(), + 'auto_disk_config': fields.DiskConfigField() } def __init__(self, instance, **kwargs): @@ -113,7 +116,8 @@ class InstanceActionPayload(InstancePayload): # No SCHEMA as all the additional fields are calculated # Version 1.1: locked and display_description added to InstancePayload - VERSION = '1.1' + # Version 1.2: Added auto_disk_config field to InstancePayload + VERSION = '1.2' fields = { 'fault': fields.ObjectField('ExceptionPayload', nullable=True), } @@ -130,7 +134,8 @@ class InstanceActionVolumeSwapPayload(InstanceActionPayload): # No SCHEMA as all the additional fields are calculated # Version 1.1: locked and display_description added to InstancePayload - VERSION = '1.1' + # Version 1.2: Added auto_disk_config field to InstancePayload + VERSION = '1.2' fields = { 'old_volume_id': fields.UUIDField(), 'new_volume_id': fields.UUIDField(), @@ -149,7 +154,8 @@ class InstanceUpdatePayload(InstancePayload): # Version 1.0: Initial version # Version 1.1: locked and display_description added to InstancePayload # Version 1.2: Added tags field - VERSION = '1.2' + # Version 1.3: Added auto_disk_config field to InstancePayload + VERSION = '1.3' fields = { 'state_update': fields.ObjectField('InstanceStateUpdatePayload'), 'audit_period': fields.ObjectField('AuditPeriodPayload'), diff --git a/nova/objects/fields.py b/nova/objects/fields.py index 0c5d9f19569f..064681c446e9 100644 --- a/nova/objects/fields.py +++ b/nova/objects/fields.py @@ -333,6 +333,18 @@ class DiskBus(BaseNovaEnum): ALL = (FDC, IDE, SATA, SCSI, USB, VIRTIO, XEN, LXC, UML) +class DiskConfig(BaseNovaEnum): + + MANUAL = "MANUAL" + AUTO = "AUTO" + + ALL = (MANUAL, AUTO) + + def coerce(self, obj, attr, value): + enum_value = DiskConfig.AUTO if value else DiskConfig.MANUAL + return super(DiskConfig, self).coerce(obj, attr, enum_value) + + class FirmwareType(BaseNovaEnum): UEFI = "uefi" @@ -1074,6 +1086,10 @@ class DiskBusField(BaseEnumField): AUTO_TYPE = DiskBus() +class DiskConfigField(BaseEnumField): + AUTO_TYPE = DiskConfig() + + class FirmwareTypeField(BaseEnumField): AUTO_TYPE = FirmwareType() diff --git a/nova/tests/unit/compute/test_compute_utils.py b/nova/tests/unit/compute/test_compute_utils.py index f1216f1abe3b..2841cbe168b4 100644 --- a/nova/tests/unit/compute/test_compute_utils.py +++ b/nova/tests/unit/compute/test_compute_utils.py @@ -513,7 +513,8 @@ class UsageInfoTestCase(test.TestCase): self.assertEqual(str(flavor['flavorid']), flavorid) for attr in ('display_name', 'created_at', 'launched_at', - 'state', 'task_state', 'display_description', 'locked'): + 'state', 'task_state', 'display_description', 'locked', + 'auto_disk_config'): self.assertIn(attr, payload, "Key %s not in payload" % attr) self.assertEqual(payload['image_uuid'], uuids.fake_image_ref) diff --git a/nova/tests/unit/notifications/objects/test_notification.py b/nova/tests/unit/notifications/objects/test_notification.py index 45e2f8cf9b4a..96cca0f13caa 100644 --- a/nova/tests/unit/notifications/objects/test_notification.py +++ b/nova/tests/unit/notifications/objects/test_notification.py @@ -357,14 +357,14 @@ notification_object_data = { 'FlavorNotification': '1.0-a73147b93b520ff0061865849d3dfa56', 'FlavorPayload': '1.3-6335e626893d7df5f96f87e6731fef56', 'InstanceActionNotification': '1.0-a73147b93b520ff0061865849d3dfa56', - 'InstanceActionPayload': '1.1-8d12efc3251c606b61b3d479a9da51be', + 'InstanceActionPayload': '1.2-b7b2481bcd0e1edcc1970ef7150df5aa', 'InstanceActionVolumeSwapNotification': '1.0-a73147b93b520ff0061865849d3dfa56', - 'InstanceActionVolumeSwapPayload': '1.1-fbb6618f652a7f88742495ea3185582c', - 'InstancePayload': '1.1-5b9e3a4bb805d9fed20063bc237e4913', + 'InstanceActionVolumeSwapPayload': '1.2-d7925b763e0795f8e5c1aa0e95bd67bd', + 'InstancePayload': '1.2-a1988f6fe728bd4b478353a85c48ad55', 'InstanceStateUpdatePayload': '1.0-07e111c0fa0f6db0f79b0726d593e3da', 'InstanceUpdateNotification': '1.0-a73147b93b520ff0061865849d3dfa56', - 'InstanceUpdatePayload': '1.2-67174f00c1ed9b5a6c408a31bd2540a5', + 'InstanceUpdatePayload': '1.3-5bf5f18ed1232b1d8884fa784b77728f', 'IpPayload': '1.0-8ecf567a99e516d4af094439a7632d34', 'NotificationPublisher': '1.0-bbbc1402fb0e443a3eb227cc52b61545', 'ServiceStatusNotification': '1.0-a73147b93b520ff0061865849d3dfa56', @@ -447,6 +447,7 @@ class TestInstanceNotification(test.NoDBTestCase): metadata={}, uuid=uuids.instance1, locked=False, + auto_disk_config=False, **instance_values) self.payload = { 'bandwidth': {},