diff --git a/octaviaclient/osc/v2/constants.py b/octaviaclient/osc/v2/constants.py index b40ecb1..11e2f8e 100644 --- a/octaviaclient/osc/v2/constants.py +++ b/octaviaclient/osc/v2/constants.py @@ -149,7 +149,8 @@ MEMBER_ROWS = ( 'monitor_port', 'monitor_address', 'backup', - 'tags') + 'tags', + 'vnic_type') MEMBER_COLUMNS = ( 'id', diff --git a/octaviaclient/osc/v2/member.py b/octaviaclient/osc/v2/member.py index 761a141..9faf41f 100644 --- a/octaviaclient/osc/v2/member.py +++ b/octaviaclient/osc/v2/member.py @@ -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, diff --git a/octaviaclient/osc/v2/utils.py b/octaviaclient/osc/v2/utils.py index 3d93a7c..5245dbd 100644 --- a/octaviaclient/osc/v2/utils.py +++ b/octaviaclient/osc/v2/utils.py @@ -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) diff --git a/releasenotes/notes/Add-SR-IOV-support-for-members-5ed7f7877b17fb2a.yaml b/releasenotes/notes/Add-SR-IOV-support-for-members-5ed7f7877b17fb2a.yaml new file mode 100644 index 0000000..c21acdc --- /dev/null +++ b/releasenotes/notes/Add-SR-IOV-support-for-members-5ed7f7877b17fb2a.yaml @@ -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.