From 0c29837c3a1927d36ffda492c71caf9d1d6138ff Mon Sep 17 00:00:00 2001 From: Kaifeng Wang Date: Mon, 2 Apr 2018 11:12:09 +0800 Subject: [PATCH] Power fault recovery: Notification objects This patch exposes fault field for related notification objects. Story: #1596107 Task: #10469 Change-Id: Iee50985846fbe8e529613d69645c283d4fe1e380 Partial-Bug: #1596107 --- ironic/objects/node.py | 17 ++++++++++++----- ironic/tests/unit/objects/test_objects.py | 10 +++++----- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/ironic/objects/node.py b/ironic/objects/node.py index 255d0e7d5b..4c942be248 100644 --- a/ironic/objects/node.py +++ b/ironic/objects/node.py @@ -572,6 +572,7 @@ class NodePayload(notification.NotificationPayloadBase): 'last_error': ('node', 'last_error'), 'maintenance': ('node', 'maintenance'), 'maintenance_reason': ('node', 'maintenance_reason'), + 'fault': ('node', 'fault'), 'name': ('node', 'name'), 'boot_interface': ('node', 'boot_interface'), 'console_interface': ('node', 'console_interface'), @@ -608,7 +609,8 @@ class NodePayload(notification.NotificationPayloadBase): # Version 1.4: Add storage interface field exposed via API. # Version 1.5: Add rescue interface field exposed via API. # Version 1.6: Add traits field exposed via API. - VERSION = '1.6' + # Version 1.7: Add fault field exposed via API. + VERSION = '1.7' fields = { 'clean_step': object_fields.FlexibleDictField(nullable=True), 'console_enabled': object_fields.BooleanField(nullable=True), @@ -621,6 +623,7 @@ class NodePayload(notification.NotificationPayloadBase): 'last_error': object_fields.StringField(nullable=True), 'maintenance': object_fields.BooleanField(nullable=True), 'maintenance_reason': object_fields.StringField(nullable=True), + 'fault': object_fields.StringField(nullable=True), 'boot_interface': object_fields.StringField(nullable=True), 'console_interface': object_fields.StringField(nullable=True), 'deploy_interface': object_fields.StringField(nullable=True), @@ -677,7 +680,8 @@ class NodeSetPowerStatePayload(NodePayload): # Version 1.4: Parent NodePayload version 1.4 # Version 1.5: Parent NodePayload version 1.5 # Version 1.6: Parent NodePayload version 1.6 - VERSION = '1.6' + # Version 1.7: Parent NodePayload version 1.7 + VERSION = '1.7' fields = { # "to_power" indicates the future target_power_state of the node. A @@ -724,7 +728,8 @@ class NodeCorrectedPowerStatePayload(NodePayload): # Version 1.4: Parent NodePayload version 1.4 # Version 1.5: Parent NodePayload version 1.5 # Version 1.6: Parent NodePayload version 1.6 - VERSION = '1.6' + # Version 1.7: Parent NodePayload version 1.7 + VERSION = '1.7' fields = { 'from_power': object_fields.StringField(nullable=True) @@ -755,7 +760,8 @@ class NodeSetProvisionStatePayload(NodePayload): # Version 1.3: Parent NodePayload version 1.3 # Version 1.4: Parent NodePayload version 1.4 # Version 1.6: Parent NodePayload version 1.6 - VERSION = '1.6' + # Version 1.7: Parent NodePayload version 1.7 + VERSION = '1.7' SCHEMA = dict(NodePayload.SCHEMA, **{'instance_info': ('node', 'instance_info')}) @@ -793,7 +799,8 @@ class NodeCRUDPayload(NodePayload): # Version 1.2: Parent NodePayload version 1.4 # Version 1.3: Parent NodePayload version 1.5 # Version 1.4: Parent NodePayload version 1.6 - VERSION = '1.4' + # Version 1.5: Parent NodePayload version 1.7 + VERSION = '1.5' 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 4c4e5b2a56..ca6ab14644 100644 --- a/ironic/tests/unit/objects/test_objects.py +++ b/ironic/tests/unit/objects/test_objects.py @@ -672,21 +672,21 @@ expected_object_fingerprints = { 'Conductor': '1.2-5091f249719d4a465062a1b3dc7f860d', 'EventType': '1.1-aa2ba1afd38553e3880c267404e8d370', 'NotificationPublisher': '1.0-51a09397d6c0687771fb5be9a999605d', - 'NodePayload': '1.6-33b165d11b05f8e1a91da5b1bd344dda', + 'NodePayload': '1.7-92b1f4f4a51da73a7c0e3315c0323a92', 'NodeSetPowerStateNotification': '1.0-59acc533c11d306f149846f922739c15', - 'NodeSetPowerStatePayload': '1.6-b32af2903cba9a61be83f5b119188e4d', + 'NodeSetPowerStatePayload': '1.7-bc9a66836bb4148430195f06de0f793a', 'NodeCorrectedPowerStateNotification': '1.0-59acc533c11d306f149846f922739c15', - 'NodeCorrectedPowerStatePayload': '1.6-e44d9d913afba61281190082605dd1fb', + 'NodeCorrectedPowerStatePayload': '1.7-64862912ca81c0f8de5500503d41213d', 'NodeSetProvisionStateNotification': '1.0-59acc533c11d306f149846f922739c15', - 'NodeSetProvisionStatePayload': '1.6-5e608497664b122ae53240f35072d731', + 'NodeSetProvisionStatePayload': '1.7-9623c21aef3bff2f85de925396a2318b', 'VolumeConnector': '1.0-3e0252c0ab6e6b9d158d09238a577d97', 'VolumeTarget': '1.0-0b10d663d8dae675900b2c7548f76f5e', 'ChassisCRUDNotification': '1.0-59acc533c11d306f149846f922739c15', 'ChassisCRUDPayload': '1.0-dce63895d8186279a7dd577cffccb202', 'NodeCRUDNotification': '1.0-59acc533c11d306f149846f922739c15', - 'NodeCRUDPayload': '1.4-e55b77489d3ff71d561d0ae03668e298', + 'NodeCRUDPayload': '1.5-40579bb4bb159b6cc4f3d9fdd24ef919', 'PortCRUDNotification': '1.0-59acc533c11d306f149846f922739c15', 'PortCRUDPayload': '1.2-233d259df442eb15cc584fae1fe81504', 'NodeMaintenanceNotification': '1.0-59acc533c11d306f149846f922739c15',