Merge "Add a new command "ironic node-inject-nmi""

This commit is contained in:
Jenkins 2017-01-23 16:33:28 +00:00 committed by Gerrit Code Review
commit 8a1d09e898
5 changed files with 36 additions and 0 deletions

View File

@ -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 = [

View File

@ -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()

View File

@ -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)

View File

@ -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='<node>', 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='<node>', help="Name or UUID of the node.")
def do_node_get_supported_boot_devices(cc, args):
"""Get the supported boot devices for a node."""

View File

@ -0,0 +1,3 @@
---
features:
- Add a new command "ironic node-inject-nmi" to support inject nmi.