duplicated VLAN IDs in db, is this is a bug?

Asked by Salvatore Orlando

I noticed there is no UNIQUE attribute on the vlan field in the networks table.
Users are then allowed to create several networks with the same VLAN ID.

Example:
nova-manage network create 10.0.1.0/24 1 256 100
nova-manage network create 10.0.2.0/24 1 256 100

results in two networks (10.0.1.0 and 10.0.2.0) using the same VLAN ID.
Is this a desired behaviour? I reckon one of the goals of the VLAN network manager is to isolate traffic between different projects by providing distinct VLAN IDs.

Moreover, this can also create problems on the network node with dnsmasq: when an instance associated with the 10.0.1.0 network starts, dnsmasq will listen on its gateway address on br100; if then an instance associated with the 10.0.2.0 is started, this would kill the previous dnsmasq instance and start another one listening on the second network's gateway, still on br100, probably partially breaking networking for instances in the first network.

If this is actually something that needs to be addressed in the code, VlanManager.create_networks should guarantee the chosen VLAN ID (vlan_start + index) is available, otherwise pick the following ID until a free one is found; alternatively create_networks can return an error if the VLAN ID is already in use.

Thanks in advance,
Salvatore

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Compute (nova) Edit question
Assignee:
No assignee Edit question
Solved by:
Salvatore Orlando
Solved:
Last query:
Last reply:
Revision history for this message
Vish Ishaya (vishvananda) said :
#1

in vlan mode, the vlans are incremented automatically when the networks are created by specifying multiple networks when you create them. Multiple neworks for a single project doesn't really work. Perhaps to protect against user error we could throw an errro from nova-manage if a network with the vlan already exists. Multiple networks is something we should probably have to deal with with flatdhcp at the very least. As you said, if there are multiple networks with different rangese, dnsmasq will fail, so the easiest solution may be to actually create a different bridge for each network range and have multiple copies of dnsmasq listening.

Vish

On Jan 26, 2011, at 4:28 AM, Salvatore Orlando wrote:

> New question #142918 on OpenStack Compute (nova):
> https://answers.launchpad.net/nova/+question/142918
>
> I noticed there is no UNIQUE attribute on the vlan field in the networks table.
> Users are then allowed to create several networks with the same VLAN ID.
>
> Example:
> nova-manage network create 10.0.1.0/24 1 256 100
> nova-manage network create 10.0.2.0/24 1 256 100
>
> results in two networks (10.0.1.0 and 10.0.2.0) using the same VLAN ID.
> Is this a desired behaviour? I reckon one of the goals of the VLAN network manager is to isolate traffic between different projects by providing distinct VLAN IDs.
>
> Moreover, this can also create problems on the network node with dnsmasq: when an instance associated with the 10.0.1.0 network starts, dnsmasq will listen on its gateway address on br100; if then an instance associated with the 10.0.2.0 is started, this would kill the previous dnsmasq instance and start another one listening on the second network's gateway, still on br100, probably partially breaking networking for instances in the first network.
>
> If this is actually something that needs to be addressed in the code, VlanManager.create_networks should guarantee the chosen VLAN ID (vlan_start + index) is available, otherwise pick the following ID until a free one is found; alternatively create_networks can return an error if the VLAN ID is already in use.
>
> Thanks in advance,
> Salvatore
>
>
>
>
>
>
> --
> You received this question notification because you are a member of Nova
> Core, which is an answer contact for OpenStack Compute (nova).

Revision history for this message
Salvatore Orlando (salvatore-orlando) said :
#2

Hi Vish,
thanks for your reply.

I agree that multiple networks for a single project does not really work, and probably does not make really sense as well.
My main point was that if nova-manage allows for adding two networks with the same VLAN id, two distinct projects migth end up being assigned the same VLAN id, and this can cause problems.

However, throwing an error if a network with the same VLAN id already exists should prevent this situation.

Shall I report a bug for that?

Salvatore

Revision history for this message
Vish Ishaya (vishvananda) said :
#3

sure.
On Jan 26, 2011, at 12:12 PM, Salvatore Orlando wrote:

> Question #142918 on OpenStack Compute (nova) changed:
> https://answers.launchpad.net/nova/+question/142918
>
> Salvatore Orlando posted a new comment:
> Hi Vish,
> thanks for your reply.
>
> I agree that multiple networks for a single project does not really work, and probably does not make really sense as well.
> My main point was that if nova-manage allows for adding two networks with the same VLAN id, two distinct projects migth end up being assigned the same VLAN id, and this can cause problems.
>
> However, throwing an error if a network with the same VLAN id already
> exists should prevent this situation.
>
> Shall I report a bug for that?
>
> Salvatore
>
> --
> You received this question notification because you are a member of Nova
> Core, which is an answer contact for OpenStack Compute (nova).

Revision history for this message
Salvatore Orlando (salvatore-orlando) said :
#4