目标:要删除外网Ext-Net2

直接删网络也会出错:因为有一个或多个端口在使用该网络

root@controller:~# neutron net-list
+--------------------------------------+-------------+----------------------------------------------------+
| id | name | subnets |
+--------------------------------------+-------------+----------------------------------------------------+
| 739485b6-bc45-4a53-953d-f3c4cb07f601 | Ext-Net2 | ef86e785-8cec-486a-b67f-dcbba5311293 10.100.0.0/24 |
| 7c22bbd9-166c-4610-9a3d-3b8b92c77518 | tenantA-Net | c37d8ed0-372e-4b24-9ba2-897c38c6ddbf 10.0.0.0/24 |
| c8699820-7c6d-4441-9602-3425f2c630ec | Ext-Net | 2c4155c9-5a2e-471c-a4d8-40a86b45ab0a 10.1.101.0/24 |
+--------------------------------------+-------------+----------------------------------------------------+
root@controller:~# neutron net-delete 739485b6-bc45-4a53-953d-f3c4cb07f601
Unable to complete operation on network 739485b6-bc45-4a53-953d-f3c4cb07f601. There are one or more ports still in use on the network.

查看子网:删除子网会出错:一个或多个端口用了这个子网分配的浮动IP。

root@controller:~# neutron subnet-list
+--------------------------------------+-----------------+---------------+--------------------------------------------------+
| id | name | cidr | allocation_pools |
+--------------------------------------+-----------------+---------------+--------------------------------------------------+
| 2c4155c9-5a2e-471c-a4d8-40a86b45ab0a | | 10.1.101.0/24 | {"start": "10.1.101.80", "end": "10.1.101.100"} |
| c37d8ed0-372e-4b24-9ba2-897c38c6ddbf | | 10.0.0.0/24 | {"start": "10.0.0.2", "end": "10.0.0.254"} |
| ef86e785-8cec-486a-b67f-dcbba5311293 | subNet-Ext-Net2 | 10.100.0.0/24 | {"start": "10.100.0.100", "end": "10.100.0.120"} |
+--------------------------------------+-----------------+---------------+--------------------------------------------------+
root@controller:~# neutron subnet-delete ef86e785-8cec-486a-b67f-dcbba5311293
409-{u'NeutronError': {u'message': u'Unable to complete operation on subnet ef86e785-8cec-486a-b67f-dcbba5311293. One or more ports have an IP allocation from this subnet.', u'type': u'SubnetInUse', u'detail': u''}}

直接删port会出错,因为端口有浮点IP所以不能直接删除

root@controller:~# neutron port-list
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
| id | name | mac_address | fixed_ips |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
| 1653ec91-ad7d-40d9-b777-f74aec697026 | | fa:16:3e:51:a2:97 | {"subnet_id": "c37d8ed0-372e-4b24-9ba2-897c38c6ddbf", "ip_address": "10.0.0.9"} |
| 2df7c3ed-dfbb-480d-9cd3-fdefa079e66a | | fa:16:3e:da:41:49 | {"subnet_id": "c37d8ed0-372e-4b24-9ba2-897c38c6ddbf", "ip_address": "10.0.0.3"} |
| 81388454-30e0-45e4-b3dd-b7b2e8dbf067 | | fa:16:3e:f7:e6:9c | {"subnet_id": "c37d8ed0-372e-4b24-9ba2-897c38c6ddbf", "ip_address": "10.0.0.1"} |
| accd8dbf-0f16-4aec-b797-bbb33abcdc83 | | fa:16:3e:97:ee:cb | {"subnet_id": "ef86e785-8cec-486a-b67f-dcbba5311293", "ip_address": "10.100.0.103"} |
| bfe7eaa4-26bc-4fe9-9da2-550abf44beaa | | fa:16:3e:e1:00:41 | {"subnet_id": "2c4155c9-5a2e-471c-a4d8-40a86b45ab0a", "ip_address": "10.1.101.83"} |
| d7233b80-9d4b-4ef6-a60d-19b3be661069 | | fa:16:3e:75:e0:5a | {"subnet_id": "c37d8ed0-372e-4b24-9ba2-897c38c6ddbf", "ip_address": "10.0.0.10"} |
| eb60f9c4-2ddb-49ee-8b78-2fc2564a7600 | | fa:16:3e:78:39:e9 | {"subnet_id": "2c4155c9-5a2e-471c-a4d8-40a86b45ab0a", "ip_address": "10.1.101.80"} |
| f6812a11-c4ce-4880-8566-2206afcc612a | | fa:16:3e:9e:75:a2 | {"subnet_id": "2c4155c9-5a2e-471c-a4d8-40a86b45ab0a", "ip_address": "10.1.101.82"} |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
root@controller:~# neutron port-delete accd8dbf-0f16-4aec-b797-bbb33abcdc83
409-{u'NeutronError': {u'message': u'Port accd8dbf-0f16-4aec-b797-bbb33abcdc83 has owner network:floatingip and therefore cannot be deleted directly via the port API.', u'type': u'L3PortInUse', u'detail': u''}}

