diff options
Diffstat (limited to 'ironicclient/v1')
-rw-r--r-- | ironicclient/v1/node.py | 53 | ||||
-rw-r--r-- | ironicclient/v1/resource_fields.py | 22 |
2 files changed, 75 insertions, 0 deletions
diff --git a/ironicclient/v1/node.py b/ironicclient/v1/node.py index d438d0e..84def25 100644 --- a/ironicclient/v1/node.py +++ b/ironicclient/v1/node.py @@ -1008,3 +1008,56 @@ class NodeManager(base.CreateManager): '%(state)s, the current state is %(actual)s', {'node': node_ident, 'state': expected_state, 'actual': node.provision_state}) + + def get_history_list(self, + node_ident, + detail=False, + os_ironic_api_version=None, + global_request_id=None): + """Get node history event list. + + Provides the ability to query a node event history list from + the API and return the API response to the caller. + + Requires API version 1.78. + + :param node_ident: The name or UUID of the node. + :param detail: If detailed data should be returned in the + event list entry. Default False. + :param os_ironic_api_version: String version (e.g. "1.35") to use for + the request. If not specified, the client's default is used. + :param global_request_id: String containing global request ID header + value (in form "req-<UUID>") to use for the request. + """ + path = "%s/history" % node_ident + + if detail: + path = path + '/detail' + + return self._list_primitives( + self._path(path), 'history', + os_ironic_api_version=os_ironic_api_version, + global_request_id=global_request_id) + + def get_history_event(self, + node_ident, + event, + os_ironic_api_version=None, + global_request_id=None): + """Get a single event record for a node. + + Provides the ability to request, and return + a node's single vent hisotyr entry. + + :param node_ident: The name or UUID of the node. + :param event: The UUID of the event entry as listed + in the node event history list. + :param os_ironic_api_version: String version (e.g. "1.35") to use for + the request. If not specified, the client's default is used. + :param global_request_id: String containing global request ID header + value (in form "req-<UUID>") to use for the request. + """ + path = "%s/history/%s" % (node_ident, event) + return self._get_as_dict( + path, os_ironic_api_version=os_ironic_api_version, + global_request_id=global_request_id) diff --git a/ironicclient/v1/resource_fields.py b/ironicclient/v1/resource_fields.py index 76cfaca..1c9aebe 100644 --- a/ironicclient/v1/resource_fields.py +++ b/ironicclient/v1/resource_fields.py @@ -79,6 +79,8 @@ class Resource(object): 'enabled_storage_interfaces': 'Enabled Storage Interfaces', 'enabled_vendor_interfaces': 'Enabled Vendor Interfaces', 'extra': 'Extra', + 'event': 'Description of the event', + 'event_type': 'Event Origin Type', 'hostname': 'Hostname', 'hosts': 'Active host(s)', 'http_methods': 'Supported HTTP methods', @@ -140,8 +142,10 @@ class Resource(object): 'raid_interface': 'RAID Interface', 'rescue_interface': 'Rescue Interface', 'storage_interface': 'Storage Interface', + 'severity': 'Severity', 'unique': 'Unique', 'upper_bound': 'Upper Bound', + 'user': 'User', 'vendor_interface': 'Vendor Interface', 'standalone_ports_supported': 'Standalone Ports Supported', 'physical_network': 'Physical Network', @@ -570,3 +574,21 @@ DEPLOY_TEMPLATE_RESOURCE = Resource( 'name', ], ) + + +NODE_HISTORY_RESOURCE = Resource( + ['uuid', + 'created_at', + 'severity', + 'event'] +) + +NODE_HISTORY_DETAILED_RESOURCE = Resource( + ['uuid', + 'created_at', + 'severity', + 'event_type', + 'event', + 'conductor', + 'user'] +) |