openstack云主机 跨项目迁移
1、面板或者后台修改网络类型为共享网络
openstack network set xxxxxxx --share
2、备份数据库
docker exec -it -u root mariadb mysqldump -uroot -pxxxxxxxxxxx nova instances > nova_instances.sql
docker exec -it -u root mariadb mysqldump -uroot -pxxxxxxxxxxx nova instance_info_caches > nova_instance_info_caches.sql
docker exec -it -u root mariadb mysqldump -uroot -pxxxxxxxxxxx cinder volumes > cinder_volumes.sql
docker exec -it -u root mariadb mysqldump -uroot -pxxxxxxxxxxx neutron ports > neutron_ports.sql
3、查找原来项目的user_id和project_id,并记录下来
openstack user list --long
openstack project list --long
4、查找目标项目的user_id和project_id
openstack user list --long
openstack project list --long
5、修改数据库
mysql> update nova.instances set user_id="xxxxxxx",project_id="xxxxxxxx" where project_id="XXXXXXX";
mysql> update cidner.volumes set user_id="xxxxxxx",project_id="xxxxxxxx" where project_id="XXXXXXX";
mysql> update neutron.ports set user_id="xxxxxxx",project_id="xxxxxxxx" where project_id="XXXXXXX";
6、将导出来的nova.instance_info_caches.sql导出来,进行修改替换project_id 为目标项目id。
//将数据库表导入
docker cp nova_instance_info_caches.sql mariadb:/opt/
mysql> use nova;
mysql[nova]>source /opt/nova_instance_info_caches.sql
6、面板上验证云主机是否迁移成功