Blog
Search…
Delete OpenStack neutron networks
Fix to unable to complete operation on subnet
1
[[email protected] ~(keystone_admin)]# neutron router-list
2
+--------------------------------------+------------------+-----------------------------------------------------------------------------+
3
| id                                   | name             | external_gateway_info                                                       |
4
+--------------------------------------+------------------+-----------------------------------------------------------------------------+
5
e34d94ad-7fe1-4704-8156-d255a2daa167 | demodeleterouter | {"network_id": "8b2ceda2-4d77-4c5c-ae21-6a7ba133e4fc", "enable_snat": true} |
6
--------------------------------------+------------------+-----------------------------------------------------------------------------+
7
[[email protected] ~(keystone_admin)]# neutron router-gateway-clear e34d94ad-7fe1-4704-8156-d255a2daa167
8
Removed gateway from router e34d94ad-7fe1-4704-8156-d255a2daa167
9
10
[[email protected] ~(keystone_admin)]# neutron router-port-list e34d94ad-7fe1-4704-8156-d255a2daa167
11
12
If Apply:
13
[[ neutron router-interface-delete <router-id> <subnet-id> ]]
14
15
[[email protected] ~(keystone_admin)]# neutron router-delete e34d94ad-7fe1-4704-8156-d255a2daa167
16
Deleted router: e34d94ad-7fe1-4704-8156-d255a2daa167
17
18
[[email protected] ~(keystone_admin)]# neutron subnet-list
19
+--------------------------------------+------------------+------------------+--------------------------------------------------------+
20
| id                                   | name             | cidr             | allocation_pools                                       |
21
+--------------------------------------+------------------+------------------+--------------------------------------------------------+
22
| d50e28f7-47ee-4bdf-8594-e1108f25586b | demosubnetdelete | 192.168.137.0/24 | {"start": "192.168.137.100", "end": "192.168.137.120"} |
23
| c93fd5a7-d672-4b0c-8f2e-6e74f487e45d | private_subnet   | 10.0.0.0/24      | {"start": "10.0.0.2", "end": "10.0.0.254"}             |
24
+--------------------------------------+------------------+------------------+--------------------------------------------------------+
25
[[email protected] ~(keystone_admin)]# neutron subnet-delete d50e28f7-47ee-4bdf-8594-e1108f25586b
26
409-{u'NeutronError': {u'message': u'Unable to complete operation on subnet d50e28f7-47ee-4bdf-8594-e1108f25586b. One or more ports have an IP allocation from this subnet.', u'type': u'SubnetInUse', u'detail': u''}}
27
28
[[email protected] ~(keystone_admin)]# neutron port-list
29
+--------------------------------------+------+-------------------+----------------------------------------------------------------------------------------+
30
| id                                   | name | mac_address       | fixed_ips                                                                              |
31
+--------------------------------------+------+-------------------+----------------------------------------------------------------------------------------+
32
| 4655e13a-9767-4750-8f44-4eee8410ca70 |      | fa:16:3e:03:c7:cf | {"subnet_id": "d50e28f7-47ee-4bdf-8594-e1108f25586b", "ip_address": "192.168.137.103"} |
33
| 767f2f83-f99a-46d1-b2c2-2e47bae4bb90 |      | fa:16:3e:ff:94:28 | {"subnet_id": "d50e28f7-47ee-4bdf-8594-e1108f25586b", "ip_address": "192.168.137.102"} |
34
+--------------------------------------+------+-------------------+----------------------------------------------------------------------------------------+
35
36
[[email protected] ~(keystone_admin)]# neutron port-delete 767f2f83-f99a-46d1-b2c2-2e47bae4bb90
37
Deleted port: 767f2f83-f99a-46d1-b2c2-2e47bae4bb90
38
39
[[email protected] ~(keystone_admin)]# neutron port-delete 4655e13a-9767-4750-8f44-4eee8410ca70
40
409-{u'NeutronError': {u'message': u'Port 4655e13a-9767-4750-8f44-4eee8410ca70 has owner network:floatingip and therefore cannot be deleted directly via the port API.', u'type': u'L3PortInUse', u'detail': u''}}
41
42
[[email protected] ~(keystone_admin)]# neutron floatingip-list
43
+--------------------------------------+------------------+---------------------+---------+
44
| id                                   | fixed_ip_address | floating_ip_address | port_id |
45
+--------------------------------------+------------------+---------------------+---------+
46
| 0a74679b-b469-4ae5-97a0-08c3aeeb2129 |                  | 192.168.137.103     |         |
47
+--------------------------------------+------------------+---------------------+---------+
48
49
[[email protected] ~(keystone_admin)]# neutron floatingip-delete 0a74679b-b469-4ae5-97a0-08c3aeeb2129
50
Deleted floatingip: 0a74679b-b469-4ae5-97a0-08c3aeeb2129
51
52
[[email protected] ~(keystone_admin)]# neutron port-list
53
54
[[email protected] ~(keystone_admin)]# neutron subnet-delete d50e28f7-47ee-4bdf-8594-e1108f25586b
55
Deleted subnet: d50e28f7-47ee-4bdf-8594-e1108f25586b
56
57
[[email protected] ~(keystone_admin)]# neutron net-list
58
+--------------------------------------+------------+--------------------------------------------------+
59
| id                                   | name       | subnets                                          |
60
+--------------------------------------+------------+--------------------------------------------------+
61
| 77dd5a93-b63e-44be-84d6-f6ef4fd8771b | private    | c93fd5a7-d672-4b0c-8f2e-6e74f487e45d 10.0.0.0/24 |
62
| 8b2ceda2-4d77-4c5c-ae21-6a7ba133e4fc | demodelete |                                                  |
63
+--------------------------------------+------------+--------------------------------------------------+
64
[[email protected] ~(keystone_admin)]# neutron net-delete 8b2ceda2-4d77-4c5c-ae21-6a7ba133e4fc
65
Deleted network: 8b2ceda2-4d77-4c5c-ae21-6a7ba133e4fc
Copied!
[[email protected] ~(keystone_admin)]# neutron router-gateway-clear e34d94ad-7fe1-4704-8156-d255a2daa167 Removed gateway from router e34d94ad-7fe1-4704-8156-d255a2daa167
[[email protected] ~(keystone_admin)]# neutron router-port-list e34d94ad-7fe1-4704-8156-d255a2daa167
If Apply: [[ neutron router-interface-delete ]]
[[email protected] ~(keystone_admin)]# neutron router-delete e34d94ad-7fe1-4704-8156-d255a2daa167 Deleted router: e34d94ad-7fe1-4704-8156-d255a2daa167
[[email protected] ~(keystone_admin)]# neutron subnet-list +--------------------------------------+------------------+------------------+--------------------------------------------------------+ | id | name | cidr | allocation_pools | +--------------------------------------+------------------+------------------+--------------------------------------------------------+ | d50e28f7-47ee-4bdf-8594-e1108f25586b | demosubnetdelete | 192.168.137.0/24 | {"start": "192.168.137.100", "end": "192.168.137.120"} | | c93fd5a7-d672-4b0c-8f2e-6e74f487e45d | private_subnet | 10.0.0.0/24 | {"start": "10.0.0.2", "end": "10.0.0.254"} | +--------------------------------------+------------------+------------------+--------------------------------------------------------+ [[email protected] ~(keystone_admin)]# neutron subnet-delete d50e28f7-47ee-4bdf-8594-e1108f25586b 409-{u'NeutronError': {u'message': u'Unable to complete operation on subnet d50e28f7-47ee-4bdf-8594-e1108f25586b. One or more ports have an IP allocation from this subnet.', u'type': u'SubnetInUse', u'detail': u''}}
[[email protected] ~(keystone_admin)]# neutron port-list +--------------------------------------+------+-------------------+----------------------------------------------------------------------------------------+ | id | name | mac_address | fixed_ips | +--------------------------------------+------+-------------------+----------------------------------------------------------------------------------------+ | 4655e13a-9767-4750-8f44-4eee8410ca70 | | fa:16:3e:03:c7:cf | {"subnet_id": "d50e28f7-47ee-4bdf-8594-e1108f25586b", "ip_address": "192.168.137.103"} | | 767f2f83-f99a-46d1-b2c2-2e47bae4bb90 | | fa:16:3e:ff:94:28 | {"subnet_id": "d50e28f7-47ee-4bdf-8594-e1108f25586b", "ip_address": "192.168.137.102"} | +--------------------------------------+------+-------------------+----------------------------------------------------------------------------------------+
[[email protected] ~(keystone_admin)]# neutron port-delete 767f2f83-f99a-46d1-b2c2-2e47bae4bb90 Deleted port: 767f2f83-f99a-46d1-b2c2-2e47bae4bb90
[[email protected] ~(keystone_admin)]# neutron port-delete 4655e13a-9767-4750-8f44-4eee8410ca70 409-{u'NeutronError': {u'message': u'Port 4655e13a-9767-4750-8f44-4eee8410ca70 has owner network:floatingip and therefore cannot be deleted directly via the port API.', u'type': u'L3PortInUse', u'detail': u''}}
[[email protected] ~(keystone_admin)]# neutron floatingip-list +--------------------------------------+------------------+---------------------+---------+ | id | fixed_ip_address | floating_ip_address | port_id | +--------------------------------------+------------------+---------------------+---------+ | 0a74679b-b469-4ae5-97a0-08c3aeeb2129 | | 192.168.137.103 | | +--------------------------------------+------------------+---------------------+---------+
[[email protected] ~(keystone_admin)]# neutron floatingip-delete 0a74679b-b469-4ae5-97a0-08c3aeeb2129 Deleted floatingip: 0a74679b-b469-4ae5-97a0-08c3aeeb2129
[[email protected] ~(keystone_admin)]# neutron port-list
[[email protected] ~(keystone_admin)]# neutron subnet-delete d50e28f7-47ee-4bdf-8594-e1108f25586b Deleted subnet: d50e28f7-47ee-4bdf-8594-e1108f25586b
[[email protected] ~(keystone_admin)]# neutron net-list +--------------------------------------+------------+--------------------------------------------------+ | id | name | subnets | +--------------------------------------+------------+--------------------------------------------------+ | 77dd5a93-b63e-44be-84d6-f6ef4fd8771b | private | c93fd5a7-d672-4b0c-8f2e-6e74f487e45d 10.0.0.0/24 | | 8b2ceda2-4d77-4c5c-ae21-6a7ba133e4fc | demodelete | | +--------------------------------------+------------+--------------------------------------------------+ [[email protected] ~(keystone_admin)]# neutron net-delete 8b2ceda2-4d77-4c5c-ae21-6a7ba133e4fc Deleted network: 8b2ceda2-4d77-4c5c-ae21-6a7ba133e4fc
Last modified 1yr ago
Copy link