In Vlan mode can't create a network when --vlan option is not set

Bug #1169026 reported by Haiwei Xu
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Alvaro Lopez

Bug Description

In Vlan mode when I tried to create a network without setting the --vlan mode, I got the DuplicateVlan exception.

$ nova network-create --fixed-range-v4 192.168.3.1/24 net

ERROR: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-14c6c520-d6a4-4d6e-9280-3957091f4631)

The log in the nova-network service is :

2013-04-15 03:10:37 ERROR [nova.openstack.common.rpc.amqp] Exception during message handling
Traceback (most recent call last):
  File "/opt/stack/nova/nova/openstack/common/rpc/amqp.py", line 430, in _process_data
    rval = self.proxy.dispatch(ctxt, version, method, **args)
  File "/opt/stack/nova/nova/openstack/common/rpc/dispatcher.py", line 133, in dispatch
    return getattr(proxyobj, method)(ctxt, **kwargs)
  File "/opt/stack/nova/nova/network/manager.py", line 1817, in create_networks
    self, context, vpn=True, **kwargs)
  File "/opt/stack/nova/nova/network/manager.py", line 1058, in create_networks
    return self._do_create_networks(context, **kwargs)
  File "/opt/stack/nova/nova/network/manager.py", line 1187, in _do_create_networks
    network = self.db.network_create_safe(context, net)
  File "/opt/stack/nova/nova/db/api.py", line 797, in network_create_safe
    return IMPL.network_create_safe(context, values)
  File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 96, in wrapper
    return f(*args, **kwargs)
  File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 2164, in network_create_safe
    raise exception.DuplicateVlan(vlan=values['vlan'])
DuplicateVlan: Detected existing vlan with id 100
2013-04-15 03:10:37 DEBUG [nova.openstack.common.rpc.amqp] Pool creating new connection
2013-04-15 03:10:37 INFO [nova.openstack.common.rpc.common] Connected to AMQP server on localhost:5672
2013-04-15 03:10:37 ERROR [nova.openstack.common.rpc.common] Returning exception Detected existing vlan with id 100 to caller
2013-04-15 03:10:37 ERROR [nova.openstack.common.rpc.common] ['Traceback (most recent call last):\n', ' File "/opt/stack/nova/nova/openstack/common/rpc/amqp.py", line 430, in _process_data\n rval = self.proxy.dispatch(ctxt, version, method, **args)\n', ' File "/opt/stack/nova/nova/openstack/common/rpc/dispatcher.py", line 133, in dispatch\n return getattr(proxyobj, method)(ctxt, **kwargs)\n', ' File "/opt/stack/nova/nova/network/manager.py", line 1817, in create_networks\n self, context, vpn=True, **kwargs)\n', ' File "/opt/stack/nova/nova/network/manager.py", line 1058, in create_networks\n return self._do_create_networks(context, **kwargs)\n', ' File "/opt/stack/nova/nova/network/manager.py", line 1187, in _do_create_networks\n network = self.db.network_create_safe(context, net)\n', ' File "/opt/stack/nova/nova/db/api.py", line 797, in network_create_safe\n return IMPL.network_create_safe(context, values)\n', ' File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 96, in wrapper\n return f(*args, **kwargs)\n', ' File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 2164, in network_create_safe\n raise exception.DuplicateVlan(vlan=values[\'vlan\'])\n', 'DuplicateVlan: Detected existing vlan with id 100\n']

This is because "vlan" is set to the default value 100, if the --vlan option isn't set.
So I think we should make "vlan" an essential option to fix to bug.

Tags: network
Haiwei Xu (xu-haiwei)
Changed in nova:
assignee: nobody → Haiwei Xu (xu-haiwei)
Aaron Rosen (arosen)
tags: added: network
Changed in nova:
assignee: Haiwei Xu (xu-haiwei) → Alvaro Lopez (aloga)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/34529
Committed: http://github.com/openstack/nova/commit/ec4a9490047106b36c8a6bdf91fc7579b84868dd
Submitter: Jenkins
Branch: master

commit ec4a9490047106b36c8a6bdf91fc7579b84868dd
Author: Alvaro Lopez Garcia <email address hidden>
Date: Wed Jul 17 13:20:33 2013 +0200

    Fix network creation in Vlan mode

    - If "vlan" is specified when creating a network, we honour the option.
    - If it is not specified, the Vlan number is calculated as follows:
    CONF.vlan_start + num_existing_networks + index_of_requested_network
    - If the above vlan is in use, try to get the next free vlan.

    Fixes bug 1194835
    Fixes bug 1169026

    Change-Id: Id4476c14f9dadcf498a499534337477b3f64f604

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
importance: Undecided → Medium
tags: added: grizzly-backport-potential
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-3 → 2013.2
Alan Pevec (apevec)
tags: removed: grizzly-backport-potential
Revision history for this message
Jian Wen (wenjianhn) wrote :

If vlan is not specified, instead of calculating why not just use the smallest available vlan id?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.