但是却查不到浮动IP

root@controller:~# nova  floating-ip-list
+----+-----------+----------+------+
| Ip | Server Id | Fixed Ip | Pool |
+----+-----------+----------+------+
+----+-----------+----------+------+
root@controller:~# nova floating-ip-delete 10.100.0.103
ERROR: Floating ip 10.100.0.103 not found.

解除绑定浮动IP:这样做也不可行,因为这个ID不是虚拟机的ID。

root@controller:~# neutron port-list
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
| id | name | mac_address | fixed_ips |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
| 1653ec91-ad7d-40d9-b777-f74aec697026 | | fa:16:3e:51:a2:97 | {"subnet_id": "c37d8ed0-372e-4b24-9ba2-897c38c6ddbf", "ip_address": "10.0.0.9"} |
| 2df7c3ed-dfbb-480d-9cd3-fdefa079e66a | | fa:16:3e:da:41:49 | {"subnet_id": "c37d8ed0-372e-4b24-9ba2-897c38c6ddbf", "ip_address": "10.0.0.3"} |
| 81388454-30e0-45e4-b3dd-b7b2e8dbf067 | | fa:16:3e:f7:e6:9c | {"subnet_id": "c37d8ed0-372e-4b24-9ba2-897c38c6ddbf", "ip_address": "10.0.0.1"} |
| accd8dbf-0f16-4aec-b797-bbb33abcdc83 | | fa:16:3e:97:ee:cb | {"subnet_id": "ef86e785-8cec-486a-b67f-dcbba5311293", "ip_address": "10.100.0.103"} |
| bfe7eaa4-26bc-4fe9-9da2-550abf44beaa | | fa:16:3e:e1:00:41 | {"subnet_id": "2c4155c9-5a2e-471c-a4d8-40a86b45ab0a", "ip_address": "10.1.101.83"} |
| d7233b80-9d4b-4ef6-a60d-19b3be661069 | | fa:16:3e:75:e0:5a | {"subnet_id": "c37d8ed0-372e-4b24-9ba2-897c38c6ddbf", "ip_address": "10.0.0.10"} |
| eb60f9c4-2ddb-49ee-8b78-2fc2564a7600 | | fa:16:3e:78:39:e9 | {"subnet_id": "2c4155c9-5a2e-471c-a4d8-40a86b45ab0a", "ip_address": "10.1.101.80"} |
| f6812a11-c4ce-4880-8566-2206afcc612a | | fa:16:3e:9e:75:a2 | {"subnet_id": "2c4155c9-5a2e-471c-a4d8-40a86b45ab0a", "ip_address": "10.1.101.82"} |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
root@controller:~# nova floating-ip-disassociate accd8dbf-0f16-4aec-b797-bbb33abcdc83 10.100.0.103
ERROR: No server with a name or ID of 'accd8dbf-0f16-4aec-b797-bbb33abcdc83' exists.

通过horizon查看,发现该浮动IP,没有被分配,但是用命令却查不到

root@controller:~# nova --os-tenant-name TenantA --os-username UserA --os-password password  --os-auth-url=http://localhost:5000/v2.0  floating-ip-list
ERROR: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-294eb77b-1615-46fb-93de-d10660a46b70)

