Merge "Add flavor argument to loadbalancer v2 create"
This commit is contained in:
@@ -55,6 +55,9 @@ class CreateLoadBalancer(neutronV20.CreateCommand):
|
||||
parser.add_argument(
|
||||
'--provider',
|
||||
help=_('Provider name of load balancer service.'))
|
||||
parser.add_argument(
|
||||
'--flavor',
|
||||
help=_('ID or name of flavor.'))
|
||||
parser.add_argument(
|
||||
'--vip-address',
|
||||
help=_('VIP address for the load balancer.'))
|
||||
@@ -67,6 +70,11 @@ class CreateLoadBalancer(neutronV20.CreateCommand):
|
||||
self.get_client(), 'subnet', parsed_args.vip_subnet)
|
||||
body = {'vip_subnet_id': _subnet_id,
|
||||
'admin_state_up': parsed_args.admin_state}
|
||||
if parsed_args.flavor:
|
||||
_flavor_id = neutronV20.find_resourceid_by_name_or_id(
|
||||
self.get_client(), 'flavor', parsed_args.flavor)
|
||||
body['flavor_id'] = _flavor_id
|
||||
|
||||
neutronV20.update_dict(parsed_args, body,
|
||||
['description', 'provider', 'vip_address',
|
||||
'tenant_id', 'name'])
|
||||
|
@@ -44,13 +44,14 @@ class CLITestV20LbLoadBalancerJSON(test_cli20.CLITestV20Base):
|
||||
cmd = lb.CreateLoadBalancer(test_cli20.MyApp(sys.stdout), None)
|
||||
name = 'lbaas-loadbalancer-name'
|
||||
description = 'lbaas-loadbalancer-desc'
|
||||
flavor_id = 'lbaas-loadbalancer-flavor'
|
||||
vip_subnet_id = 'vip-subnet'
|
||||
my_id = 'my-id'
|
||||
args = ['--admin-state-down', '--description', description,
|
||||
'--name', name, vip_subnet_id]
|
||||
'--name', name, '--flavor', flavor_id, vip_subnet_id]
|
||||
position_names = ['admin_state_up', 'description', 'name',
|
||||
'vip_subnet_id']
|
||||
position_values = [False, description, name, vip_subnet_id]
|
||||
'flavor_id', 'vip_subnet_id']
|
||||
position_values = [False, description, name, flavor_id, vip_subnet_id]
|
||||
self._test_create_resource(resource, cmd, name, my_id, args,
|
||||
position_names, position_values,
|
||||
cmd_resource=cmd_resource)
|
||||
|
Reference in New Issue
Block a user