How to delete network

Asked by justinc111 on 2011-02-15

There is no nova-manage network delete command.
How should I delete some networks manually?

I tried to manually edit mysql DB, eg. I removed some entries in tables networks and fixed_ips.
Would that be sufficient?

Can I assume that files in /var/lib/nova/networks/nova-br10?.{conf,pid} will be deleted/clean automatically after service nova-* restart, or reboot?

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Compute (nova) Edit question
Assignee:
No assignee Edit question
Solved by:
Tom Fifield
Solved:
2011-11-08
Last query:
2011-11-08
Last reply:
2011-10-28
Vish Ishaya (vishvananda) said : #1

You should kill the dnsmasq associated with the network as well.

On Feb 15, 2011, at 9:08 AM, justinc111 wrote:

> New question #145495 on OpenStack Compute (nova):
> https://answers.launchpad.net/nova/+question/145495
>
> There is no nova-manage network delete command.
> How should I delete some networks manually?
>
> I tried to manually edit mysql DB, eg. I removed some entries in tables networks and fixed_ips.
> Would that be sufficient?
>
> Can I assume that files in /var/lib/nova/networks/nova-br10?.{conf,pid} will be deleted/clean automatically after service nova-* restart, or reboot?
>
>
> --
> You received this question notification because you are a member of Nova
> Core, which is an answer contact for OpenStack Compute (nova).

justinc111 (justin-cinkelj) said : #2

I did that too, but thanks for reminder.
So basically no garbage should be left in DB after cleaning tables networks and fixed_ips, right?
Because newly created networks get id number, continued from id of just deleted networks.
Not that this is a problem, but I thought it is strange.

Problems showed later.
After deleting some networks I left only one network:

mysql> select * from networks;
+---------------------+---------------------+------------+---------+----+----------+---------------+-----------------+--------+------------+------------+------+------+--------------------+-----------------+---------------------+------------+------------+-----------+---------+-----------+
| created_at | updated_at | deleted_at | deleted | id | injected | cidr | netmask | bridge | gateway | broadcast | dns | vlan | vpn_public_address | vpn_public_port | vpn_private_address | dhcp_start | project_id | host | cidr_v6 | ra_server |
+---------------------+---------------------+------------+---------+----+----------+---------------+-----------------+--------+------------+------------+------+------+--------------------+-----------------+---------------------+------------+------------+-----------+---------+-----------+
| 2011-01-28 10:08:00 | 2011-01-28 10:12:43 | NULL | 0 | 1 | 0 | 10.0.0.0/27 | 255.255.255.224 | br100 | 10.0.0.1 | 10.0.0.31 | NULL | 100 | 172.16.120.229 | 1000 | 10.0.0.2 | 10.0.0.3 | xproj | ubuntu04a | NULL | NULL |

New networks were created with
nova-manage network create 10.0.0.0/24 5 32
and in DB is:

| 2011-02-14 13:17:12 | NULL | NULL | 0 | 5 | 0 | 10.0.0.32/27 | 255.255.255.224 | br101 | 10.0.0.33 | 10.0.0.63 | NULL | 101 | NULL | 1001 | 10.0.0.34 | 10.0.0.35 | NULL | NULL | NULL | NULL |
| 2011-02-14 13:17:12 | NULL | NULL | 0 | 4 | 0 | 10.0.0.0/27 | 255.255.255.224 | br100 | 10.0.0.1 | 10.0.0.31 | NULL | 100 | NULL | 1000 | 10.0.0.2 | 10.0.0.3 | NULL | NULL | NULL | NULL |
| 2011-02-14 13:17:12 | NULL | NULL | 0 | 6 | 0 | 10.0.0.64/27 | 255.255.255.224 | br102 | 10.0.0.65 | 10.0.0.95 | NULL | 102 | NULL | 1002 | 10.0.0.66 | 10.0.0.67 | NULL | NULL | NULL | NULL |
| 2011-02-14 13:17:12 | NULL | NULL | 0 | 7 | 0 | 10.0.0.96/27 | 255.255.255.224 | br103 | 10.0.0.97 | 10.0.0.127 | NULL | 103 | NULL | 1003 | 10.0.0.98 | 10.0.0.99 | NULL | NULL | NULL | NULL |
| 2011-02-14 13:17:12 | NULL | NULL | 0 | 8 | 0 | 10.0.0.128/27 | 255.255.255.224 | br104 | 10.0.0.129 | 10.0.0.159 | NULL | 104 | NULL | 1004 | 10.0.0.130 | 10.0.0.131 | NULL | NULL | NULL | NULL |