没办法,只能手动从horizon释放掉浮动IP了。登录UserA,手动释放掉浮动IP10.100.0.3,现在就可以正常删除了。

现在删除Ext-Net2就没问题了。

root@controller:~# neutron net-list
+--------------------------------------+-------------+----------------------------------------------------+
| id | name | subnets |
+--------------------------------------+-------------+----------------------------------------------------+
| 739485b6-bc45-4a53-953d-f3c4cb07f601 | Ext-Net2 | ef86e785-8cec-486a-b67f-dcbba5311293 10.100.0.0/24 |
| 7c22bbd9-166c-4610-9a3d-3b8b92c77518 | tenantA-Net | c37d8ed0-372e-4b24-9ba2-897c38c6ddbf 10.0.0.0/24 |
| c8699820-7c6d-4441-9602-3425f2c630ec | Ext-Net | 2c4155c9-5a2e-471c-a4d8-40a86b45ab0a 10.1.101.0/24 |
+--------------------------------------+-------------+----------------------------------------------------+
root@controller:~# neutron net-delete 739485b6-bc45-4a53-953d-f3c4cb07f601
Deleted network: 739485b6-bc45-4a53-953d-f3c4cb07f601

总结:用admin删除网络时注意,admin看不到租户分配的浮动IP,所以得用租户登录释放掉浮动IP。

目标:删除租户的网络

root@sc-ctrl01:~# neutron net-list
+--------------------------------------+-------------+-------------------------------------------------------+
| id | name | subnets |
+--------------------------------------+-------------+-------------------------------------------------------+
| 3ccfd309-df88-4301-bd96-7f9852bec855 | TenantB-Net | aa4b016f-dbf2-435e-9388-57824ae2c235 192.168.0.0/24 |
| b009f565-10b5-407b-93e4-e187636cd99d | ext-net | ba2ddac5-5eaf-409a-a9c1-fdafd04d21d9 10.0.200.0/24 |
+--------------------------------------+-------------+-------------------------------------------------------+
root@sc-ctrl01:~# neutron net-delete TenantB-Net
Unable to complete operation on network 3ccfd309-df88-4301-bd96-7f9852bec855. There are one or more ports still in use on the network. (HTTP 409) (Request-ID: req-bcb58ccf-f95b-4a02-8f28-5384562dc0eb)

看一下子网

root@sc-ctrl01:~# neutron subnet-list
+--------------------------------------+--------------------+------------------+------------------------------------------------------+
| id | name | cidr | allocation_pools |
+--------------------------------------+--------------------+------------------+------------------------------------------------------+
| aa4b016f-dbf2-435e-9388-57824ae2c235 | TenantB-Net-SubNet | 192.168.0.0/24 | {"start": "192.168.0.2", "end": "192.168.0.254"} |
| ba2ddac5-5eaf-409a-a9c1-fdafd04d21d9 | ext-subnet | 10.0.200.0/24 | {"start": "10.0.200.100", "end": "10.0.200.250"} |
| 7fa4a398-b67b-462b-a9b3-c65802952f79 | sub_lxp_net | 192.168.1.0/24 | {"start": "192.168.1.150", "end": "192.168.1.200"} |
| 2e985c9f-3668-417f-8b40-d7f551e668c0 | sub_lxp_net2 | 192.168.100.0/24 | {"start": "192.168.100.1", "end": "192.168.100.254"} |
+--------------------------------------+--------------------+------------------+------------------------------------------------------+
root@sc-ctrl01:~# neutron port-list
+--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+
| id | name | mac_address | fixed_ips |
+--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+
| 6d0ec7ba-37e8-4784-8076-b2e39c3b8f00 | | fa:16:3e:8b:62:98 | {"subnet_id": "2e985c9f-3668-417f-8b40-d7f551e668c0", "ip_address": "192.168.100.3"} |
| 7915e60f-a4d6-4f2c-875b-b402f8828571 | | fa:16:3e:54:f1:51 | {"subnet_id": "2e985c9f-3668-417f-8b40-d7f551e668c0", "ip_address": "192.168.100.1"} |
| 963ceaa8-3750-449b-bebd-3f8e89e6dd0d | | fa:16:3e:96:29:98 | {"subnet_id": "7fa4a398-b67b-462b-a9b3-c65802952f79", "ip_address": "192.168.1.150"} |
| a56330b4-3409-4b40-aadf-b0f2302b2c16 | | fa:16:3e:be:c9:54 | {"subnet_id": "2e985c9f-3668-417f-8b40-d7f551e668c0", "ip_address": "192.168.100.2"} |
| b7792c1a-d284-494c-b1b8-8609f33957c3 | | fa:16:3e:1d:c1:d1 | {"subnet_id": "aa4b016f-dbf2-435e-9388-57824ae2c235", "ip_address": "192.168.0.1"} |
| cdabb78e-11f1-4b0d-ab4d-59abba4c0ab1 | | fa:16:3e:1e:32:7f | {"subnet_id": "ba2ddac5-5eaf-409a-a9c1-fdafd04d21d9", "ip_address": "10.0.200.100"} |
+--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+
root@sc-ctrl01:~# neutron port-delete b7792c1a-d284-494c-b1b8-8609f33957c3
Port b7792c1a-d284-494c-b1b8-8609f33957c3 has owner network:router_interface and therefore cannot be deleted directly via the port API. (HTTP 409) (Request-ID: req-500d34ea-9cdc-4566-b931-25fb934d9864)

