#冲刺创作新星# Migrate VMware to OLVM 原创
vSphere to OLVM(v2v Not Support)
不支持单机ESXi,需受管vCenter进行迁移
迁移前准备
针对ESXi 6.7下的test-win01进行迁移。
目标KVM主机安装所需组件
[root@ol7-kvm01 ~]# yum install oraclelinux-developer-release-el7 yum-utils -y
[root@ol7-kvm01 ~]# yum-config-manager --enable ol7_developer_kvm_utils
[root@ol7-kvm01 ~]# yum install qemu-block-curl -y
拷贝OLVM证书到KVM服务器
[root@ol7-kvm01 ~]# scp 192.168.137.51:/etc/pki/ovirt-engine/ca.pem /root/v2v/ca.pem
生成用于连接OLVM API及ESXi的密码文件
[root@ol7-kvm01 ~]# echo "P@ss0lvm" > /root/v2v/ovirt-admin-password
[root@ol7-kvm01 ~]# echo "<vmware-admin-password>" > /root/v2v/vmware-admin-password
连接测试
KVM主机连接测试(连接到VMware EXS driver)
# virsh -c vpx:// vsphere-domain>%5c<vsphere-user>@<vsphere-host>/Datacenter//<vsphere-datacenter-name>?no_verify=1 list –all
vpx://example-vcenter.com/dc1/srv1 (VPX over HTTPS, select ESX server 'srv1' in datacenter 'dc1')
esx://example-esx.com (ESX over HTTPS)
gsx://example-gsx.com (GSX over HTTPS)
esx://example-esx.com/?transport=http (ESX over HTTP)
esx://example-esx.com/?no_verify=1 (ESX over HTTPS, but doesn't verify the server's SSL certificate)
Example:
关闭需迁移主机
迁移过程需对test-win01关机操作
开始迁移
export LIBGUESTFS_BACKEND=direct
# virt-v2v -ic vpx://<vsphere-domain>%5c<vsphere-user>@<vsphere-host>/Datacenter/<vsphere-datacenter-name>?no_verify=1 <vm-name> --password-file /root/v2v/vmware-admin-password -o rhv-upload -oc https://<olvm-fqdn-host>/ovirt-engine/api -os <olvm-storage-domain> -op /root/v2v/ovirt-admin-password -oo rhv-cafile=/root/v2v/ca.pem -oo rhv-cluster=<olvm-cluster-name> -of raw -oo rhv-direct --bridge <olvm-bridge-name>
Example:
[root@ol7-kvm01 ~]# cat /etc/hosts
192.168.137.51 ol7-olvm
192.168.137.61 ol7-kvm01
[root@ol7-kvm01 ~]# export LIBGUESTFS_BACKEND=direct
[root@ol7-kvm01 ~]# virt-v2v -ic esx://root@172.19.201.1?no_verify=1 test-win01 --password-file /root/v2v/vmware-admin-password -o rhv-upload -oc https://ol7-olvm/ovirt-engine/api -os vmware-data -op /root/v2v/ovirt-admin-password -oo rhv-cafile=/root/v2v/ca.pem -oo rhv-cluster="Default" -of raw -oo rhv-direct --bridge ovirtmgmt -oa preallocated
迁移失败(不支持单机ESXi,需受管vCenter进行迁移)
https://libguestfs.org/virt-v2v-support.1.html
vSphere to OLVM (convert ova to raw)
关闭需迁移主机
针对ESXi 6.7下的test-win01进行迁移。(需关机状态)
下载安装OVF Tool
由于无法直接从Web Client导出ovf文件,VMware提供了ovf工具来实现ova档的汇出
https://my.vmware.com/group/vmware/downloads/details?productId=614&downloadGroup=OVFTOOL420
以下将在linux环境导出ESXi VM主机ova文件,也可下载windows版本在cmd下进行导出
将安装文件上传到Linux主机,并执行安装
[root@ol7-kvm01 vmware]# chmod +x VMware-ovftool-4.2.0-5965791-lin.x86_64.bundle
[root@ol7-kvm01 vmware]# ./VMware-ovftool-4.2.0-5965791-lin.x86_64.bundle
Example:
导出ova文件
[root@ol7-kvm01 vmware]# ovftool vi://root@172.19.201.1/test-win01 test-win01.ova
转换ova为raw格式
[root@ol7-kvm01 vmware]# qemu-img convert -O raw test-win01-disk1.vmdk test-win01.img
上传img文件
上传完成
创建VM
附加对应img文件,“Interface”调整为“IDE”
按需调整Cpu Mem等规格
启动验证
打开“Compute”- “Virtual Machines”启动vm主机
打开Console查看启动过程
Windows主机需下载virt-viewer-x64-10.0-1.0.exe进行安装方能连接到Console
至此迁移完成
VMware vSphere下linux主机迁移过程亦同