#KVM是采用Centos7,vm是采用oel6操作系統(tǒng)爵卒,始終報(bào)錯(cuò)
錯(cuò)誤信息:
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操作系統(tǒng)測試,環(huán)境確認(rèn)撵彻,兩臺(tái)KVM需要有相同的存儲(chǔ)池位置钓株,vmfspool
#node72檢查
[root@node72 ~]# virsh pool-list
名稱 狀態(tài) 自動(dòng)開始
-------------------------------------------
iso 活動(dòng) 是
oel1 活動(dòng) 是
vmfspool 活動(dòng) 是
[root@node72 ~]#
#關(guān)閉需要遷移的虛擬機(jī)
[root@node72 ~]# virsh list --all
Id 名稱 狀態(tài)
----------------------------------------------------
7 oel4 running
- oel5 關(guān)閉
[root@node72 ~]# virsh shutdown oel4
域 oel4 被關(guān)閉
[root@node72 ~]#
#測試KVM 自身vm遷移到自身,-oc是遷移出去陌僵,-on取另外一個(gè)名字轴合,因?yàn)橄到y(tǒng)本身已經(jīng)存在oel4這個(gè)實(shí)例
[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
root@192.168.2.110's password:
root@192.168.2.110's password:
root@192.168.2.110'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
root@192.168.2.110's password:
池 vmfspool 被刷新
root@192.168.2.110's password:
定義域 centos4(從 /tmp/v2vlibvirt7142b4.xml)
[ 107.0] Finishing off
[root@node72 ~]#
#可以看到遷移的vm磁盤為/data/vmfs/centos4-sda (qcow2)
#檢查,另外需要因?yàn)槭沁w移到自身測試碗短,所以需要查看配置文件UUID,MAC地址受葛,VNC端口,
[root@node72 ~]# virsh list --all
Id 名稱 狀態(tài)
----------------------------------------------------
- centos4 關(guān)閉
- oel4 關(guān)閉
- oel5 關(guān)閉
[root@node72 ~]#
3偎谁、KVM之間的v2v遷移
#檢查node71的遷移環(huán)境
[root@node71 ~]# virsh pool-list
名稱 狀態(tài) 自動(dòng)開始
-------------------------------------------
iso 活動(dòng) 是
vmfspool 活動(dòng) 是
[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
root@192.168.2.111's password:
root@192.168.2.111's password:
root@192.168.2.111'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
root@192.168.2.111's password:
池 vmfspool 被刷新
root@192.168.2.111's password:
定義域 oel4(從 /tmp/v2vlibvirt255acc.xml)
[ 86.0] Finishing off
[root@node72 ~]#
#遷移完成
#檢查測試,在運(yùn)行遷移的vm之前搭盾,需要根據(jù)實(shí)際環(huán)境的情況來檢查vm配置文件,確定是否按需修改
[root@node71 vmfs]# virsh list --all
Id 名稱 狀態(tài)
----------------------------------------------------
- oel2 關(guān)閉
- oel3 關(guān)閉
- oel4 關(guān)閉
[root@node71 vmfs]#
#可以查看到oel4已經(jīng)遷移完成
#這是采用node72遷移出去的方式(-oc),但是在node71上采用遷移進(jìn)來的方式(-ic)就會(huì)報(bào)錯(cuò)誤
[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
root@192.168.2.110'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]#
#暫時(shí)還不清楚婉支,我們-ic一直會(huì)報(bào)"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