Skip to content

Instantly share code, notes, and snippets.

@ccollicutt
Last active December 15, 2015 19:48
Show Gist options
  • Save ccollicutt/5313491 to your computer and use it in GitHub Desktop.
Save ccollicutt/5313491 to your computer and use it in GitHub Desktop.
#
# accidentally added a second IP range that is the same as an existing one, so am trying to remove it
#
vagrant@precise64:~$ alias q
alias q='quantum'
vagrant@precise64:~$ q router-delete router2
Router 3a411220-530d-4a5e-828c-8063233540da still has active ports
vagrant@precise64:~$ q port-list
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------------+
| id | name | mac_address | fixed_ips |
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------------+
| 101f08f6-8d99-4d61-96c4-42ec116d14fb | | fa:16:3e:3e:7b:eb | {"subnet_id": "d483db9e-5ab4-4cd7-960a-dd79a8ccf5ba", "ip_address": "10.0.0.1"} |
| 1d7da787-f5a3-4e81-8a6f-2b7fbc4c78f0 | | fa:16:3e:b6:19:43 | {"subnet_id": "93765661-e07e-4a6d-bb67-fe9a46d77849", "ip_address": "10.0.0.2"} |
| 80f5b04e-e549-42fd-84ad-665f1ea37158 | | fa:16:3e:7b:b5:b2 | {"subnet_id": "93765661-e07e-4a6d-bb67-fe9a46d77849", "ip_address": "10.0.0.1"} |
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------------+
vagrant@precise64:~$ q subnet-list
+--------------------------------------+------+-------------+--------------------------------------------+
| id | name | cidr | allocation_pools |
+--------------------------------------+------+-------------+--------------------------------------------+
| 0c769f85-dfbb-4594-ac9c-596230a47351 | | 10.0.1.0/24 | {"start": "10.0.1.2", "end": "10.0.1.254"} |
| 93765661-e07e-4a6d-bb67-fe9a46d77849 | | 10.0.0.0/24 | {"start": "10.0.0.2", "end": "10.0.0.254"} |
| d483db9e-5ab4-4cd7-960a-dd79a8ccf5ba | | 10.0.0.0/24 | {"start": "10.0.0.2", "end": "10.0.0.254"} |
+--------------------------------------+------+-------------+--------------------------------------------+
vagrant@precise64:~$ q subnet-delete d483db9e-5ab4-4cd7-960a-dd79a8ccf5ba
Unable to complete operation on subnet d483db9e-5ab4-4cd7-960a-dd79a8ccf5ba. One or more ports have an IP allocation from this subnet.
vagrant@precise64:~$ q port-delete 101f08f6-8d99-4d61-96c4-42ec116d14fb
Port 101f08f6-8d99-4d61-96c4-42ec116d14fb has owner network:router_interface and therefore cannot be deleted directly via the port API.
vagrant@precise64:~$ q router-show router2
+-----------------------+--------------------------------------+
| Field | Value |
+-----------------------+--------------------------------------+
| admin_state_up | True |
| external_gateway_info | |
| id | 3a411220-530d-4a5e-828c-8063233540da |
| name | router2 |
| routes | |
| status | ACTIVE |
| tenant_id | 07edbf07fbd14c56ba004c446bb97fa4 |
+-----------------------+--------------------------------------+
#
# Ah, got it
#
vagrant@precise64:~$ q router-interface-delete router2 d483db9e-5ab4-4cd7-960a-dd79a8ccf5ba
Removed interface from router router2
vagrant@precise64:~$ q router-delete router2
Deleted router: router2
vagrant@precise64:~$ q subnet-delete d483db9e-5ab4-4cd7-960a-dd79a8ccf5ba
Deleted subnet: d483db9e-5ab4-4cd7-960a-dd79a8ccf5ba
vagrant@precise64:~$ glance image-create --container-format=bare --name=ubuntu --disk-format=qcow2 < ubuntu-12.04-server-cloudimg-amd64-disk1.img
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | 7572a483e689ad6fb30dddf9ff76c70e |
| container_format | bare |
| created_at | 2013-04-04T20:36:03 |
| deleted | False |
| deleted_at | None |
| disk_format | qcow2 |
| id | b9ac0fc5-c100-445f-b593-4f3941375332 |
| is_public | False |
| min_disk | 0 |
| min_ram | 0 |
| name | ubuntu |
| owner | 07edbf07fbd14c56ba004c446bb97fa4 |
| protected | False |
| size | 251592704 |
| status | active |
| updated_at | 2013-04-04T20:36:06 |
+------------------+--------------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment