diff --git a/ironicclient/tests/unit/v1/test_node.py b/ironicclient/tests/unit/v1/test_node.py index 936445a42..7b8184d36 100644 --- a/ironicclient/tests/unit/v1/test_node.py +++ b/ironicclient/tests/unit/v1/test_node.py @@ -365,6 +365,13 @@ fake_responses = { None, ), }, + '/v1/nodes/%s/management/inject_nmi' % NODE1['uuid']: + { + 'PUT': ( + {}, + None, + ), + }, '/v1/nodes/%s/management/boot_device/supported' % NODE1['uuid']: { 'GET': ( @@ -1210,6 +1217,14 @@ class NodeManagerTest(testtools.TestCase): self.assertEqual(expect, self.api.calls) self.assertEqual(BOOT_DEVICE, boot_device) + def test_node_inject_nmi(self): + self.mgr.inject_nmi(NODE1['uuid']) + expect = [ + ('PUT', '/v1/nodes/%s/management/inject_nmi' % NODE1['uuid'], + {}, None), + ] + self.assertEqual(expect, self.api.calls) + def test_node_get_supported_boot_devices(self): boot_device = self.mgr.get_supported_boot_devices(NODE1['uuid']) expect = [ diff --git a/ironicclient/tests/unit/v1/test_node_shell.py b/ironicclient/tests/unit/v1/test_node_shell.py index 8cd572c17..bb9d5aa2d 100644 --- a/ironicclient/tests/unit/v1/test_node_shell.py +++ b/ironicclient/tests/unit/v1/test_node_shell.py @@ -837,6 +837,14 @@ class NodeShellTest(utils.BaseTestCase): n_shell.do_node_get_boot_device(client_mock, args) client_mock.node.get_boot_device.assert_called_once_with('node_uuid') + def test_do_node_inject_nmi(self): + client_mock = mock.MagicMock() + args = mock.MagicMock() + args.node = 'node_uuid' + + n_shell.do_node_inject_nmi(client_mock, args) + client_mock.node.inject_nmi.assert_called_once_with('node_uuid') + def test_do_node_get_supported_boot_devices(self): client_mock = mock.MagicMock() args = mock.MagicMock() diff --git a/ironicclient/v1/node.py b/ironicclient/v1/node.py index ac806f3f4..5cf283d3f 100644 --- a/ironicclient/v1/node.py +++ b/ironicclient/v1/node.py @@ -423,6 +423,10 @@ class NodeManager(base.CreateManager): path = "%s/management/boot_device" % node_uuid return self._get_as_dict(path) + def inject_nmi(self, node_uuid): + path = "%s/management/inject_nmi" % node_uuid + return self.update(path, None, http_method='PUT') + def get_supported_boot_devices(self, node_uuid): path = "%s/management/boot_device/supported" % node_uuid return self._get_as_dict(path) diff --git a/ironicclient/v1/node_shell.py b/ironicclient/v1/node_shell.py index 6b22b3c89..fd8a04e9b 100644 --- a/ironicclient/v1/node_shell.py +++ b/ironicclient/v1/node_shell.py @@ -586,6 +586,12 @@ def do_node_get_boot_device(cc, args): cliutils.print_dict(boot_device, wrap=72, json_flag=args.json) +@cliutils.arg('node', metavar='', help="Name or UUID of the node.") +def do_node_inject_nmi(cc, args): + """Inject NMI for a node.""" + cc.node.inject_nmi(args.node) + + @cliutils.arg('node', metavar='', help="Name or UUID of the node.") def do_node_get_supported_boot_devices(cc, args): """Get the supported boot devices for a node.""" diff --git a/releasenotes/notes/instance-crash-dump-d845a31e72b5a9f7.yaml b/releasenotes/notes/instance-crash-dump-d845a31e72b5a9f7.yaml new file mode 100644 index 000000000..3e499b8f3 --- /dev/null +++ b/releasenotes/notes/instance-crash-dump-d845a31e72b5a9f7.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add a new command "ironic node-inject-nmi" to support inject nmi.