Merge "Adds --chassis-uuid to osc 'baremetal node set'"
This commit is contained in:
commit
fc9192b280
@ -785,6 +785,11 @@ class SetBaremetalNode(command.Command):
|
|||||||
metavar="<name>",
|
metavar="<name>",
|
||||||
help="Set the name of the node",
|
help="Set the name of the node",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--chassis-uuid",
|
||||||
|
metavar="<chassis UUID>",
|
||||||
|
help="Set the chassis for the node",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--driver",
|
"--driver",
|
||||||
metavar="<driver>",
|
metavar="<driver>",
|
||||||
@ -864,6 +869,10 @@ class SetBaremetalNode(command.Command):
|
|||||||
name = ["name=%s" % parsed_args.name]
|
name = ["name=%s" % parsed_args.name]
|
||||||
properties.extend(utils.args_array_to_patch(
|
properties.extend(utils.args_array_to_patch(
|
||||||
'add', name))
|
'add', name))
|
||||||
|
if parsed_args.chassis_uuid:
|
||||||
|
chassis_uuid = ["chassis_uuid=%s" % parsed_args.chassis_uuid]
|
||||||
|
properties.extend(utils.args_array_to_patch(
|
||||||
|
'add', chassis_uuid))
|
||||||
if parsed_args.driver:
|
if parsed_args.driver:
|
||||||
driver = ["driver=%s" % parsed_args.driver]
|
driver = ["driver=%s" % parsed_args.driver]
|
||||||
properties.extend(utils.args_array_to_patch(
|
properties.extend(utils.args_array_to_patch(
|
||||||
|
@ -1085,6 +1085,26 @@ class TestBaremetalSet(TestBaremetal):
|
|||||||
[{'path': '/name', 'value': 'xxxxx', 'op': 'add'}]
|
[{'path': '/name', 'value': 'xxxxx', 'op': 'add'}]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_baremetal_set_chassis(self):
|
||||||
|
chassis = '4f4135ea-7e58-4e3d-bcc4-b87ca16e980b'
|
||||||
|
arglist = [
|
||||||
|
'node_uuid',
|
||||||
|
'--chassis-uuid', chassis,
|
||||||
|
]
|
||||||
|
verifylist = [
|
||||||
|
('node', 'node_uuid'),
|
||||||
|
('chassis_uuid', chassis)
|
||||||
|
]
|
||||||
|
|
||||||
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
|
self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
|
self.baremetal_mock.node.update.assert_called_once_with(
|
||||||
|
'node_uuid',
|
||||||
|
[{'path': '/chassis_uuid', 'value': chassis, 'op': 'add'}]
|
||||||
|
)
|
||||||
|
|
||||||
def test_baremetal_set_driver(self):
|
def test_baremetal_set_driver(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
'node_uuid',
|
'node_uuid',
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- The chassis of a node can be set via the new --chassis-uuid
|
||||||
|
optional argument for ``openstack baremetal node set``.
|
Loading…
x
Reference in New Issue
Block a user