六、虚拟机的迁移(vmware 2 kvm) 1.安装软件 [root@target ~]# yum install -y virt-v2v.x86_64 [root@target ~]# rpm -ivh libguestfs-winsupport-1.0-7.el6.x86_64.rpm virtio-win-1.2.0-1.el6.noarch.rpm #虚拟机为windows时需要libguestfs-winsupport 包来支持 NTFS 文件系统和 virtio-win 包来支持 Windows para-virtualized 存储和网络设备驱动 2.创建 KVM 主机存储域(略) virt-v2v 在迁移虚拟机的过程中,需要拷贝被迁移虚拟机到 KVM 主机预先定义的存储池中。 3.创建 KVM 主机网络接口(略) 虚拟机在迁移之后将连接 KVM 主机网络, 因此主机必须有一个与之相匹配的网络接口,比如说网桥。 4.在 KVM 主机上创建或修改 $HOME/.netrc 文件,添加 VMware ESXi 服务器的用户名和密码。 [root@target ~]# cat ~/.netrc machine 192.168.2.251 login root password xxxxxx [root@target ~]# chmod 0600 ~/.netrc 5.Vmware ESXi到KVM的迁移 [root@target ~]# virt-v2v -ic esx://192.168.2.251/?no_verify=1 -op virhost -b br0 ipserver ** HEAD https://192.168.2.251/folder/tserver21/RHEL4.6-flat.vmdk?dcPath=ha-datacenter&dsName=ESX35-bak%3Astorage1 ==> 401 Unauthorized ** HEAD https://192.168.2.251/folder/tserver21/RHEL4.6-flat.vmdk?dcPath=ha-datacenter&dsName=ESX35-bak%3Astorage1 ==> 200 OK ** GET https://192.168.2.251/folder/tserver21/RHEL4.6-flat.vmdk?dcPath=ha-datacenter&dsName=ESX35-bak%3Astorage1 ==> 200 OK (2084s) unknown filesystem /dev/hda unknown filesystem /dev/fd0 virt-v2v: Installation failed because the following files referenced in the configuration file are required, but missing: rhel/4/kernel-smp-2.6.9-89.EL.i686.rpm virt-v2v: 非 virtio 驱动程序配置的 tserver21 #所有选项可通过配置文件/etc/virt-v2v.conf来指定 #-op:指定用于转换后的存储域(pool),virhost #-b:指定网络为网桥br0 #-ic:指定要转换的源地址 [root@target kvm_node]# virsh list --all Id 名称 状态 ---------------------------------- 1 node4 running - node5 关闭 - tserver21 关闭 - win8 关闭 [root@target kvm_node]# virsh start tserver21 6.KVM到KVM迁移 [root@target kvm_node]# virt-v2v -ic qemu+ssh://192.168.32.179/system -op virhost -b br0 node6 root@192.168.32.179's password: root@192.168.32.179's password: unknown filesystem label SWAP-vda3 virt-v2v: The connected hypervisor does not support a machine type of rhel5.4.0. It will be set to the current default. virt-v2v: virtio 驱动程序配置的 node6 [root@target kvm_node]# virsh list --all Id 名称 状态 ---------------------------------- 1 node4 running - node5 关闭 - node6 关闭 - tserver21 关闭 - win8 关闭 [root@target kvm_node]# virsh start node6 (责任编辑:IT) |