操作环境
ovirt 4.0
virt-v2v 1.28
Centos 7
操作说明
现有一台kvm宿主机10.10.200.227,上面有通过libvirt管理的多台vm,需要将上面的一台Centos 7 guest主机迁移至ovirt虚拟化平台中。
ovirt环境说明:
ovirt-engine:10.10.200.229
ovirt-host:10.10.200.228
ovirt-storage:10.10.200.43,这里使用的nfs存储,export存储路径为10.10.200.43:/home/nfs
操作步骤
1.配置ovirt的export存储域
在ovirt-engine中新建export的存储域
2.查看kvm宿主主机中的vm,并选择一台vm进行迁移
[root@ovirt-host-227 ~]# virsh list --all
Id Name State
----------------------------------------------------
2 windows2008 running
- Centos7 shut off
- Centos7-2 shut off
- windows2003 shut off
- windows2008-1 shut off
- windows2008-vmware shut off
在这里我们选择Centos7这台vm进行迁移,在迁移需要在宿主服务器上安装virt-v2v
#yum -y install virt-v2v
下面我们通过virt-v2v进行迁移Centos7这台vm,-os参数后面的存储路径为前面配置的export存储域的存储路径,--network的参数为vnet,ovirt中的vnet名称一般都为ovirtmgmt
[root@ovirt-host-227 ~]# virt-v2v -i libvirt -o rhev -os 10.10.200.43:/home/nfs --network ovirtmgmt Centos7
[ 0.0] Opening the source -i libvirt Centos7
[ 0.0] Creating an overlay to protect the source from being modified
[ 0.0] Opening the overlay
[ 5.0] Initializing the target -o rhev -os 10.10.200.43:/home/nfs
[ 5.0] Inspecting the overlay
[ 18.0] Checking for sufficient free disk space in the guest
[ 18.0] Estimating space required on target for each disk
[ 18.0] Converting CentOS Linux release 7.2.1511 (Core) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 56.0] Mapping filesystem data to avoid copying unused and blank areas
[ 58.0] Closing the overlay
[ 58.0] Checking if the guest needs BIOS or UEFI to boot
[ 58.0] Copying disk 1/1 to /tmp/v2v.jXKwCN/3dfea236-3b8a-4da8-b8bf-fae9768045e4/images/c271532e-d60e-41f1-b577-bf7f0cdf9533/819dbc8a-37c7-432e-a36f-539d39bf879e (qcow2)
(100.00/100%)
[ 104.0] Creating output metadata
[ 104.0] Finishing off
3,数据迁移完成后,我们在ovirt-engine中将vm添加至ovirt中
在添加完成后,可以在ovirt-engine的虚拟机这一栏,看见Centos7名称的vm,
在刚刚添加的时候,vm处于import状态,需要等一段时间,待日志提示已经imported success后,我们可以启动该vm,第一次启动相对耗时较长,待vm启动后,可以查看的为
up状态