Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to migrate openstack CVM manually

2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

The editor will share with you how to migrate openstack CVM manually. I hope you will get something after reading this article. Let's discuss it together.

1. Manually migrate vm data image files from one host to another (just copy it)

Generally, under the / var/lib/docker/volumes/nova_compute/_data/instances/ directory, uuid corresponds to the corresponding file directory.

Copy all the directories corresponding to the CVM to the directory where the virtual machine of the target host resides

Scp-r 767adf2f-b1ee-4121-a90d-baf025dd9e40 10.200.100.17:/var/lib/docker/volumes/nova_compute/_data/instances (UUID)

Enter the target host and change the directory to belong to the master group

Docker exec-it nova_libvirt bash

Cd / var/lib/nova/instances

Chown-R nova:nova 767adf2f-b1ee-4121-a90d-baf025dd9e40

2. Change the database

Log in to the control node database to change the contents of the three tables

Instances

Ml2_port_bindings

Ml2_port_binding_levels

Remember the previous configuration, the virtual machine is on that host (for error rollback)

Update host information for vm

Use nova / / use nova database

Select * from instances where uuid='767adf2f-b1ee-4121-a90d-baf025dd9e40'; / / read the information of the CVM behind the uuid, and find a place to copy and store it.

Update instances set launched_on='10-200-100-17 where uuid='767adf2f-b1ee-4121-a90d-baf025dd9e40';// update the host of the CVM as the target machine (10.200.100.17)

Device_id and CVM uuid are the same.

Use neutron / / use neutron database

Find the port_id used by the CVM

Select * from ports where device_id='767adf2f-b1ee-4121-a90d-baf025dd9e40'\ G//port_id is the corresponding value in the output

Find the CVM bound to the port_id

Select * from ml2_port_bindings where port_id='266fc080-cb1c-4ff3-87a6-7bd0b59c47c6'\ G / / port_id is the result of the last query / / the result is also saved.

Update bound host host

Update ml2_port_bindings set host='10-200,100-17' where port_id='266fc080-cb1c-4ff3-87a6-7bd0b59c47c6targets; / / Update host target (10.200.100.17)

Update ml2_port_binding_levels

Select * from ml2_port_binding_levels where port_id='266fc080-cb1c-4ff3-87a6-7bd0b59c47c6'\ Grabble

Update ml2_port_binding_levels set host='10-200100-17' where port_id='266fc080-cb1c-4ff3-87a6-7bd0b59c47c6'

Nova reset-state-active 767adf2f-b1ee-4121-a90d-baf025dd9e40

Finally, restart the vm and you can start the vm successfully.

If vm startup fails

Vm's instances table vm_state will be valued as error. If you want to recover at this time, you need to set this state to stopped, or some other state.

The above operation can be rolled back

After reading this article, I believe you have some understanding of "how to migrate openstack CVM manually". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 260

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report