要删port,先看路由

root@sc-ctrl01:~# neutron router-list
+--------------------------------------+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+-------+
| id | name | external_gateway_info | distributed | ha |
+--------------------------------------+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+-------+
| 9a5054d7-35a4-441f-a0fb-d5bf7070edc7 | TenantB-Router | {"network_id": "b009f565-10b5-407b-93e4-e187636cd99d", "enable_snat": true, "external_fixed_ips": [{"subnet_id": "ba2ddac5-5eaf-409a-a9c1-fdafd04d21d9", "ip_address": "10.0.200.100"}]} | False | False |
+--------------------------------------+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+-------+
root@sc-ctrl01:~# neutron router-delete TenantB-Router
Router 9a5054d7-35a4-441f-a0fb-d5bf7070edc7 still has ports (HTTP 409) (Request-ID: req-282fe122-4cab-4595-9f63-825ad81f13b9)

路由接着外网和私网的子网。

所以先删路由上的网关

root@sc-ctrl01:~# neutron router-gateway-clear TenantB-Router
Removed gateway from router TenantB-Router

再删路由上的接口,删除某个路由的某个接口

root@sc-ctrl01:~# neutron router-interface-delete  TenantB-Router TenantB-Net-SubNet
Removed interface from router TenantB-Router.
root@sc-ctrl01:~#

port是关联路由和子网的。所以清掉路由上的接口,那port就没有了。

root@sc-ctrl01:~# neutron router-delete TenantB-Router
Deleted router: TenantB-Router

接着删子网

root@sc-ctrl01:~# neutron subnet-delete TenantB-Net-SubNet
Deleted subnet: TenantB-Net-SubNet

最后网络就可以删掉了

root@sc-ctrl01:~# neutron net-delete TenantB-Net
Deleted network: TenantB-Net

