next up previous contents
Next: 刪除 network Up: 其他及問題解決 Previous: 其他及問題解決   Contents

問題:無法刪除 network

  1. 使用 openstack network delete network-id 無法刪除 network,訊息如下:
    i[root@controller ~]# openstack network delete 21cfc7b1-5a8e-4775-84dd-83b872b46cab
    Failed to delete network with name or ID '21cfc7b1-5a8e-4775-84dd-83b872b46cab': 
    Unable to delete Network for openstack.network.v2.network.Network(provider:physical_network=None,
     ipv6_address_scope=None, revision_number=3, port_security_enabled=True, mtu=1450, 
    id=21cfc7b1-5a8e-4775-84dd-83b872b46cab, router:external=False, availability_zone_hints=[], 
    availability_zones=[u'nova'], ipv4_address_scope=None, shared=False, 
    project_id=92d1ec3e04384ad599c1a8f5aed73663, status=ACTIVE, 
    subnets=[u'538a1fa1-0570-4422-96a5-8be33f9d02e0'], description=, tags=[], 
    updated_at=2018-05-25T12:28:23Z, provider:segmentation_id=56, name=selfservice, 
    admin_state_up=True, created_at=2018-05-25T12:19:45Z, provider:network_type=vxlan)
    1 of 1 networks failed to delete.
    
  2. 原因為 network 下有 subnet,subnet 下有 port,其中 route-gateway 是必要的 port,但這個 port 無法使用 openstack port delete port-id 刪除,必須以 clean 清除。解決步驟如下:
    1. 查詢 port,要移除的是 53bc7576-bcee-4ad4-ae06-d18d9be372a2。
      [root@controller ~]# neutron router-list
      neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
      +--------------------------------------+--------+----------------------------------+
      | id                                   | name   | tenant_id                        |
      +--------------------------------------+--------+----------------------------------+
      | 53bc7576-bcee-4ad4-ae06-d18d9be372a2 | router | 92d1ec3e04384ad599c1a8f5aed73663 |
      +--------------------------------------+--------+----------------------------------+
      
    2. 使用 neutron route-gateway-clear 移除 53bc7576-bcee-4ad4-ae06-d18d9be372a2。
      [root@controller ~]# neutron router-gateway-clear 53bc7576-bcee-4ad4-ae06-d18d9be372a2
      neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
      Removed gateway from router 53bc7576-bcee-4ad4-ae06-d18d9be372a2
      
    3. 查詢 subnet id 是 538a1fa1-0570-4422-96a5-8be33f9d02e0。
      [root@controller ~]# openstack subnet list
      +--------------------------------------+-------------+
      | ID                                   | Name        |
      +--------------------------------------+-------------+
      | 37adab37-d710-406f-bdfa-66c2a4d13203 | selfservice |
      | 538a1fa1-0570-4422-96a5-8be33f9d02e0 | provider    |
      +--------------------------------------+-------------+
      --------------------------------------+-----------------+
       Network                              | Subnet          |
      --------------------------------------+-----------------+
       3d2fe8f3-6871-4072-8688-4c83f597cda1 | 172.16.1.0/24   |
       21cfc7b1-5a8e-4775-84dd-83b872b46cab | 192.168.10.0/24 |
      --------------------------------------+-----------------+
      
    4. 刪除 subnet 538a1fa1-0570-4422-96a5-8be33f9d02e0。
      [root@controller ~]# openstack subnet delete 538a1fa1-0570-4422-96a5-8be33f9d02e0
      
    5. 查詢要刪除的 network provider 已無 subnet,其 id 是 21cfc7b1-5a8e-4775-84dd-83b872b46cab。
      [root@controller ~]# openstack network list
      +--------------------------------------+-------------+--------------------------------------+
      | ID                                   | Name        | Subnets                              |
      +--------------------------------------+-------------+--------------------------------------+
      | 21cfc7b1-5a8e-4775-84dd-83b872b46cab | provider    |                                      |
      | 3d2fe8f3-6871-4072-8688-4c83f597cda1 | selfservice | 37adab37-d710-406f-bdfa-66c2a4d13203 |
      +--------------------------------------+-------------+--------------------------------------+
      
    6. 刪除 network 21cfc7b1-5a8e-4775-84dd-83b872b46cab。
      [root@controller ~]# openstack network delete 21cfc7b1-5a8e-4775-84dd-83b872b46cab
      
    7. 再列出 network,provider 已刪除。
      [root@controller ~]# openstack network list
      +--------------------------------------+-------------+--------------------------------------+
      | ID                                   | Name        | Subnets                              |
      +--------------------------------------+-------------+--------------------------------------+
      | 3d2fe8f3-6871-4072-8688-4c83f597cda1 | selfservice | 37adab37-d710-406f-bdfa-66c2a4d13203 |
      +--------------------------------------+-------------+--------------------------------------+
      



2018-09-19