1.ESXi到KVM之v2v情况说明
(1).配置任务列表:
1)VMwareESXi虚拟平台下linux系统迁移到KVM虚拟平台。
2)VMwareESXi虚拟平台下windows系统迁移到KVM虚拟平台。
提示:本文只介绍以上两种迁移过程,KVM到ESXi之v2v可以采用VMwareconvert工具进行迁移。
(2).VMwareESXi6.0及虚拟机情况说明
VMwareESXi6.0
IP地址:192.168.21.222
帐号:root/123456
(3).CentOS7.2是采用CentOS7.2x86_64虚拟机,IP地址:192.168.21.221
(4).kvm虚拟平台配置注意项,KVM存储池配置简要过程
1
2
3
4
5
|
# mkdir -p /data/vmfs # virsh pool-define-as vmdisk --type dir --target /data/vmfs # virsh pool-build vmdisk # virsh pool-autostart vmdisk # virsh pool-start vmdisk |
2.VMwareESXi虚拟平台下linux系统迁移到KVM虚拟平台
(1)KVM虚拟机配置,创建esxi认证文件
1
2
3
4
|
[root@node1 ~] # cat .netrc
machine 192.168.21.222 login root password 3dmedcom [root@node1 ~] #
[root@node1 ~] # chmod 0600 ~/.netrc
|
被迁移的虚拟机必须为关机状态,否则会出现如下提示。
1
2
|
[root@node1 ~] # virt-v2v -ic esx://192.168.21.222/?no_verify=1 -op vmdisk -b br0 CentOS7.2
virt-v2v: Guest CentOS7.2 is currently running. It must be shut down first. |
(2)开始迁移
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
[root@node1 ~] # virt-v2v -ic esx://192.168.21.222/?no_verify=1 -op vmdisk -b br0 CentOS7.2
CentOS7.2_CentOS7.2: 100% [==================================================================================]D 1h46m33s virt-v2v: No capability in config matches os= 'linux' name= 'virtio' distro= 'centos' major= '7' minor= '2'
virt-v2v: CentOS7.2 configured without virtio drivers. [root@node1 ~] #
[root@node1 ~] # virsh list --all
Id Name State
---------------------------------------------------- - CentOS6.5-01 shut off
- CentOS7.2 shut off
- Ser08R2-01 shut off
[root@node1 ~] # ll -h /data/vmfs/
total 53G -rw-r--r-- 1 root root 384K Nov 22 17:06 CentOS6.5-01_add.qcow2 -rw-r--r-- 1 root root 2.2G Nov 28 09:53 CentOS6.5-01.qcow2 -rw------- 1 root root 50G Nov 28 13:08 CentOS7.2_CentOS7.2 [root@node1 ~] #
[root@node1 ~] # virsh start CentOS7.2
Domain CentOS7.2 started [root@node1 ~] # virsh list --all
Id Name State
---------------------------------------------------- 7 CentOS7.2 running
- CentOS6.5-01 shut off
- Ser08R2-01 shut off
[root@node1 ~] #
|
查看配置文件,磁盘格式是raw格式,磁盘文件名为如下格式。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
[root@node1 ~] # virsh dumpxml CentOS7.2
<domain type = 'kvm' id = '7' >
<name>CentOS7.2< /name >
<uuid>37039346-b5a7-63dd-a87c-22300697c483< /uuid >
<memory unit= 'KiB' >524288< /memory >
<currentMemory unit= 'KiB' >524288< /currentMemory >
<vcpu placement= 'static' >1< /vcpu >
<os>
< type arch= 'x86_64' machine= 'rhel6.6.0' >hvm< /type >
<boot dev= 'hd' />
< /os >
<features>
<acpi/>
<apic/>
< /features >
<clock offset= 'utc' />
<on_poweroff>destroy< /on_poweroff >
<on_reboot>restart< /on_reboot >
<on_crash>restart< /on_crash >
<devices>
<emulator> /usr/libexec/qemu-kvm < /emulator >
<disk type = 'file' device= 'disk' >
<driver name= 'qemu' type = 'raw' cache= 'none' />
< source file = '/data/vmfs/CentOS7.2_CentOS7.2' />
<target dev= 'hda' bus= 'ide' />
< alias name= 'ide0-0-0' />
<address type = 'drive' controller= '0' bus= '0' target= '0' unit= '0' />
< /disk >
|
登录控制台查看迁移的虚拟机IP地址并更改
ssh登录正常
\
3.VMwareESXi虚拟平台下windows系统迁移到KVM虚拟平台
(1)KVM虚拟主机上需要安装支持windows文件系统与驱动的支持,需要安装如下支持包,下载地址。
libguestfs-winsupport-1.0-7.el6.x86_64.rpm
virtio-win-1.2.0-1.el6.noarch.rpm
http://remoteoutpost.nl/repos/RHEL6-Server-Supplementary/virtio-win-1.2.0-1.el6.noarch.rpm
(2)开始迁移
1
2
|
[root@node1 ~] # virt-v2v -ic esx://192.168.21.222/?no_verify=1 -op vmdisk -b br
0 Ser08R2-01 |
通过管理器中查看,系统启动正常。
查看设备管理器,发现磁盘驱动与网卡驱动都进行了优化。
到此ESXi虚拟机到KVM迁移过程完毕。反过来的话就需要采用VMware的迁移工具进行迁移了。
本文转自 dengaosky 51CTO博客,原文链接:http://blog.51cto.com/dengaosky/2045068,如需转载请自行联系原作者