OpenStack neutron删除网络设备出错解决办法的更多相关文章

  1. 黄聪:C#使用Application.Restart重启程序出错解决办法

    调用 Application.Restart重启程序出错 解决办法,就是给程序的.exe文件,加上下面的设置

  2. npm中npm install 始终出错解决办法

    npm中npm install 始终出错解决办法 错误信息: C:\Windows\System32>npm install -g gulp npm ERR! Windows_NT 6.1.76 ...

  3. 安装openstack同步数据库时出错解决方法

    错误提示:(2003, "Can't connect to MySQL server on 'controller' ([Errno -2] Name or service not know ...

  4. ARM64平台编译stream、netperf出错解决办法 解决办法:指定编译平台为alpha [root@localhost netperf-2.6.0]# ./configure –build=alpha

    ARM64平台编译stream.netperf出错解决办法 http://ilinuxkernel.com/?p=1738 stream编译出错信息: [root@localhost stream]# ...

  5. dpkg:处理 xxx (--configure)时出错解决办法,也可用于卸载软件出错的情况

    dpkg:处理 xxx (--configure)时出错解决办法今早安装nfs时出现问题,找到该文,备份留用.然后在网上找到了这片文章,按步骤走就解决了,中间会提示自动卸载一下,执行那个命令就好了,我 ...

  6. ORBSLAM2与OPENCV3.1.0出错解决办法

    用opencv3.1.0做ORBSLAM2运行一下命令时cd ORB_SLAM2 chmod +x build.sh ./build.sh出错:/usr/bin/ld: CMakeFiles/mono ...

  7. iTunes.exe 在win7系统中运行出错解决办法

    重新安装了iTunes打开后就报错,然后直接退出 查windows日志提示错误应用程序名称: iTunes.exe 错误模块名称: KERNELBASE.dll 重新安装iTunes问题依旧,后来在G ...

  8. Maven引入hadoop依赖包出错解决办法

    错误: ArtifactTransferException: Failure to transfer org.apache.hadoop:hadoop-hdfs:jar:2.6.0 from http ...

  9. Windows下文件或文件夹不能删除时的解决办法

    windows在删除文件或文件夹时,提示文件或文件夹被占用而无法删除 解决办法:win7: winxp:需要借助第三方工具Unlocker.360.Process Explorer(这个是微软支持的) ...

随机推荐

  1. out 和 ref 参数修饰符

    整理自MSDN out: out 关键字通过引用传递参数.这与 ref 关键字相似,只不过 ref 要求在传递之前初始化变量.若要使用 out 参数,方法定义和调用方法均必须显式使用 out 关键字. ...

  2. PHP实现过滤各种HTML标签

    首先分享一些比较常见的 $str=preg_replace("/<s*imgs+[^>]*?srcs*=s*(''|")(.*?)\1[^>]*?/?s*> ...

  3. 【Bootstrap基础学习】01 Bootstrap的CSS

    Bootstrap 使用了一些 HTML5 元素和 CSS 属性,所以需要使用 HTML5 文档类型. <!DOCTYPE html> <html lang="zh-CN& ...

  4. 【Qt】2.4 做一个“猜数字”的游戏

    使用对话框和Qt设计师来实现一个相当简单的小游戏.同时将通过这个程序来看布局的隐藏和显示是如何来影响窗口界面的变化的. 新建一个Qt项目,把Qt Creator默认给的mainwindow.h.mai ...

  5. IIS减少工作线程阻塞的方法

    IIS的工作进程(w3wp.exe)只提供了有限的工作线程(Work Thread)来处理请求.如果这些线程都因为要等待长时间运行的任务而阻塞,则运行时会将新来的请求排队,而不是立即执行,Web服务器 ...

  6. 深入浅出java 8 lambda表达式--零基础一分钟入门

    lambda从使用上来说,第一感觉直白的理解就是,少了很多不必要的匿名回调类的写法,比如: public static void main(String[] args) { PlatformQuery ...

  7. SharePoint 如何找到List的Template ID

    在我们添加Ribbon操作,或者对特定模板进行操作的时候,经常需要ListTemplate的数值,我们经常需要搜索各种网页,来查找匹配的ListTemplate值,其实,有个比较简便的方法. 像定义R ...

  8. Oracle_spatial的函数介绍[转]

    Oracle_spatial的函数 一sdo_Geom包的函数: 用于表示两个几何对象的关系(结果为True/False)的函数:RELATE,WITHIN_DISTANCE 验证的函数:VALIDA ...

  9. Supermemo背单词7周年纪念

    从2007年2月1日开始,用Supermemo背单词7周年了,在2013年11月21日将单词表Reset,重新开始Review以前背过的单词,并慢慢加入听写VOA时遇到的生词.

  10. iOS开发之网络编程--6、NSURLSessionConfiguration笔记

    NSURLSessionConfiguration对象用于初始化NSURLSession对象. 展开请求级别中与NSMutableURLRequest相关的可供选择的方案,我们可以看到NSURLSes ...