First new network has id 4, its IP subnet and bridge overlap with old network with id=1.
I'm not sure if this should is a bug or a not-yet-implemented thing.
I just removed network with id=4 and corresponding entries in fixed_ips table.

Well, after adding new project, VM instances got IPs from let say 10.0.0.32/27 subnet.
But first instance received 10.0.0.63, which is a broadcast address.
Looking at DB again:

mysql> select id, address, network_id, instance_id, allocated, leased, reserved from fixed_ips where (network_id=1 OR network_id=10);
+-----+-----------+------------+-------------+-----------+--------+----------+
| id | address | network_id | instance_id | allocated | leased | reserved |
+-----+-----------+------------+-------------+-----------+--------+----------+
| 1 | 10.0.0.0 | 1 | NULL | 0 | 0 | 1 |
| 2 | 10.0.0.1 | 1 | NULL | 0 | 0 | 1 |
| 3 | 10.0.0.2 | 1 | NULL | 0 | 0 | 1 |
| 4 | 10.0.0.3 | 1 | 153 | 1 | 1 | 0 |
| 5 | 10.0.0.4 | 1 | NULL | 0 | 0 | 0 |
...
| 512 | 10.0.0.63 | 10 | NULL | 0 | 0 | 0 |
| 511 | 10.0.0.62 | 10 | NULL | 0 | 0 | 0 |
..
| 484 | 10.0.0.35 | 10 | NULL | 0 | 0 | 0 |
| 483 | 10.0.0.34 | 10 | NULL | 0 | 0 | 1 |
| 482 | 10.0.0.33 | 10 | NULL | 0 | 0 | 1 |
| 481 | 10.0.0.32 | 10 | NULL | 0 | 0 | 1 |

Seems like that un-ordered order of fixed_ips is important, as 10.0.0.63 was used as first address leased by dnsmasq.
I tried to set reserved to 1 for all broadcast addresses, and it seems to work.

Two questions now.
1. What would be correct way of adding new networks? "nova-manage network create 10.0.0.0/24 5 32" required some manual cleaning in DB.
2. Is setting reserved flag in fixed_ips OK? If so, shouldn't it be done by nova?

Regards, Justin

Vish Ishaya (vishvananda) said : #3

yes this is normal. It is just an sql autoincrment column.
On Feb 15, 2011, at 10:51 AM, justinc111 wrote:

