For various reasons, you might need to migrate routers and dhcp agents.
For dhcp, they are already multiple and due to lease-timeout,  the migration is not noticable

For routers, the downtime might be noticable from anywhere between 5 seconds to a minute as the ports will be recreated.

Here is an example of such a migration ( suppose I want to do maintenance on C16 ) , or I want to migrate a router from a tenant.

neutron router-list

+--------------------------------------+--------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+------+
| id                                   | name         | external_gateway_info                                                                                                                                                                     | distributed | ha   |
+--------------------------------------+--------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+------+
| 59aa2d3c-1c84-4988-95f2-eca0740a3750 | OfficeRouter | {"network_id": "f42a0fb8-0111-466a-b17a-9ff4b95d8c14", "enable_snat": true, "external_fixed_ips": [{"subnet_id": "4ef2012a-f526-4e05-bce6-7f8d202d903c", "ip_address": "192.168.101.6"}]} | False       | True |
| e6fa2d0f-0de9-49fb-ab58-46a6c5e1e855 | router01     | {"network_id": "f42a0fb8-0111-466a-b17a-9ff4b95d8c14", "enable_snat": true, "external_fixed_ips": [{"subnet_id": "4ef2012a-f526-4e05-bce6-7f8d202d903c", "ip_address": "192.168.101.5"}]} | False       | True |
+--------------------------------------+--------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+------+

neutron l3-agent-list-hosting-router 59aa2d3c-1c84-4988-95f2-eca0740a3750

 +--------------------------------------+---------------------------------------+----------------+-------+----------+
| id                                   | host                                  | admin_state_up | alive | ha_state |
+--------------------------------------+---------------------------------------+----------------+-------+----------+
| 27b943a5-b216-46a5-9f69-42d498d74327 | c14_neutron_agents_container-51938465 | True           | :-)   | standby  |
| 977a01f8-e8c8-420f-9757-1d5be5f3e0fc | c16_neutron_agents_container-14d1e768 | True           | :-)   | active   |
| 27e33961-4b5d-45c4-bf86-4339ae31a69d | c15_neutron_agents_container-ccfff5a1 | True           | :-)   | standby  |
+--------------------------------------+---------------------------------------+----------------+-------+----------+

its on c16 .. i want maintenance on c16.

neutron l3-agent-router-remove 977a01f8-e8c8-420f-9757-1d5be5f3e0fc  59aa2d3c-1c84-4988-95f2-eca0740a3750

Removed router 59aa2d3c-1c84-4988-95f2-eca0740a3750 from L3 agent

neutron l3-agent-list-hosting-router 59aa2d3c-1c84-4988-95f2-eca0740a3750

+--------------------------------------+---------------------------------------+----------------+-------+----------+
| id                                   | host                                  | admin_state_up | alive | ha_state |
+--------------------------------------+---------------------------------------+----------------+-------+----------+
| 27b943a5-b216-46a5-9f69-42d498d74327 | c14_neutron_agents_container-51938465 | True           | :-)   | active   |
| 27e33961-4b5d-45c4-bf86-4339ae31a69d | c15_neutron_agents_container-ccfff5a1 | True           | :-)   | standby  |
+--------------------------------------+---------------------------------------+----------------+-------+----------+

\o/ moved to c14.
Do maintanence on c16, or create another one .. add back 🙂
neutron l3-agent-router-add 977a01f8-e8c8-420f-9757-1d5be5f3e0fc  59aa2d3c-1c84-4988-95f2-eca0740a3750

 Added router 59aa2d3c-1c84-4988-95f2-eca0740a3750 to L3 agent

neutron l3-agent-list-hosting-router 59aa2d3c-1c84-4988-95f2-eca0740a3750

