Kvm之十一:v2v迁移

Centos7 Kvm v2v迁移(都是在vm环境下,实验后面没有实现)

1、v2v迁移
#虚拟化迁移至虚拟化环境
#p2v迁移,是指物理机器迁移至虚拟化环境
#安装v2v迁移工具:yum install -y virt-v2v
#
2、KVM-KVM的v2v迁移
#KVM是采用Centos7,vm是采用oel6操作系统,始终报错
错误信息:
qemu-img: /var/tmp/v2vovl16ebce.qcow2: Could not open '/data/vmfs/c4_qcow2.img': No such file irectory
virt-v2v: error: qemu-img command failed, see earlier errors
If reporting bugs, run virt-v2v with debugging enabled and include the 
#新安装centos6操作系统测试,环境确认,两台KVM需要有相同的存储池位置,vmfspool
#node72检查
[root@node72 ~]# virsh pool-list
 名称               状态     自动开始
-------------------------------------------
 iso                  活动     是       
 oel1                 活动     是       
 vmfspool             活动     是       

[root@node72 ~]# 
#关闭需要迁移的虚拟机
[root@node72 ~]# virsh list --all
 Id    名称                         状态
----------------------------------------------------
 7     oel4                           running
 -     oel5                           关闭
[root@node72 ~]# virsh shutdown oel4
域 oel4 被关闭
[root@node72 ~]#
#测试KVM 自身vm迁移到自身,-oc是迁移出去,-on取另外一个名字,因为系统本身已经存在oel4这个实例
[root@node72 ~]# virt-v2v -oc qemu+ssh://192.168.2.110/system -os vmfspool -on centos4 -b br0 oel4
[   0.0] Opening the source -i libvirt oel4
[   0.0] Creating an overlay to protect the source from being modified
[   0.0] Opening the overlay
[  10.0] Initializing the target -o libvirt -oc qemu+ssh://192.168.2.110/system -os vmfspool
[email protected]'s password: 
[email protected]'s password: 
[email protected]'s password: 
[  17.0] Inspecting the overlay
[  24.0] Checking for sufficient free disk space in the guest
[  24.0] Estimating space required on target for each disk
[  24.0] Converting CentOS release 6.5 (Final) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[  69.0] Mapping filesystem data to avoid copying unused and blank areas
[  69.0] Closing the overlay
[  70.0] Checking if the guest needs BIOS or UEFI to boot
[  70.0] Copying disk 1/1 to /data/vmfs/centos4-sda (qcow2)
    (100.00/100%)
[  82.0] Creating output metadata
[email protected]'s password: 
池 vmfspool 被刷新
[email protected]'s password: 
定义域 centos4(从 /tmp/v2vlibvirt7142b4.xml)
[ 107.0] Finishing off
[root@node72 ~]#
#可以看到迁移的vm磁盘为/data/vmfs/centos4-sda (qcow2)
#检查,另外需要因为是迁移到自身测试,所以需要查看配置文件UUID,MAC地址,VNC端口,
[root@node72 ~]# virsh list --all
 Id    名称                         状态
----------------------------------------------------
 -     centos4                        关闭
 -     oel4                           关闭
 -     oel5                           关闭
[root@node72 ~]#
3、KVM之间的v2v迁移
#检查node71的迁移环境
[root@node71 ~]# virsh pool-list
 名称               状态     自动开始
-------------------------------------------
 iso                  活动     是       
 vmfspool             活动     是       

[root@node71 ~]# 
#测试迁移,从node72迁移出来
[root@node72 ~]# virt-v2v -oc qemu+ssh://192.168.2.111/system -os vmfspool  -b br0 oel4
[   0.0] Opening the source -i libvirt oel4
[   0.0] Creating an overlay to protect the source from being modified
[   0.0] Opening the overlay
[  10.0] Initializing the target -o libvirt -oc qemu+ssh://192.168.2.111/system -os vmfspool
[email protected]'s password: 
[email protected]'s password: 
[email protected]'s password: 
[  18.0] Inspecting the overlay
[  24.0] Checking for sufficient free disk space in the guest
[  24.0] Estimating space required on target for each disk
[  24.0] Converting CentOS release 6.5 (Final) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[  68.0] Mapping filesystem data to avoid copying unused and blank areas
[  69.0] Closing the overlay
[  69.0] Checking if the guest needs BIOS or UEFI to boot
[  69.0] Copying disk 1/1 to /data/vmfs/oel4-sda (qcow2)
    (100.00/100%)
