Add a new OSC command for Inject NMI
This patch add a new OSC command for Inject NMI, 'openstack baremetal node inject nmi'. Partial-Bug: #1526226 Change-Id: I669c0913450a412adf84c1b9581b43e4dd078bbd
This commit is contained in:
parent
906d3caf02
commit
c964a4c331
@ -1230,3 +1230,27 @@ class VifDetachBaremetalNode(command.Command):
|
||||
|
||||
baremetal_client = self.app.client_manager.baremetal
|
||||
baremetal_client.node.vif_detach(parsed_args.node, parsed_args.vif_id)
|
||||
|
||||
|
||||
class InjectNmiBaremetalNode(command.Command):
|
||||
"""Inject NMI to baremetal node"""
|
||||
|
||||
log = logging.getLogger(__name__ + ".InjectNmiBaremetalNode")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(InjectNmiBaremetalNode, self).get_parser(prog_name)
|
||||
|
||||
parser.add_argument(
|
||||
'node',
|
||||
metavar='<node>',
|
||||
help=_("Name or UUID of the node.")
|
||||
)
|
||||
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)", parsed_args)
|
||||
|
||||
baremetal_client = self.app.client_manager.baremetal
|
||||
|
||||
baremetal_client.node.inject_nmi(parsed_args.node)
|
||||
|
@ -1814,3 +1814,30 @@ class TestVifDetach(TestBaremetal):
|
||||
|
||||
self.baremetal_mock.node.vif_detach.assert_called_once_with(
|
||||
'node_uuid', 'aaa-aaa')
|
||||
|
||||
|
||||
class TestBaremetalInject(TestBaremetal):
|
||||
def setUp(self):
|
||||
super(TestBaremetalInject, self).setUp()
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = baremetal_node.InjectNmiBaremetalNode(self.app, None)
|
||||
|
||||
def test_baremetal_inject_no_options(self):
|
||||
arglist = []
|
||||
verifylist = []
|
||||
|
||||
self.assertRaises(oscutils.ParserException,
|
||||
self.check_parser,
|
||||
self.cmd, arglist, verifylist)
|
||||
|
||||
def test_baremetal_inject_nmi_uuid(self):
|
||||
arglist = ['node_uuid']
|
||||
verifylist = [('node', 'node_uuid')]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.baremetal_mock.node.inject_nmi.assert_called_once_with(
|
||||
'node_uuid')
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- Add a new OSC command for the injection of Non-Masking Interrupts
|
||||
(NMI), "openstack baremetal node inject nmi".
|
@ -72,6 +72,7 @@ openstack.baremetal.v1 =
|
||||
baremetal_node_vif_attach = ironicclient.osc.v1.baremetal_node:VifAttachBaremetalNode
|
||||
baremetal_node_vif_detach = ironicclient.osc.v1.baremetal_node:VifDetachBaremetalNode
|
||||
baremetal_node_vif_list = ironicclient.osc.v1.baremetal_node:VifListBaremetalNode
|
||||
baremetal_node_inject_nmi = ironicclient.osc.v1.baremetal_node:InjectNmiBaremetalNode
|
||||
baremetal_port_create = ironicclient.osc.v1.baremetal_port:CreateBaremetalPort
|
||||
baremetal_port_delete = ironicclient.osc.v1.baremetal_port:DeleteBaremetalPort
|
||||
baremetal_port_list = ironicclient.osc.v1.baremetal_port:ListBaremetalPort
|
||||
|
Loading…
Reference in New Issue
Block a user