Make --vlan option work in network-create in VLAN mode
When creating a network with network-create, DuplicateVlan exception happens whatever the --vlan option is set. This is because --vlan option isn't read correctly by novaclient. This patch fixes this bug. Fixes bug 1167779 Change-Id: I3bf0e8d96d995632698f5aa1b1a07ead9e553c70
This commit is contained in:
parent
5f3dbfdfdd
commit
c230812017
@ -632,9 +632,9 @@ def do_network_associate_project(cs, args):
|
||||
|
||||
|
||||
def _filter_network_create_options(args):
|
||||
valid_args = ['label', 'cidr', 'vlan', 'vpn_start', 'cidr_v6', 'gateway',
|
||||
'gateway_v6', 'bridge', 'multi_host', 'dns1', 'dns2', 'uuid',
|
||||
'fixed_cidr', 'project_id', 'priority']
|
||||
valid_args = ['label', 'cidr', 'vlan_start', 'vpn_start', 'cidr_v6',
|
||||
'gateway', 'gateway_v6', 'bridge', 'multi_host', 'dns1',
|
||||
'dns2', 'uuid', 'fixed_cidr', 'project_id', 'priority']
|
||||
kwargs = {}
|
||||
for k, v in args.__dict__.items():
|
||||
if k in valid_args and v is not None:
|
||||
@ -654,7 +654,7 @@ def _filter_network_create_options(args):
|
||||
dest="cidr_v6",
|
||||
help='IPv6 subnet (ex: fe80::/64')
|
||||
@utils.arg('--vlan',
|
||||
dest='vlan',
|
||||
dest='vlan_start',
|
||||
metavar='<vlan id>',
|
||||
help="vlan id")
|
||||
@utils.arg('--vpn',
|
||||
|
@ -1113,6 +1113,13 @@ class ShellTest(utils.TestCase):
|
||||
'multi_host': False}}
|
||||
self.assert_called('POST', '/os-networks', body)
|
||||
|
||||
def test_network_create_vlan(self):
|
||||
self.run_command('network-create --fixed-range-v4 192.168.0.0/24'
|
||||
' --vlan=200 new_network')
|
||||
body = {'network': {'cidr': '192.168.0.0/24', 'label': 'new_network',
|
||||
'vlan_start': '200'}}
|
||||
self.assert_called('POST', '/os-networks', body)
|
||||
|
||||
def test_add_fixed_ip(self):
|
||||
self.run_command('add-fixed-ip sample-server 1')
|
||||
self.assert_called('POST', '/servers/1234/action',
|
||||
|
Loading…
x
Reference in New Issue
Block a user