+--------------------------------------+---------------------------------------+----------------+-------+----------+
| id                                   | host                                  | admin_state_up | alive | ha_state |
+--------------------------------------+---------------------------------------+----------------+-------+----------+
| 27b943a5-b216-46a5-9f69-42d498d74327 | c14_neutron_agents_container-51938465 | True           | :-)   | active   |
| 977a01f8-e8c8-420f-9757-1d5be5f3e0fc | c16_neutron_agents_container-14d1e768 | True           | :-)   | standby  |
| 27e33961-4b5d-45c4-bf86-4339ae31a69d | c15_neutron_agents_container-ccfff5a1 | True           | :-)   | standby  |
+--------------------------------------+---------------------------------------+----------------+-------+----------+

root@c14_neutron_agents_container-51938465:~# ip netns

qrouter-59aa2d3c-1c84-4988-95f2-eca0740a3750
qdhcp-c4520434-aea7-4263-b714-ac0b6fcdc57a
qrouter-e6fa2d0f-0de9-49fb-ab58-46a6c5e1e855
qdhcp-a8ccf499-4ff3-44b3-9541-1d35693ecf80

neutron net-list

+--------------------------------------+----------------------------------------------------+-------------------------------------------------------+
| id                                   | name                                               | subnets                                               |
+--------------------------------------+----------------------------------------------------+-------------------------------------------------------+
| c4520434-aea7-4263-b714-ac0b6fcdc57a | officeNet                                          | 070ef3e3-5087-4d57-a907-2821af869575 10.0.0.0/24      |
| 6bfcadcd-6251-4480-8b4e-c22a9151bf00 | HA network tenant 3b86f724614540bc902d3570b0bf86f1 | 8306c1e7-6d0f-46ec-bbc5-1c02362c1f44 169.254.192.0/18 |
| 720995e0-bc7c-4f1e-91b0-3a61f9254776 | HA network tenant adf998ea387e4fb684246431de401047 | 3d4c8a7f-cb08-45b7-8a6d-e5e4b177da81 169.254.192.0/18 |
| f42a0fb8-0111-466a-b17a-9ff4b95d8c14 | floating-192-168-101                               | 4ef2012a-f526-4e05-bce6-7f8d202d903c 192.168.101.0/24 |
| a8ccf499-4ff3-44b3-9541-1d35693ecf80 | dhcp-192-168-201                                   | 7fe7c672-613e-440a-9780-547a94b38805 192.168.201.0/24 |
+--------------------------------------+----------------------------------------------------+-------------------------------------------------------+

I network I want to migrate is officeNet

neutron dhcp-agent-list-hosting-net c4520434-aea7-4263-b714-ac0b6fcdc57a

+--------------------------------------+---------------------------------------+----------------+-------+
| id                                   | host                                  | admin_state_up | alive |
+--------------------------------------+---------------------------------------+----------------+-------+
| 36306897-a56a-4c50-beef-7cba92b441d2 | c15_neutron_agents_container-ccfff5a1 | True           | :-)   |
| 46f147ca-c214-4f99-8b25-3cbe2d51824c | c14_neutron_agents_container-51938465 | True           | :-)   |
| 6b74e9d8-47eb-4c26-9b20-b1b20de18be2 | c16_neutron_agents_container-14d1e768 | True           | :-)   |
+--------------------------------------+---------------------------------------+----------------+-------+

Follow similar procedure for DHCP as well

Summary:

neutron agent-list

