使用virt-p2v工具将物理机迁移到Openstack虚拟机中
本文由guwenwu写于2012年8月14日,转载请注明出处
摘要:本文对virt-p2v工具的安装和使用进行了阐述,并成功的使用virt-p2v工具将一台物理机迁移到了Openstack中。
本文环境:host A: I10.28.170.93 8core 16GB 1TB Centos6.2 运行Openstack所有服务,虚拟软件为kvm host B: VM 1Core 512M 8G Centos6.3virt-v2v和virt-p2v是Redhat开发的开源虚拟机迁移工具,Red Hat EnterpriseLinux 6包含这个包,目前最新版本为virt-v2v-v0.8.8.tar.gz virt-p2v也包含在包中。2.2 在host A上安装virt-p2v
下载安装包后 tar -xzvfvirt-v2v-v0.8.8.tar.gz cd virt-v2v-v0.8.8 ./autobuild.sh 或直接使用yum安装 yum install virt-v2v
3.2 修改/etc/virt-v2v.conf vi/etc/virt-v2v.conf 文件中的内容都被注释了,将所有的注释去掉! 并修改文件内容<profile name="libvirt"> <method>libvirt</method> <storage>default</storage> <network type="default"> <network type="network" name="default"/> </network> </profile>为
<profile name="libvirt"> <method>libvirt</method> <storage>kvm-storage-pool</storage> <network type="default"> <network type="network" name="default"/> </network> </profile>3.3 运行virt-p2v-server
3.4 制作virt-p2v客户端镜像的usb启动盘 挂载virt-p2v镜像 mount -o loop /usr/share/virt-p2v/virt-p2v-0.8.6-5.20120502.1.el6.centos.iso /mnt cd /mnt/LiveOS/ 在host A上插一个U盘,设备名为/dev/sdb,运行 ./livecd-iso-to-disk /usr/share/virt-p2v/virt-p2v-0.8.6-5.20120502.1.el6.centos.iso /dev/sdb 将启动镜像写入到U盘中。 3.5 利用U盘启动host B
系统会自动识别网卡(仅限于有线网卡),如果接入的网络有DHCP功能则可以自动获取IP否则,自己设置网络


cd/virhostqemu-img convert -f raw -O qcow2test-p2v-sda test-p2v-sda_qcow2将虚拟磁盘转换为qcow2格式 glance add disk_format=qcow2 container_format=ovf name=winxp is_public=True<test-p2v-sda_qcow2 上传镜像,然后在Dashbord用这个镜像生成Instance,P2V完成!