Objective
There are three main pits:
- One is if the original virtual machine does not have the Virtio driver installed, to set the device driver to IDE,
- The second is cinder to configure the value of Glance_api_version to V2, the uploaded image needs to be RAW format
- Third, it is best to keep the IP and hostname unchanged before and after the migration, which has minimal impact on the business.
Basic information
Give us the following documents:
Anquanpingtai-win2008r2-10.100.100.110.ova
After decompression, get:
Anquanpingtai-win2008r2_10.100.100.110-disk1.vmdk
Anquanpingtai-win2008r2_10.100.100.110-disk2.vmdk
ANQUANPINGTAI-WIN2008R2 10.100.100.110.MF
ANQUANPINGTAI-WIN2008R2 10.100.100.110.OVF
We use ANQUANPINGTAI-WIN2008R2 as the hostname, 10.100.100.110
Migration Step 1. View image size
View the information for the VMDK image, the virtual size of mirror 1 and Mirror 2 is 100GB,400GB
[[email protected]1 ~]# qemu-img info anquanpingtai-win2008r2_10.100.100.110-disk1.vmdk image: anquanpingtai-win2008r2_110.100.100.110-disk1.vmdkfile format: vmdkvirtual size: 100G (107374182400 bytes)disk size: 14Gcluster_size: 65536Format specific information: cid: 4099282801 parent cid: 4294967295 create type: streamOptimized extents: [0]: compressed: true virtual size: 107374182400 filename: anquanpingtai-win2008r2_10.100.100.110-disk1.vmdk cluster size: 65536
2. Upload the image to OpenStack
Although OpenStack supports VMDK-format mirroring, CEPH supports only raw-format virtual disks, so we want to convert the image into raw format and then upload it in advance to save time.
qemu-img convert -f vmdk -O raw ./anquanpingtai-win2008r2_10.100.100.110-disk1.vmdk ./anquanpingtai_disk1qemu-img convert -f vmdk -O raw ./anquanpingtai-win2008r2_10.100.100.110-disk2.vmdk ./anquanpingtai_disk2 glance image-create --name anquanpingtai_disk1 --disk-format "raw" --container-format 'bare' --progress --file ./anquanpingtai_disk1 --min-disk 100 glance image-create --name anquanpingtai_disk2 --disk-format "raw" --container-format 'bare' --progress --file ./anquanpingtai_disk2 --min-disk 400
Because VMware came to the image does not have the Virtio driver installed, so we want to set the mirrored disk drive for the IDE, the network card driver is e1000, this way the performance of the virtual machine is poor, so if there are conditions, it is best to put the virtual machine Virtio network card and disk driver installed before the migration
openstack image set --property hw_disk_bus=ide --property hw_vif_model=e1000 anquanpingtai_disk1openstack image set --property hw_disk_bus=ide --property hw_vif_model=e1000 anquanpingtai_disk2
3. Create a cloud drive with mirroring as the source
If the mirrored disk format is raw and the API version used by Cinder access glance is V2, when creating a cloud drive as a source, cinder supports direct RBD clone image files to copy image files and create a cloud drive. Otherwise, cinder needs to download the image to the local file system, convert it to RAW format, and upload it to ceph, which often fails due to a timeout when the image file is large.
So we need to modify the glance_api_version for the Cinder.conf service to V2 and then restart the Cinder-volume service.
Use these two previous steps to create a cloud drive, size 100G and 400G, IDs are recorded as volume1_id, volume2_id
4. Create a network for migration
It is best to keep the IP of the virtual machine intact before and after the migration, which avoids many unknown problems
According to the information given by the Science and Technology network, the IP of the server is 10.100.100.110, so we need to create a network 10.100.100.0/24, because we do not plan to access the extranet through this network, so this network can be any type, Vlan,vxlan, Flat can, as long as the inside contains these two IP can, so can be created directly in the interface, here no longer give the command, will create the network ID as $mig_net_id
5. Create a virtual machine
Let's say we've completed the steps above to create the virtual machine under the command and specify the IP
Nova Boot--flavor 4--block-device source=volume,dest=volume,id= $VOLUME 1_id, Bus=ide,bootindex=0,shutdown=preserve- -nic net-id= $MIG _net_id,v4-fixed-ip=10.100.100.110 anquanpingtai-win2008r2
[Enter description here] [1]
6. Bind a cloud Drive
Since the IDE driver does not support hot-swappable, we will be able to set up the virtual machine, then the 400G size of the previously created hard disk 2, and then re-boot, operating on the interface can be, here does not give the command
At this point, the recovery of the server state is complete.
7. Bind the floating IP and connect to the network
Bind the virtual machine to a floating IP and then contact the network colleague to map the 80 port of the floating IP to the public IP.
6. Bind a cloud Drive
Since the IDE driver does not support hot-swappable, we will be able to set up the virtual machine, then the 400G size of the previously created hard disk 2, and then re-boot, operating on the interface can be, here does not give the command
At this point, the recovery of the server state is complete.
Some of the pits that VMware migrated to OpenStack