> Question #145495 on OpenStack Compute (nova) changed:
> https://answers.launchpad.net/nova/+question/145495
>
> Status: Answered => Open
>
> justinc111 is still having a problem:
> I did that too, but thanks for reminder.
> So basically no garbage should be left in DB after cleaning tables networks and fixed_ips, right?
> Because newly created networks get id number, continued from id of just deleted networks.
> Not that this is a problem, but I thought it is strange.
>
> Problems showed later.
> After deleting some networks I left only one network:
>
> mysql> select * from networks;
> +---------------------+---------------------+------------+---------+----+----------+---------------+-----------------+--------+------------+------------+------+------+--------------------+-----------------+---------------------+------------+------------+-----------+---------+-----------+
> | created_at | updated_at | deleted_at | deleted | id | injected | cidr | netmask | bridge | gateway | broadcast | dns | vlan | vpn_public_address | vpn_public_port | vpn_private_address | dhcp_start | project_id | host | cidr_v6 | ra_server |
> +---------------------+---------------------+------------+---------+----+----------+---------------+-----------------+--------+------------+------------+------+------+--------------------+-----------------+---------------------+------------+------------+-----------+---------+-----------+
> | 2011-01-28 10:08:00 | 2011-01-28 10:12:43 | NULL | 0 | 1 | 0 | 10.0.0.0/27 | 255.255.255.224 | br100 | 10.0.0.1 | 10.0.0.31 | NULL | 100 | 172.16.120.229 | 1000 | 10.0.0.2 | 10.0.0.3 | xproj | ubuntu04a | NULL | NULL |
>
> New networks were created with
> nova-manage network create 10.0.0.0/24 5 32
> and in DB is:
>
> | 2011-02-14 13:17:12 | NULL | NULL | 0 | 5 | 0 | 10.0.0.32/27 | 255.255.255.224 | br101 | 10.0.0.33 | 10.0.0.63 | NULL | 101 | NULL | 1001 | 10.0.0.34 | 10.0.0.35 | NULL | NULL | NULL | NULL |
> | 2011-02-14 13:17:12 | NULL | NULL | 0 | 4 | 0 | 10.0.0.0/27 | 255.255.255.224 | br100 | 10.0.0.1 | 10.0.0.31 | NULL | 100 | NULL | 1000 | 10.0.0.2 | 10.0.0.3 | NULL | NULL | NULL | NULL |
> | 2011-02-14 13:17:12 | NULL | NULL | 0 | 6 | 0 | 10.0.0.64/27 | 255.255.255.224 | br102 | 10.0.0.65 | 10.0.0.95 | NULL | 102 | NULL | 1002 | 10.0.0.66 | 10.0.0.67 | NULL | NULL | NULL | NULL |
> | 2011-02-14 13:17:12 | NULL | NULL | 0 | 7 | 0 | 10.0.0.96/27 | 255.255.255.224 | br103 | 10.0.0.97 | 10.0.0.127 | NULL | 103 | NULL | 1003 | 10.0.0.98 | 10.0.0.99 | NULL | NULL | NULL | NULL |
> | 2011-02-14 13:17:12 | NULL | NULL | 0 | 8 | 0 | 10.0.0.128/27 | 255.255.255.224 | br104 | 10.0.0.129 | 10.0.0.159 | NULL | 104 | NULL | 1004 | 10.0.0.130 | 10.0.0.131 | NULL | NULL | NULL | NULL |
>
> First new network has id 4, its IP subnet and bridge overlap with old network with id=1.
> I'm not sure if this should is a bug or a not-yet-implemented thing.
> I just removed network with id=4 and corresponding entries in fixed_ips table.
>
> Well, after adding new project, VM instances got IPs from let say 10.0.0.32/27 subnet.
> But first instance received 10.0.0.63, which is a broadcast address.
> Looking at DB again:
>
> mysql> select id, address, network_id, instance_id, allocated, leased, reserved from fixed_ips where (network_id=1 OR network_id=10);
> +-----+-----------+------------+-------------+-----------+--------+----------+
> | id | address | network_id | instance_id | allocated | leased | reserved |
> +-----+-----------+------------+-------------+-----------+--------+----------+
> | 1 | 10.0.0.0 | 1 | NULL | 0 | 0 | 1 |
> | 2 | 10.0.0.1 | 1 | NULL | 0 | 0 | 1 |
> | 3 | 10.0.0.2 | 1 | NULL | 0 | 0 | 1 |
> | 4 | 10.0.0.3 | 1 | 153 | 1 | 1 | 0 |
> | 5 | 10.0.0.4 | 1 | NULL | 0 | 0 | 0 |
> ...
> | 512 | 10.0.0.63 | 10 | NULL | 0 | 0 | 0 |
> | 511 | 10.0.0.62 | 10 | NULL | 0 | 0 | 0 |
> ..
> | 484 | 10.0.0.35 | 10 | NULL | 0 | 0 | 0 |
> | 483 | 10.0.0.34 | 10 | NULL | 0 | 0 | 1 |
> | 482 | 10.0.0.33 | 10 | NULL | 0 | 0 | 1 |
> | 481 | 10.0.0.32 | 10 | NULL | 0 | 0 | 1 |
>
> Seems like that un-ordered order of fixed_ips is important, as 10.0.0.63 was used as first address leased by dnsmasq.
> I tried to set reserved to 1 for all broadcast addresses, and it seems to work.
>
> Two questions now.
> 1. What would be correct way of adding new networks? "nova-manage network create 10.0.0.0/24 5 32" required some manual cleaning in DB.
> 2. Is setting reserved flag in fixed_ips OK? If so, shouldn't it be done by nova?
>
> Regards, Justin
>
> --
> You received this question notification because you are a member of Nova
> Core, which is an answer contact for OpenStack Compute (nova).

