diff --git a/doc/notification_samples/common_payloads/InstanceCreatePayload.json b/doc/notification_samples/common_payloads/InstanceCreatePayload.json index 3586c9166eda..f7c59362bde3 100644 --- a/doc/notification_samples/common_payloads/InstanceCreatePayload.json +++ b/doc/notification_samples/common_payloads/InstanceCreatePayload.json @@ -20,8 +20,9 @@ "trusted_image_certificates": [ "cert-id-1", "cert-id-2" - ] + ], + "instance_name": "instance-00000001" }, "nova_object.name":"InstanceCreatePayload", - "nova_object.version": "1.10" + "nova_object.version": "1.11" } diff --git a/nova/notifications/objects/instance.py b/nova/notifications/objects/instance.py index 77d22ff0e2b0..9488473c68cc 100644 --- a/nova/notifications/objects/instance.py +++ b/nova/notifications/objects/instance.py @@ -228,13 +228,14 @@ class InstanceCreatePayload(InstanceActionPayload): # InstanceCreatePayload # 1.10: Added action_initiator_user and action_initiator_project to # InstancePayload - VERSION = '1.10' - + # 1.11: Added instance_name to InstanceCreatePayload + VERSION = '1.11' fields = { 'keypairs': fields.ListOfObjectsField('KeypairPayload'), 'tags': fields.ListOfStringsField(), 'trusted_image_certificates': fields.ListOfStringsField( - nullable=True) + nullable=True), + 'instance_name': fields.StringField(nullable=True), } def __init__(self, context, instance, fault, bdms): @@ -250,6 +251,7 @@ class InstanceCreatePayload(InstanceActionPayload): self.trusted_image_certificates = None if instance.trusted_certs: self.trusted_image_certificates = instance.trusted_certs.ids + self.instance_name = instance.name @nova_base.NovaObjectRegistry.register_notification diff --git a/nova/tests/unit/notifications/objects/test_notification.py b/nova/tests/unit/notifications/objects/test_notification.py index 221699802f1d..f76fbb3b73ec 100644 --- a/nova/tests/unit/notifications/objects/test_notification.py +++ b/nova/tests/unit/notifications/objects/test_notification.py @@ -397,7 +397,7 @@ notification_object_data = { '1.0-a73147b93b520ff0061865849d3dfa56', 'InstanceActionVolumeSwapPayload': '1.7-d3252403a9437bcdc80f1075214f8b45', 'InstanceCreateNotification': '1.0-a73147b93b520ff0061865849d3dfa56', - 'InstanceCreatePayload': '1.10-291b44932569b8ff864d911814293cfc', + 'InstanceCreatePayload': '1.11-7513127966bc8f270946634d099e71c0', 'InstancePayload': '1.7-78354572f699b9a6ad9996b199d03375', 'InstanceActionSnapshotNotification': '1.0-a73147b93b520ff0061865849d3dfa56', diff --git a/releasenotes/notes/add-instance-name-to-instance-create-notification-4c2f5eca9e574178.yaml b/releasenotes/notes/add-instance-name-to-instance-create-notification-4c2f5eca9e574178.yaml new file mode 100644 index 000000000000..6fbd9abcae73 --- /dev/null +++ b/releasenotes/notes/add-instance-name-to-instance-create-notification-4c2f5eca9e574178.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + The field ``instance_name`` has been added to the + ``InstanceCreatePayload`` in the following versioned notifications: + + * ``instance.create.start`` + * ``instance.create.end`` + * ``instance.create.error``