[  80.0] Creating output metadata
[email protected]'s password: 
池 vmfspool 被刷新

[email protected]'s password: 
定义域 oel4(从 /tmp/v2vlibvirt255acc.xml)

[  86.0] Finishing off
[root@node72 ~]# 
#迁移完成
#检查测试,在运行迁移的vm之前,需要根据实际环境的情况来检查vm配置文件,确定是否按需修改
[root@node71 vmfs]# virsh list --all
 Id    名称                         状态
----------------------------------------------------
 -     oel2                           关闭
 -     oel3                           关闭
 -     oel4                           关闭
[root@node71 vmfs]# 
#可以查看到oel4已经迁移完成

#这是采用node72迁移出去的方式(-oc),但是在node71上采用迁移进来的方式(-ic)就会报错误
[root@node71 vmfs]# virt-v2v -ic qemu+ssh://192.168.2.110/system -os vmfspool -b br0 -on centos6 oel4
virt-v2v: warning: no support for remote libvirt connections to '-ic 
qemu+ssh://192.168.2.110/system'.  The conversion may fail when it tries to 
read the source disks.
[   0.0] Opening the source -i libvirt -ic qemu+ssh://192.168.2.110/system oel4
[email protected]'s password: 
[   2.0] Creating an overlay to protect the source from being modified
qemu-img: /var/tmp/v2vovl1c0ab2.qcow2: Could not open '/data/vmfs/c4_qcow2.img': No such file or directory
virt-v2v: error: qemu-img command failed, see earlier errors

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]
[root@node71 vmfs]# 
#暂时还不清楚,我们-ic一直会报"No such file or directory"
virt-v2v 命令帮助
[root@node71 iso]# virt-v2v --help
virt-v2v: convert a guest to use KVM

 virt-v2v -ic vpx://vcenter.example.com/Datacenter/esxi -os imported esx_guest

 virt-v2v -ic vpx://vcenter.example.com/Datacenter/esxi esx_guest -o rhev -os rhev.nfs:/export_domain --network rhevm

 virt-v2v -i libvirtxml guest-domain.xml -o local -os /var/tmp

 virt-v2v -i disk disk.img -o local -os /var/tmp

 virt-v2v -i disk disk.img -o glance

There is a companion front-end called "virt-p2v" which comes as an
ISO or CD image that can be booted on physical machines.

A short summary of the options is given below.  For detailed help please
read the man page virt-v2v(1).

  -b in:out                                   Map bridge 'in' to 'out'
  --bridge in:out                             -"-
  --debug-gc                                  Debug GC and memory allocations
  --dcpath path                               Override dcPath (for vCenter)
  --dcPath path                               -"-
  --debug-overlay                             Save overlay files
  --debug-overlays                            -"-
  -i disk|libvirt|libvirtxml|ova              Set input mode (default: libvirt)
  -ic uri                                     Libvirt URI
  -if format                                  Input format (for -i disk)
  --long-options                              List long options
  --machine-readable                          Make output machine readable
  -n in:out                                   Map network 'in' to 'out'
  --network in:out                            -"-
  --no-copy                                   Just write the metadata
  --no-trim all|mp,mp,..                      Don't trim selected mounts
  -o glance|libvirt|local|null|qemu|rhev|vdsm Set output mode (default: libvirt)
  -oa sparse|preallocated                     Set output allocation mode
  -oc uri                                     Libvirt URI
  -of raw|qcow2                               Set output format
  -on name                                    Rename guest when converting
  -os storage                                 Set output storage location
  --password-file file                        Use password from file
  --print-source                              Print source and stop
  --qemu-boot                                 This option cannot be used in RHEL
  -q                                          Quiet output
  --quiet                                     -"-
  --root ask|...                              How to choose root filesystem
  --vdsm-image-uuid uuid                      Output image UUID(s)
  --vdsm-vol-uuid uuid                        Output vol UUID(s)
  --vdsm-vm-uuid uuid                         Output VM UUID
  --vdsm-ovf-output                           Output OVF file
  -v                                          Enable debugging messages
  --verbose                                   -"-
  -V                                          Display version and exit
  --version                                   -"-
  --vmtype server|desktop                     Set vmtype (for RHEV)
  -x                                          Enable tracing of libguestfs calls
  -help                                       Display this list of options
  --help                                      Display this list of options

你可能感兴趣的:(Kvm之十一:v2v迁移)