Merge "Add port-uuid parameter to node vif attach"
This commit is contained in:
commit
3d995ac172
@ -37,7 +37,7 @@ from ironicclient import exc
|
||||
# http://specs.openstack.org/openstack/ironic-specs/specs/kilo/api-microversions.html # noqa
|
||||
# for full details.
|
||||
DEFAULT_VER = '1.9'
|
||||
LAST_KNOWN_API_VERSION = 66
|
||||
LAST_KNOWN_API_VERSION = 67
|
||||
LATEST_VERSION = '1.{}'.format(LAST_KNOWN_API_VERSION)
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -1728,6 +1728,11 @@ class VifAttachBaremetalNode(command.Command):
|
||||
metavar='<vif-id>',
|
||||
help=_("Name or UUID of the VIF to attach to a node.")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--port-uuid',
|
||||
metavar='<port-uuid>',
|
||||
help=_("UUID of the baremetal port to attach the VIF to.")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--vif-info',
|
||||
metavar='<key=value>',
|
||||
@ -1743,6 +1748,8 @@ class VifAttachBaremetalNode(command.Command):
|
||||
baremetal_client = self.app.client_manager.baremetal
|
||||
|
||||
fields = utils.key_value_pairs_to_dict(parsed_args.vif_info or [])
|
||||
if parsed_args.port_uuid:
|
||||
fields['port_uuid'] = parsed_args.port_uuid
|
||||
baremetal_client.node.vif_attach(parsed_args.node, parsed_args.vif_id,
|
||||
**fields)
|
||||
|
||||
|
@ -3551,6 +3551,18 @@ class TestVifAttach(TestBaremetal):
|
||||
self.baremetal_mock.node.vif_attach.assert_called_once_with(
|
||||
'node_uuid', 'aaa-aaa', foo='bar')
|
||||
|
||||
def test_baremetal_vif_attach_port_uuid(self):
|
||||
arglist = ['node_uuid', 'aaa-aaa', '--port-uuid', 'fake-port-uuid']
|
||||
verifylist = [('node', 'node_uuid'),
|
||||
('vif_id', 'aaa-aaa'),
|
||||
('port_uuid', 'fake-port-uuid')]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.baremetal_mock.node.vif_attach.assert_called_once_with(
|
||||
'node_uuid', 'aaa-aaa', port_uuid='fake-port-uuid')
|
||||
|
||||
|
||||
class TestVifDetach(TestBaremetal):
|
||||
def setUp(self):
|
||||
|
6
releasenotes/notes/vif-attach-port-29a421b245e19f2b.yaml
Normal file
6
releasenotes/notes/vif-attach-port-29a421b245e19f2b.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Updates the node vif attach API action to accept an optional ``port_uuid``
|
||||
parameter. If specified, then Ironic will attempt to attach to the
|
||||
specified port.
|
Loading…
Reference in New Issue
Block a user