justinc111 (justin-cinkelj) said : #4

OK, I got that. Thank you.
What about
(1) new networks using same bridge and IP subnet as old networks and
(2) DHCP leasing broadcast address to VM instance

> Two questions now.
> 1. What would be correct way of adding new networks? "nova-manage network create 10.0.0.0/24 5 32" required some manual cleaning in DB.
> 2. Is setting reserved flag in fixed_ips OK? If so, shouldn't it be done by nova?

Vish Ishaya (vishvananda) said : #5

1) shouldn't be a problem, since you've deleted everything
2) not sure what you mean exactly. It doesn't lease the broadcast address. If you just mean DHCP in general, it will lease the proper addresses via DNSMASQ. If you have old instances running you will start hitting problems though. Instances on the old networks need to be destroyed.

Vish

On Feb 15, 2011, at 11:21 AM, justinc111 wrote:

> Question #145495 on OpenStack Compute (nova) changed:
> https://answers.launchpad.net/nova/+question/145495
>
> Status: Answered => Open
>
> justinc111 is still having a problem:
> OK, I got that. Thank you.
> What about
> (1) new networks using same bridge and IP subnet as old networks and
> (2) DHCP leasing broadcast address to VM instance
>
>> Two questions now.
>> 1. What would be correct way of adding new networks? "nova-manage network create 10.0.0.0/24 5 32" required some manual cleaning in DB.
>> 2. Is setting reserved flag in fixed_ips OK? If so, shouldn't it be done by nova?
>
> --
> You received this question notification because you are a member of Nova
> Core, which is an answer contact for OpenStack Compute (nova).

justinc111 (justin-cinkelj) said : #6

1) OK, if two networks use same bridge and/or subnet, I have to clean the database.

2) When running the very first instance from the first project, it received 10.0.0.3 IP - eg. the lowest non-reserved IP.
When running instance from the second project, the first assigned IP was equal to the first IP in fixed_ips (as returned by select, without order by), and that was also equal to broadcast address.

Below, IPs are listed from 10.0.0.1 to 10.0.0.31, and later from 10.0.0.63 to 10.0.0.32.

mysql> select id, address, network_id, instance_id, allocated, leased, reserved from fixed_ips where (network_id=1 OR network_id=10);
+-----+-----------+------------+-------------+-----------+--------+----------+
| id | address | network_id | instance_id | allocated | leased | reserved |
+-----+-----------+------------+-------------+-----------+--------+----------+
| 1 | 10.0.0.0 | 1 | NULL | 0 | 0 | 1 |
| 2 | 10.0.0.1 | 1 | NULL | 0 | 0 | 1 |
| 3 | 10.0.0.2 | 1 | NULL | 0 | 0 | 1 |
| 4 | 10.0.0.3 | 1 | 153 | 1 | 1 | 0 |
| 5 | 10.0.0.4 | 1 | NULL | 0 | 0 | 0 |
...
| 512 | 10.0.0.63 | 10 | NULL | 0 | 0 | 0 |
| 511 | 10.0.0.62 | 10 | NULL | 0 | 0 | 0 |
..
| 484 | 10.0.0.35 | 10 | NULL | 0 | 0 | 0 |
| 483 | 10.0.0.34 | 10 | NULL | 0 | 0 | 1 |
| 482 | 10.0.0.33 | 10 | NULL | 0 | 0 | 1 |
| 481 | 10.0.0.32 | 10 | NULL | 0 | 0 | 1 |

Christian Berendt (berendt) said : #7

I think this has to be possible with bin/nova-manage. I created a bug report here: https://bugs.launchpad.net/nova/+bug/722982.

Best Tom Fifield (fifieldt) said : #8

Looks like this issue was fixed in the Cactus release, according to https://bugs.launchpad.net/nova/+bug/722982

Does it fix your problem justinc111?

justinc111 (justin-cinkelj) said : #9

Thanks Tom Fifield, that solved my question.