# 운영중에 nova / openstack 명령어로 vm이 이전되지 않을 때 사용.
nova migrate [instance_id] or openstack server migrate [instance_id] > ERROR...
Migration : HOST_A > HOST_B
1. Move vm's disk HOST_A to HOST_B
- vm의 disk와 _base파일 등을 옮긴다.
root@HOST_A:~# scp [vm's_disk_PATH]/* nova@HOST_B:[vm's_disk_PATH]/
root@HOST_A:~# scp [vm's_base_PATH]/[_base_file] nova@HOST_B:[vm's_base_PATH]/
* 여기부터 중요 * important from here*
2. Update DB(mysql)
명령어로 vm의 위치를 변경한게 아니기 때문에 데이터베이스도 수정이 필요.
[nova]
MariaDB [nova] > select node, host from instances where uuid='[instance_id]';
MariaDB [nova] > select node, host from instances where uuid='[instance_id]';
+--------+--------+
| node | host |
+--------+--------+
| HOST_A | HOST_A |
+--------+--------+
MariaDB [nova] > update instances set node='[HOST_B]',host='[HOST_B]' where uuid='[instance_id]';
MariaDB [nova] > update instances set node='[HOST_B]',host='[HOST_B]' where uuid='[instance_id]';
Query OK, 1 row affected (0.019 sec)
Rows matched: 1 Changed: 1 Warnings: 0
MariaDB [nova] > select node, host from instances where uuid='[instance_id]';
MariaDB [nova] > select node, host from instances where uuid='[instance_id]';
+--------+--------+
| node | host |
+--------+--------+
| HOST_B | HOST_B |
+--------+--------+
[placement] or [nova_api]
* openstack버전에 따라 DB이름이 다름. (DB=placement or nova_api)
MariaDB [DB] > select id, name from resource_providers where name='[HOST_A]';
MariaDB [DB] > select id, name from resource_providers where name='[HOST_A]';
+------+--------+
| id | name |
+------+--------+
| 1111 | HOST_A |
+------+--------+
MariaDB [DB] > select id, name from resource_providers where name='[HOST_B]';
MariaDB [DB] > select id, name from resource_providers where name='[HOST_B]';
+------+--------+
| id | name |
+------+--------+
| 2222 | HOST_B |
+------+--------+
MariaDB [DB] > select * from allocations where consumer_id='[instance_id]';
MariaDB [DB] > select * from allocations where consumer_id='[instance_id]';
+----------------------+---------------+
| resource_provider_id | consumer_id |
+----------------------+---------------+
| 1111 | [instance_id] |
| 1111 | [instance_id] |
| 1111 | [instance_id] |
+----------------------+---------------+
MariaDB [DB] > update allocations set resource_provider_id='1111' where consumer_id='[instance_id]' and resource_provider_id='2222';
MariaDB [DB] > update allocations set resource_provider_id='1111' where consumer_id='[instance_id]' and resource_provider_id='2222';
Query OK, 3 rows affected (0.274 sec)
Rows matched: 3 Changed: 3 Warnings: 0
MariaDB [DB] > select * from allocations where consumer_id='[instance_id]';
MariaDB [DB] > select * from allocations where consumer_id='[instance_id]';
+----------------------+---------------+
| resource_provider_id | consumer_id |
+----------------------+---------------+
| 2222 | [instance_id] |
| 2222 | [instance_id] |
| 2222 | [instance_id] |
+----------------------+---------------+
Complete DB update.
3. Update Port
instance에 연결된 port도 host를 변경해야함.
root@controller:~# openstack port show [port_id]
root@controller:~# openstack port show [port_id]
...
| binding_host_id | HOST_A |
...
root@controller:~# openstack port set --host HOST_B [port_id]
root@controller:~# openstack port show [port_id]
root@controller:~# openstack port show [port_id]
...
| binding_host_id | HOST_B |
...
'Openstack' 카테고리의 다른 글
[Openstack] nova live-migration (0) | 2025.02.14 |
---|---|
[Openstack] extract user-data 유저 데이터 추출 (0) | 2025.01.20 |
[Openstack] volume transfer requset 소유권 변경 (0) | 2025.01.12 |
[virsh] virsh secret-list permission denied (1) | 2024.12.06 |
[Openstack] openstack volume set size / cinder extend (0) | 2024.11.29 |