Centos7下通过virt-p2v虚拟化windows Server 2008R2

来源:互联网 发布:沈阳网络代运营 编辑:程序博客网 时间:2024/05/21 19:25

环境说明

virt-p2v:Centos7.2

virt-p2v client:Windows Server 2008 R2

virt-p2v version:1.28.1

virt-v2v version:1.28.1

配置说明

         在windows server 2008r2下的虚拟化转换工作与Centos7下通过virt-p2v虚拟化Centos7服务器步骤相同,只是windows server 2008 R2不支持virtio,在windows下需要

另行添加virtio驱动,在windows下virtio驱动主要是网卡以及硬盘的驱动,这里我们需要virtio-win.iso文件,这个可以在百度里面去找到。下面我们来看看如何进行修改。


       我们首先看看在进行p2v完成后,同样会形成一个xml文件,如下

<!--WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BEOVERWRITTEN AND LOST. Changes to this xml configuration should be made using:  virsh edit windows2008-vmwareor other application using the libvirt API.--><domain type='kvm'>  <name>windows2008-vmware</name>  <uuid>2977ef26-f7e7-4cbc-a264-0f4bad58d980</uuid>  <memory unit='KiB'>4194304</memory>  <currentMemory unit='KiB'>4194304</currentMemory>  <vcpu placement='static'>1</vcpu>  <os>    <type arch='x86_64' machine='pc-i440fx-rhel7.2.0'>hvm</type>    <boot dev='hd'/>  </os>  <features>    <acpi/>    <apic/>  </features>  <clock offset='utc'/>  <on_poweroff>destroy</on_poweroff>  <on_reboot>restart</on_reboot>  <on_crash>restart</on_crash>  <devices>    <emulator>/usr/libexec/qemu-kvm</emulator>    <disk type='volume' device='disk'>      <driver name='qemu' type='raw' cache='none'/>      <source pool='pool-1' volume='windows2008-vmware-sda'/>      <target dev='hda' bus='ide'/>      <address type='drive' controller='0' bus='0' target='0' unit='0'/>    </disk>    <disk type='file' device='cdrom'>      <driver name='qemu' type='raw'/>      <source file='/root/virtio-win-1.7.2.iso'/>      <target dev='hdb' bus='ide'/>      <readonly/>      <address type='drive' controller='0' bus='0' target='0' unit='1'/>    </disk>    <controller type='usb' index='0'>      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>    </controller>    <controller type='pci' index='0' model='pci-root'/>    <controller type='ide' index='0'>      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>    </controller>    <interface type='network'>      <mac address='00:0c:29:42:28:bd'/>      <source network='vdsm-ovirtmgmt'/>      <model type='rtl8139'/>      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>    </interface>    <serial type='pty'>      <target port='0'/>    </serial>    <console type='pty'>      <target type='serial' port='0'/>    </console>    <input type='tablet' bus='usb'/>    <input type='mouse' bus='ps2'/>    <input type='keyboard' bus='ps2'/>    <graphics type='vnc' port='-1' autoport='yes'/>    <video>      <model type='cirrus' vram='16384' heads='1'/>      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>    </video>    <memballoon model='virtio'>      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>    </memballoon>  </devices></domain>

我们可以看见其中硬盘以及网卡的总线都是IDE总线,硬盘hda是系统盘,如果这里修改为virtio总线的话,那么系统就无法找到启动盘,无法进行启动,所以我们只能在新添加

的硬盘里面使用virtio,以及修改网卡的总线为virtio总线。

首先我们进入虚拟化完成的windows server 2008 r2中看看设备管理器中网卡及硬盘:




因为系统盘我们无法修改驱动,所以我们先修改网卡的总线为virtio,编辑xml内容如下

 <interface type='network'>      <mac address='00:0c:29:42:28:bd'/>      <source network='vdsm-ovirtmgmt'/>      <model type='virtio'/>      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>    </interface>

重启vm后,我们可以查看到需要新添加网卡驱动。

我们将下载好的virtio-win.iso文件添加至vm中

#virsh attach-disk windows2008-vmware /root/virtio-win-1.7.2.iso hdb --sourcetype block --driver qemu --subdriver raw --type cdrom

更新驱动在/NetKVM/2k8R2/amd64目录下可以找到该驱动,安装完成驱动后,我们可以看见网卡驱动已经变为virtio的驱动了



下面我们来添加新硬盘为virtio总线的

首先创建img文件

#qemu-img create disk2.img -f qcow2 -s 20G

添加以下内容至xml文件中:

<disk type='file' device='disk'>      <driver name='qemu' type='raw' cache='none'/>      <source file='/home/disk2.img'/>      <target dev='vda' bus='virtio'/>      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>    </disk>

或者执行

#virsh attach-disk windows2008 /home/disk2.img vda

这时候我们重启vm,会提示新添加scsi驱动,我们选择virstor/2k8R2/amd64内的驱动进行安装后,如下图所示,就出现了virtio的scsi控制器以及硬盘








0 0
原创粉丝点击