+--------------------------------------+--------------------+---------------------------------------+-------+----------------+---------------------------+
| id                                   | agent_type         | host                                  | alive | admin_state_up | binary                    |
+--------------------------------------+--------------------+---------------------------------------+-------+----------------+---------------------------+
| 0ced7e49-d07f-45ac-a3bd-f146aa7ed1a9 | Linux bridge agent | c23                                   | :-)   | True           | neutron-linuxbridge-agent |
| 27b943a5-b216-46a5-9f69-42d498d74327 | L3 agent           | c14_neutron_agents_container-51938465 | :-)   | True           | neutron-l3-agent          |
| 27e33961-4b5d-45c4-bf86-4339ae31a69d | L3 agent           | c15_neutron_agents_container-ccfff5a1 | :-)   | True           | neutron-l3-agent          |
| 2c23295b-3cc3-4661-87bc-9e7a1b83d664 | Loadbalancer agent | c15_neutron_agents_container-ccfff5a1 | :-)   | True           | neutron-lbaas-agent       |
| 300391f4-510f-46fd-9295-f86239789d9f | Metadata agent     | c15_neutron_agents_container-ccfff5a1 | :-)   | True           | neutron-metadata-agent    |
| 306137b5-ef5e-47e6-96fd-dcb08d02d0b8 | Linux bridge agent | c15_neutron_agents_container-ccfff5a1 | :-)   | True           | neutron-linuxbridge-agent |
| 36306897-a56a-4c50-beef-7cba92b441d2 | DHCP agent         | c15_neutron_agents_container-ccfff5a1 | :-)   | True           | neutron-dhcp-agent        |
| 46f147ca-c214-4f99-8b25-3cbe2d51824c | DHCP agent         | c14_neutron_agents_container-51938465 | :-)   | True           | neutron-dhcp-agent        |
| 4e94d0f6-018c-43c8-8470-df16b5c4090c | Metadata agent     | c16_neutron_agents_container-14d1e768 | :-)   | True           | neutron-metadata-agent    |
| 52783fe5-c4d8-4984-87ee-e00debf9b3a8 | Metering agent     | c16_neutron_agents_container-14d1e768 | :-)   | True           | neutron-metering-agent    |
| 6b74e9d8-47eb-4c26-9b20-b1b20de18be2 | DHCP agent         | c16_neutron_agents_container-14d1e768 | :-)   | True           | neutron-dhcp-agent        |
| 733ccdbb-8d47-46a2-9c7b-d5c82a46902e | Linux bridge agent | c25                                   | :-)   | True           | neutron-linuxbridge-agent |
| 909f48cc-3821-42f2-b01a-cb176afe6c8a | Linux bridge agent | c14_neutron_agents_container-51938465 | :-)   | True           | neutron-linuxbridge-agent |
| 922eb0ca-83cf-45ed-9919-52700d616661 | Metering agent     | c14_neutron_agents_container-51938465 | :-)   | True           | neutron-metering-agent    |
| 940d04f9-3909-4816-bebe-6be00c3b5c52 | Linux bridge agent | c24                                   | :-)   | True           | neutron-linuxbridge-agent |
| 977a01f8-e8c8-420f-9757-1d5be5f3e0fc | L3 agent           | c16_neutron_agents_container-14d1e768 | :-)   | True           | neutron-l3-agent          |
| a78742b3-51ea-4223-a734-9fe1fa027b0a | Loadbalancer agent | c16_neutron_agents_container-14d1e768 | :-)   | True           | neutron-lbaas-agent       |
| ba28ee59-e603-4e2f-a679-1fdb6d18de71 | Linux bridge agent | c16_neutron_agents_container-14d1e768 | :-)   | True           | neutron-linuxbridge-agent |
| bd05fe6a-d847-42c8-b2d9-fec168bc3837 | Loadbalancer agent | c14_neutron_agents_container-51938465 | :-)   | True           | neutron-lbaas-agent       |
| ddc32955-a44d-4124-b815-9de4a326a375 | Metadata agent     | c14_neutron_agents_container-51938465 | :-)   | True           | neutron-metadata-agent    |
| f09d6f6a-4533-4a3c-8c6b-fcb7110035c7 | Metering agent     | c15_neutron_agents_container-ccfff5a1 | :-)   | True           | neutron-metering-agent    |
+--------------------------------------+--------------------+---------------------------------------+-------+----------------+---------------------------+

Please note IDs of  L3 agent and DHCP agent.

When you migrate networks ( as in dhcp and routers ) you migrate (add/remove) DHCP to a DHCP agent  and migrate router to a L3 agent

About The Author