Add SR-IOV support for members

This patch adds the "vnic_type" field to member outputs and adds a new
option "--request-sriov" for member create commands.

Change-Id: Ie157247609dc761f9a7645a4297b80a8a3c1f559
This commit is contained in:
Michael Johnson 2024-03-29 22:41:47 +00:00
parent b9d8f34e60
commit 58c32db454
4 changed files with 24 additions and 1 deletions

View File

@ -149,7 +149,8 @@ MEMBER_ROWS = (
'monitor_port',
'monitor_address',
'backup',
'tags')
'tags',
'vnic_type')
MEMBER_COLUMNS = (
'id',

View File

@ -99,6 +99,10 @@ class ShowMember(command.ShowOne):
data = self.app.client_manager.load_balancer.member_show(
pool_id=pool_id, member_id=member_id)
# Handle older API versions that did not have the vnic_type
if not data.get('vnic_type', False):
data['vnic_type'] = 'normal'
formatters = {'tags': v2_utils.format_list_flat}
return (rows, (utils.get_dict_properties(
@ -192,6 +196,12 @@ class CreateMember(command.ShowOne):
action='store_true',
help='Wait for action to complete.',
)
parser.add_argument(
'--request-sriov',
action='store_true',
default=None,
help='Request that the member port be created using an SR-IOV VF.',
)
_tag.add_tag_option_to_parser_for_create(
parser, 'member')
@ -225,6 +235,10 @@ class CreateMember(command.ShowOne):
pool_id, data['member']['id']))
}
# Handle older API versions that did not have the vnic_type
if not data.get('vnic_type', False):
data['vnic_type'] = 'normal'
formatters = {'tags': v2_utils.format_list_flat}
return (rows,

View File

@ -418,6 +418,8 @@ def get_member_attrs(client_manager, parsed_args):
'monitor_address': ('monitor_address', str),
'enable': ('admin_state_up', lambda x: True),
'disable': ('admin_state_up', lambda x: False),
'request_sriov': ('request_sriov', lambda x: True),
'vnic_type': ('vnic_type', str),
}
add_tags_attr_map(attr_map)

View File

@ -0,0 +1,6 @@
---
features:
- |
Added SR-IOV support for members to the client. This adds a "vnic_type"
field to the member output and a new option "--request-sriov" for the
member create command.