virt-v2v 使用指南

virt-v2v 使用指南

1.定义.

virt-v2v将外部的虚拟化平台上的虚拟机转化到可以运行的KVM平台上。它可以读取在VMware、Xen运行Hyper-V和其他虚拟机管理程序上的Windows和Linux的虚拟机,并将其转换为KVM的libvirt,OpenStack,oVirt管理,红帽虚拟化(RHV)等几种方式。

2.基本转化图

                          ┌────────────┐  ┌─────────▶ -o null
 -i disk ────────────┐    │            │ ─┘┌───────▶ -o local
 -i ova  ──────────┐ └──▶ │ virt-v2v   │ ──┘┌───────▶ -o qemu
                   └────▶ │ conversion │ ───┘┌────────────┐
 VMware─▶┌────────────┐   │ server     │ ────▶ -o libvirt │─▶ KVM
 Xen ───▶│ -i libvirt ──▶ │            │     │  (default) │
 ... ───▶│  (default) │   │            │ ──┐ └────────────┘
         └────────────┘   │            │ ─┐└──────▶ -o glance
 -i libvirtxml ─────────▶ │            │ ┐└─────────▶ -o rhv
                          └────────────┘ └──────────▶ -o vdsm


3.安装

(主机是centos7.2系统)
3.1 KVM 需要有 CPU 的支持(Intel vmx或 AMD svm),在安装 KVM 之前检查一下 CPU 是否提供了虚拟技术的支持:
# egrep'^flags.*(vmx|svm)' /proc/cpuinfo
有显示, 有显示则说明处理器具有VT功能,在主板BIOS中开启CPU的Virtual Technolege(VT,虚化技术)
3.2 安装kvm及其需要的软件包
# yum installkvm kmod-kvm qemu kvm-qemu-img virt-viewer virt-manager libvirt libvirt-pythonpython-virtinst
或# yumgroupinstall KVM
检查kvm模块是否安装,使用以下命令显示两个模块则表示安装完成
# lsmod | grepkvm

3.3 安装irt-v2v
#yum installvirt-v2v


4.基本参数语法

-i libvirt 读取本地libvirt的资源。当然libvirt 可以连接多中虚拟化平台的资源,比如Vmware,Xen,或者其他的。当连接外部的虚拟化平台时使用 -ic 。
-i libvirtxml  读取libvirt 的XML文件。
-i ova 是读取VMware的ova 文件。
-o glance 是输出到 OpenStack Glance.
-o libvirt 可以输出到任意的libvirt 目标,可以连接本地的和远端的kvm虚拟化平台。使用-oc 到远端。
-o local 输出到本地的磁盘镜像和一个配置文件。(一般也不用)
-o qemu 和local比较像,一般也不用。
-o rhv  输出到rhv平台上。
  -o vdsm 只是用来当 virt-v2v 在VDSM的运行控制下(基本不用).
--in-place instructs virt-v2v to customize the guest OS in the input virtual machine, instead of creating a new VM in the target hypervisor.

5.支持的平台和虚拟机类型。

VMware ESXi >=5.0
OVA exported from VMware
OVAs from other hypervisors will not work.
SUSE Xen
Citrix Xen
Citrix Xen has not been recently tested.
Hyper-V(不一定好使)
从本地但是这个images必须支持虚拟化,并且格式是qemu支持的。
物理机器:
使用 virt-p2v
Virtualization management systems (Output)
OpenStack Glance
Red Hat Virtualization (RHV) 4.1 and up
Local libvirt
And hence virsh(1), virt-manager(1), and similar tools.
Local disk
Red Hat Enterprise Linux 3, 4, 5, 6, 7
CentOS 3, 4, 5, 6, 7
Scientific Linux 3, 4, 5, 6, 7
Oracle Linux
Fedora
SLES 10 and up
OpenSUSE 10 and up
Windows XP to Windows 10 
Currently NT 5.2 to NT 6.3 are supported.
虚拟机固件
BIOS or UEFI for all guest types

6.简单操作的实例。

1:从VMware vcenter server 到本地libvirt。

首先需要有一个VMware vcenter server 然后设置好Datacenter。

virt-v2v -ic vpx://vcenter.example.com/Datacenter/esxi vmware_guest
转换后是在本地/var/lib/libvirt/images

2:从VMware vcenter server 到RHV/ovirt.

首先确保Vmware 和 RHV 平台配置运行正常。(关于RHV的有其他章节介绍)

 virt-v2v -ic vpx://vcenter.example.com/Datacenter/esxi vmware_guest 
   -o rhv -os rhv.nfs:/export_domain --network rhvm
3:从本地到OpenStack glance。

(现在仅仅支持从kvm本地到openstack)

virt-v2v -i disk disk.img -o glance
4:从本地到本地。(比较简单,实现方式也比较多,注意改名字)

virt-v2v -i disk disk.img -o local -os /var/tmp
virt-v2v -i libvirtxml guest-domain.xml -o local -os /var/tmp
virt-v2v -i disk disk.img -o qemu -os /var/tmp --qemu-boot




原文地址:https://www.cnblogs.com/weikunzz/p/6710537.html