Some pits in the migration of vmware to openstack


title: Security Platform Migration
tags: new, template, little
bookmaker grammar_cjkRuby: true
---

foreword

There are three main pits:

  • First, if the original virtual machine does not have the virtio driver installed, set the device driver to ide,
  • The second is that cinder needs to configure the value of glance_api_version to v2, and the uploaded image needs to be in raw format
  • Third, it is best to keep the ip and host name unchanged before and after the migration, so that the impact on the business is minimal.

basic information

Give us the following file:
anquanpingtai-win2008r2-10.100.100.110.ova

After decompression, we get:
anquanpingtai-win2008r2_10.100.100.110-disk1.vmdk
anquanpingtai-win2008r2_10.100.100.110-disk2.vmdk
anquanpingtai-win2008r2 10.101.100.110.mf
anquanpingtai-win2008r2.ov.ff

We use anquanpingtai-win2008r2 as the hostname, 10.100.100.110

Migration steps

1. Check the image size

View the information of the vmdk image, the virtual size of image 1 and image 2 is 100Gb, 400Gb

[root@ha01-mon02-osd01 ~]# qemu-img info anquanpingtai-win2008r2_10.100.100.110-disk1.vmdk 
image: anquanpingtai-win2008r2_110.100.100.110-disk1.vmdk
file format: vmdk
virtual size: 100G (107374182400 bytes)
disk size: 14G
cluster_size: 65536
Format 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
            format: 

2. Upload the image to openstack

Although openstack supports images in vmdk format, ceph only supports virtual disks in raw format, so we need to convert the image to raw format in advance and upload it to save time.

qemu-img convert -f  vmdk  -O raw ./anquanpingtai-win2008r2_10.100.100.110-disk1.vmdk  ./anquanpingtai_disk1

qemu-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
 ```
因为vmware过来的镜像没有安装virtio驱动,所以我们要设置镜像的磁盘驱动为ide,网卡驱动为e1000,这样子虚拟机的性能差一些,所以如果有条件的话,最好在迁移之前把虚拟机virtio的网卡和磁盘驱动安装好

openstack image set --property hw_disk_bus=ide --property hw_vif_model=e1000 anquanpingtai_disk1
openstack image set --property hw_disk_bus=ide --property hw_vif_model=e1000 anquanpingtai_disk2
```

3. Use the image as the source to create a cloud disk

If the disk format of the image is raw, and the API version used by cinder to access glance is v2, when creating a cloud disk with the image as the source, cinder supports direct rbd clone image file to copy the image file and create a cloud disk. Otherwise, cinder needs to download the image to the local file system, convert it to raw format, and upload it to ceph. When the image file is large, this process often fails due to timeout.

So we need to modify the glance_api_version of the cinder.conf service to v2, and then restart the cinder-volume service.

Use these two images in the previous step to create cloud hard disks, the size is 100G and 400G, and the ids are recorded as VOLUME1_ID, VOLUME2_ID respectively

4. Create a migration network

It is best to keep the ip of the virtual machine unchanged before and after the migration, which can avoid many unknown problems.
According to the information given by the 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 external network through this network, so this network can be of any type, vlan, vxlan, flat, as long as it contains these two ips, so it can be created directly on the interface, no command is given here, it will be created The network id is recorded as $MIG_NET_ID

5. Create a virtual machine

Assuming we have completed the above steps, create a virtual machine with the following command and specify the ip

nova boot --flavor 4 --block-device source=volume,dest=volume,id=$VOLUME1_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 the cloud disk

Since the IDE driver does not support hot swapping, we need to shut down the virtual machine, and then restart the 400G hard disk 2 created before, and then restart it. It can be operated on the interface. No command is given here.

At this point, the recovery of the server state is complete.

7. Bind the floating IP and connect to the network

Bind a floating ip to this virtual machine, and then contact colleagues in the network department to map the 80 port of the floating ip to the public network ip.
anquanpingtai-win2008r2

[enter description here][1]

6. Bind the cloud disk

Since the IDE driver does not support hot swapping, we need to shut down the virtual machine, and then restart the 400G hard disk 2 created before, and then restart it. It can be operated on the interface. No command is given here.

At this point, the recovery of the server state is complete.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324972252&siteId=291194637