From 7394dbbacb1d6feeeb7b5faa58d1e6cab64ddd25 Mon Sep 17 00:00:00 2001 From: Shivanand Tendulker Date: Tue, 12 Sep 2017 01:54:59 -0400 Subject: [PATCH] Add rescue interface field to node-related notifications This patch adds rescue_interface field to node-related notification objects. Co-Authored-By: Jay Faulkner Co-Authored-By: Josh Gachnang Co-Authored-By: Jesse J. Cook Co-Authored-By: Mario Villaplana Co-Authored-By: Aparna Co-Authored-By: Shivanand Tendulker Change-Id: I8aa4c3c4701eae5f7838192bdbcf46a069370643 Partial-bug: #1526449 --- doc/source/admin/notifications.rst | 18 ++++++++++----- ironic/objects/node.py | 22 ++++++++++--------- ironic/tests/unit/objects/test_objects.py | 10 ++++----- ...ode-rescue-interface-a13511c7e76859c0.yaml | 14 ++++++++++++ 4 files changed, 43 insertions(+), 21 deletions(-) create mode 100644 releasenotes/notes/notify-node-rescue-interface-a13511c7e76859c0.yaml diff --git a/doc/source/admin/notifications.rst b/doc/source/admin/notifications.rst index 8e2d81dcda..849c149b33 100644 --- a/doc/source/admin/notifications.rst +++ b/doc/source/admin/notifications.rst @@ -132,7 +132,7 @@ Example of node CRUD notification:: "payload":{ "ironic_object.namespace":"ironic", "ironic_object.name":"NodeCRUDPayload", - "ironic_object.version":"1.2", + "ironic_object.version":"1.3", "ironic_object.data":{ "chassis_uuid": "db0eef9d-45b2-4dc0-94a8-fc283c01171f", "clean_step": None, @@ -158,6 +158,7 @@ Example of node CRUD notification:: "network_interface": "flat", "power_interface": "ipmitool", "raid_interface": "no-raid", + "rescue_interface": "no-rescue", "storage_interface": "noop", "vendor_interface": "no-vendor", "name": None, @@ -354,7 +355,7 @@ node maintenance notification:: "payload":{ "ironic_object.namespace":"ironic", "ironic_object.name":"NodePayload", - "ironic_object.version":"1.4", + "ironic_object.version":"1.5", "ironic_object.data":{ "clean_step": None, "console_enabled": False, @@ -376,6 +377,7 @@ node maintenance notification:: "network_interface": "flat", "power_interface": "ipmitool", "raid_interface": "no-raid", + "rescue_interface": "no-rescue", "storage_interface": "noop", "vendor_interface": "no-vendor", "name": None, @@ -430,7 +432,7 @@ notification:: "payload":{ "ironic_object.namespace":"ironic", "ironic_object.name":"NodePayload", - "ironic_object.version":"1.4", + "ironic_object.version":"1.5", "ironic_object.data":{ "clean_step": None, "console_enabled": True, @@ -452,6 +454,7 @@ notification:: "network_interface": "flat", "power_interface": "ipmitool", "raid_interface": "no-raid", + "rescue_interface": "no-rescue", "storage_interface": "noop", "vendor_interface": "no-vendor", "name": None, @@ -499,7 +502,7 @@ ironic-conductor is attempting to change the node:: "payload":{ "ironic_object.namespace":"ironic", "ironic_object.name":"NodeSetPowerStatePayload", - "ironic_object.version":"1.4", + "ironic_object.version":"1.5", "ironic_object.data":{ "clean_step": None, "console_enabled": False, @@ -520,6 +523,7 @@ ironic-conductor is attempting to change the node:: "network_interface": "flat", "power_interface": "ipmitool", "raid_interface": "no-raid", + "rescue_interface": "no-rescue", "storage_interface": "noop", "vendor_interface": "no-vendor", "name": None, @@ -562,7 +566,7 @@ prior to the correction:: "payload":{ "ironic_object.namespace":"ironic", "ironic_object.name":"NodeCorrectedPowerStatePayload", - "ironic_object.version":"1.4", + "ironic_object.version":"1.5", "ironic_object.data":{ "clean_step": None, "console_enabled": False, @@ -583,6 +587,7 @@ prior to the correction:: "network_interface": "flat", "power_interface": "ipmitool", "raid_interface": "no-raid", + "rescue_interface": "no-rescue", "storage_interface": "noop", "vendor_interface": "no-vendor", "name": None, @@ -636,7 +641,7 @@ indicate a node's provision states before state change, "event" is the FSM "payload":{ "ironic_object.namespace":"ironic", "ironic_object.name":"NodeSetProvisionStatePayload", - "ironic_object.version":"1.4", + "ironic_object.version":"1.5", "ironic_object.data":{ "clean_step": None, "console_enabled": False, @@ -658,6 +663,7 @@ indicate a node's provision states before state change, "event" is the FSM "network_interface": "flat", "power_interface": "ipmitool", "raid_interface": "no-raid", + "rescue_interface": "no-rescue", "storage_interface": "noop", "vendor_interface": "no-vendor", "name": None, diff --git a/ironic/objects/node.py b/ironic/objects/node.py index 20c6b5fa2b..2fdc4d1e98 100644 --- a/ironic/objects/node.py +++ b/ironic/objects/node.py @@ -534,6 +534,7 @@ class NodePayload(notification.NotificationPayloadBase): 'network_interface': ('node', 'network_interface'), 'power_interface': ('node', 'power_interface'), 'raid_interface': ('node', 'raid_interface'), + 'rescue_interface': ('node', 'rescue_interface'), 'storage_interface': ('node', 'storage_interface'), 'vendor_interface': ('node', 'vendor_interface'), 'power_state': ('node', 'power_state'), @@ -547,11 +548,6 @@ class NodePayload(notification.NotificationPayloadBase): 'uuid': ('node', 'uuid') } - # TODO(stendulker): At a later point in time, once rescue_interface - # is able to be leveraged, we need to add the rescue_interface - # field to payload and increment the object versions for all objects - # that inherit the NodePayload object. - # TODO(mgoddard): Add a traits field to the NodePayload object. # Version 1.0: Initial version, based off of Node version 1.18. @@ -560,7 +556,8 @@ class NodePayload(notification.NotificationPayloadBase): # Version 1.2: Add nullable to console_enabled and maintenance. # Version 1.3: Add dynamic interfaces fields exposed via API. # Version 1.4: Add storage interface field exposed via API. - VERSION = '1.4' + # Version 1.5: Add rescue interface field exposed via API. + VERSION = '1.5' fields = { 'clean_step': object_fields.FlexibleDictField(nullable=True), 'console_enabled': object_fields.BooleanField(nullable=True), @@ -581,6 +578,7 @@ class NodePayload(notification.NotificationPayloadBase): 'network_interface': object_fields.StringField(nullable=True), 'power_interface': object_fields.StringField(nullable=True), 'raid_interface': object_fields.StringField(nullable=True), + 'rescue_interface': object_fields.StringField(nullable=True), 'storage_interface': object_fields.StringField(nullable=True), 'vendor_interface': object_fields.StringField(nullable=True), 'name': object_fields.StringField(nullable=True), @@ -619,7 +617,8 @@ class NodeSetPowerStatePayload(NodePayload): # Version 1.2: Parent NodePayload version 1.2 # Version 1.3: Parent NodePayload version 1.3 # Version 1.4: Parent NodePayload version 1.4 - VERSION = '1.4' + # Version 1.5: Parent NodePayload version 1.5 + VERSION = '1.5' fields = { # "to_power" indicates the future target_power_state of the node. A @@ -664,7 +663,8 @@ class NodeCorrectedPowerStatePayload(NodePayload): # Version 1.2: Parent NodePayload version 1.2 # Version 1.3: Parent NodePayload version 1.3 # Version 1.4: Parent NodePayload version 1.4 - VERSION = '1.4' + # Version 1.5: Parent NodePayload version 1.5 + VERSION = '1.5' fields = { 'from_power': object_fields.StringField(nullable=True) @@ -694,7 +694,8 @@ class NodeSetProvisionStatePayload(NodePayload): # Version 1.2: Parent NodePayload version 1.2 # Version 1.3: Parent NodePayload version 1.3 # Version 1.4: Parent NodePayload version 1.4 - VERSION = '1.4' + # Version 1.5: Parent NodePayload version 1.5 + VERSION = '1.5' SCHEMA = dict(NodePayload.SCHEMA, **{'instance_info': ('node', 'instance_info')}) @@ -730,7 +731,8 @@ class NodeCRUDPayload(NodePayload): # Version 1.0: Initial version # Version 1.1: Parent NodePayload version 1.3 # Version 1.2: Parent NodePayload version 1.4 - VERSION = '1.2' + # Version 1.3: Parent NodePayload version 1.5 + VERSION = '1.3' SCHEMA = dict(NodePayload.SCHEMA, **{'instance_info': ('node', 'instance_info'), diff --git a/ironic/tests/unit/objects/test_objects.py b/ironic/tests/unit/objects/test_objects.py index f6d975bc17..53cfcda32a 100644 --- a/ironic/tests/unit/objects/test_objects.py +++ b/ironic/tests/unit/objects/test_objects.py @@ -692,21 +692,21 @@ expected_object_fingerprints = { 'Conductor': '1.2-5091f249719d4a465062a1b3dc7f860d', 'EventType': '1.1-aa2ba1afd38553e3880c267404e8d370', 'NotificationPublisher': '1.0-51a09397d6c0687771fb5be9a999605d', - 'NodePayload': '1.4-1ab0efe090ee3b2bd48d280a5acec1d4', + 'NodePayload': '1.5-a08d9f8a74b1f827ade12efd853cebc4', 'NodeSetPowerStateNotification': '1.0-59acc533c11d306f149846f922739c15', - 'NodeSetPowerStatePayload': '1.4-9ab5116c2c59dfb9e56dcc7ef660a431', + 'NodeSetPowerStatePayload': '1.5-5292dea58d84e1bec9345b2e1a10114b', 'NodeCorrectedPowerStateNotification': '1.0-59acc533c11d306f149846f922739c15', - 'NodeCorrectedPowerStatePayload': '1.4-d624154b8fb4e6cdda1554a8bf3f4cf5', + 'NodeCorrectedPowerStatePayload': '1.5-d22164f7f8f36dedee7d685525acb844', 'NodeSetProvisionStateNotification': '1.0-59acc533c11d306f149846f922739c15', - 'NodeSetProvisionStatePayload': '1.4-605c17b779aeedf0925937b2785d9f43', + 'NodeSetProvisionStatePayload': '1.5-65f972bc0cd0096632c8d7749c3dca96', 'VolumeConnector': '1.0-3e0252c0ab6e6b9d158d09238a577d97', 'VolumeTarget': '1.0-0b10d663d8dae675900b2c7548f76f5e', 'ChassisCRUDNotification': '1.0-59acc533c11d306f149846f922739c15', 'ChassisCRUDPayload': '1.0-dce63895d8186279a7dd577cffccb202', 'NodeCRUDNotification': '1.0-59acc533c11d306f149846f922739c15', - 'NodeCRUDPayload': '1.2-b7a265a5e2fe47adada3c7c20c68e465', + 'NodeCRUDPayload': '1.3-3026beced6c8857dc0574e8e0762415b', 'PortCRUDNotification': '1.0-59acc533c11d306f149846f922739c15', 'PortCRUDPayload': '1.2-233d259df442eb15cc584fae1fe81504', 'NodeMaintenanceNotification': '1.0-59acc533c11d306f149846f922739c15', diff --git a/releasenotes/notes/notify-node-rescue-interface-a13511c7e76859c0.yaml b/releasenotes/notes/notify-node-rescue-interface-a13511c7e76859c0.yaml new file mode 100644 index 0000000000..ab63f2e283 --- /dev/null +++ b/releasenotes/notes/notify-node-rescue-interface-a13511c7e76859c0.yaml @@ -0,0 +1,14 @@ +--- +features: + - | + Adds rescue interface field to node-related notifications. + Affected notifications are: + + * baremetal.node.create.*, new payload version 1.3 + * baremetal.node.update.*, new payload version 1.3 + * baremetal.node.delete.*, new payload version 1.3 + * baremetal.node.maintenance.*, new payload version 1.5 + * baremetal.node.console.*, new payload version 1.5 + * baremetal.node.power_set.*, new payload version 1.5 + * baremetal.node.power_state_corrected.*, new payload version 1.5 + * baremetal.node.provision_set.*, new payload version 1.5