KVM下virtio驱动虚拟机XML配置文件分析

[root@opennebula qemu]# pwd

/etc/libvirt/qemu

[root@opennebula qemu]# ls

networks  one-12.xml  one-12.xml_bak  one-13.xml  one-14.xml  one-2.xml  one-5.xml  one-6.xml  one-7.xml  one-8.xml  one-9.xml

[root@opennebula qemu]# virsh dumpxml one-14

<domain type='kvm' id='20'>                             /*定义类型为kvm和虚拟机ID*/

  <name>one-14</name>                           /*虚拟机名称*/

  <uuid>9bde61c4-7d43-dcca-5da6-0be1bf9285d9</uuid>                       /*uuid由系统自动生成,uuid唯一*/

  <memory unit='KiB'>1048576</memory>                               /*为虚拟机分配的最大内存量*/

  <currentMemory unit='KiB'>1048576</currentMemory>                     /*虚拟机可使用的内存配额,不得大于虚拟机的最大内存量*/

  <vcpu placement='static'>4</vcpu>                       /*为虚拟机分配的VCPU数量*/

  <cputune>

    <shares>205</shares>               /*为虚拟机分配的CPU配额,该值为VCPU占用时间片的量,最小为12(1%)最大为1024(100%)*/

  </cputune>

  <os>

    <type arch='x86_64' machine='rhel6.4.0'>hvm</type>           /*虚拟机架构(x86_64orX86_i686),宿主机操作系统*/

    <boot dev='hd'/>                     /*启动设备,可以为多个*/             

  </os>

  <features>

    <acpi/>                  /*处理器特性*/

  </features>

  <clock offset='utc'/>                   /*时钟,虚拟机使用UTC时钟*/

  <on_poweroff>destroy</on_poweroff>                   /*关闭虚拟机*/

  <on_reboot>restart</on_reboot>                   /*重启虚拟机*/

  <on_crash>destroy</on_crash>

  <devices>                   /*开始定义设备*/

    <emulator>/usr/bin/kvm</emulator>                            /*虚拟机调用的kvm程序*/

    <disk type='file' device='disk'>                            /*加载磁盘*/

      <driver name='qemu' type='qcow2'/>                            /**/

      <source file='/srv/cloud/one/var//datastores/0/14/disk.0'/>                            /*加载第一个磁盘*/

      <target dev='hda' bus='virtio'/>                            /*硬盘驱动器使用virtio驱动*/

      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>               /*硬盘使用virtio驱动后识别为pci总线*/

    </disk>

    <disk type='file' device='cdrom'>                                                                         /*加载光驱*/     

      <driver name='qemu' type='raw'/>

      <source file='/srv/cloud/one/var//datastores/win2k3.iso'/>

      <target dev='hdb' bus='ide'/>

      <readonly/>                                                                    /*光驱为只读*/ 

      <address type='drive' controller='0' bus='0' unit='1'/>

    </disk>

    <controller type='usb' index='0'>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>

    </controller>

    <controller type='ide' index='0'>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>

    </controller> 

    <interface type='bridge'>                            /*网络接口类型为桥接*/

      <mac address='02:00:c0:a8:64:a0'/>                            /*MAC地址*/

      <source bridge='vSwitch'/>                            /*桥接的网卡*/

     <model type='virtio'/>                             /*使用virtio模式,网卡工作速率为1000M*/

      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>

    </interface>                            /*鼠标类型*/

    <input type='mouse' bus='usb'>

    <input type='mouse' bus='ps2'/>

    <graphics type='vnc' port='5914' autoport='no' listen='0.0.0.0'  passwd='123456'>                            /*VNC连接配置*/

      <listen type='address' address='0.0.0.0'/>

    </graphics>

    <video>

      <model type='cirrus' vram='9216' 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>

  <seclabel type='none'/>

</domain> 


[root@opennebula qemu]# 
上一篇:5.软件管理


下一篇:QEMU运行树莓派raspi3