Skip to content

Commit 920a5af

Browse files
Jenkinsopenstack-gerrit
Jenkins
authored andcommitted
Merge "Add provider attribute to lb-pool-create command"
2 parents db7b01d + 11157b8 commit 920a5af

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

neutronclient/neutron/v2_0/lb/pool.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,18 @@
2222
from neutronclient.neutron import v2_0 as neutronV20
2323

2424

25+
def _format_provider(pool):
26+
return pool.get('provider') or 'N/A'
27+
28+
2529
class ListPool(neutronV20.ListCommand):
2630
"""List pools that belong to a given tenant."""
2731

2832
resource = 'pool'
2933
log = logging.getLogger(__name__ + '.ListPool')
30-
list_columns = ['id', 'name', 'lb_method', 'protocol',
34+
list_columns = ['id', 'name', 'provider', 'lb_method', 'protocol',
3135
'admin_state_up', 'status']
36+
_formatters = {'provider': _format_provider}
3237
pagination_support = True
3338
sorting_support = True
3439

@@ -73,6 +78,9 @@ def add_known_arguments(self, parser):
7378
'--subnet-id', metavar='SUBNET',
7479
required=True,
7580
help='the subnet on which the members of the pool will be located')
81+
parser.add_argument(
82+
'--provider',
83+
help='provider name of loadbalancer service')
7684

7785
def args2body(self, parsed_args):
7886
_subnet_id = neutronV20.find_resourceid_by_name_or_id(
@@ -85,7 +93,7 @@ def args2body(self, parsed_args):
8593
}
8694
neutronV20.update_dict(parsed_args, body[self.resource],
8795
['description', 'lb_method', 'name',
88-
'protocol', 'tenant_id'])
96+
'protocol', 'tenant_id', 'provider'])
8997
return body
9098

9199

neutronclient/tests/unit/lb/test_cli20_pool.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,19 @@ def test_create_pool_with_all_params(self):
6060
subnet_id = 'subnet-id'
6161
tenant_id = 'my-tenant'
6262
my_id = 'my-id'
63+
provider = 'lbaas'
6364
args = ['--admin-state-down',
6465
'--description', description,
6566
'--lb-method', lb_method,
6667
'--name', name,
6768
'--protocol', protocol,
6869
'--subnet-id', subnet_id,
69-
'--tenant-id', tenant_id]
70+
'--tenant-id', tenant_id,
71+
'--provider', provider]
7072
position_names = ['admin_state_up', 'description', 'lb_method', 'name',
71-
'protocol', 'subnet_id', 'tenant_id']
73+
'protocol', 'subnet_id', 'tenant_id', 'provider']
7274
position_values = [False, description, lb_method, name,
73-
protocol, subnet_id, tenant_id]
75+
protocol, subnet_id, tenant_id, provider]
7476
self._test_create_resource(resource, cmd, name, my_id, args,
7577
position_names, position_values)
7678

0 commit comments

Comments
 (0)