vhost xml配置

来源:互联网 发布:淘宝转换微信链接 编辑:程序博客网 时间:2024/05/29 02:23
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>  <name>kvm4</name>  <uuid>b6f6dc62-28e6-44ae-9aab-07dd18d9b553</uuid>  <memory unit='KiB'>4388608</memory>  <currentMemory unit='KiB'>4388608</currentMemory>  <vcpu placement='static'>4</vcpu>  <os>    <type arch='aarch64' machine='virt-2.6'>hvm</type>    <kernel>/boot/Image</kernel>    <initrd>/boot/fsl-image-core-ls1046ardb.ext2.gz</initrd>    <cmdline>root=/dev/ram0 rw console=ttyAMA0 rootwait earlyprintk</cmdline>    <boot dev='hd'/>  </os>  <cpu mode='custom' match='exact'>    <model fallback='allow'>host</model>  </cpu>  <clock offset='utc'/>  <on_poweroff>destroy</on_poweroff>  <on_reboot>restart</on_reboot>  <on_crash>destroy</on_crash>  <devices>    <emulator>/usr/bin/qemu-system-aarch64</emulator>    <controller type='pci' index='0' model='pcie-root'/>    <controller type='pci' index='1' model='dmi-to-pci-bridge'>      <model name='i82801b11-bridge'/>      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>    </controller>    <controller type='pci' index='2' model='pci-bridge'>      <model name='pci-bridge'/>      <target chassisNr='2'/>      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>    </controller>    <serial type='pty'>      <target port='0'/>    </serial>    <console type='pty'>      <target type='serial' port='0'/>    </console>    <memballoon model='none'/>  </devices>  <qemu:commandline>    <qemu:arg value='-netdev'/>                           ----- 创建两个vhost    <qemu:arg value='tap,id=tap0,script=/home/qemu-ifup,downscript=no,ifname=tap0,vhost=on'/>    <qemu:arg value='-device'/>    <qemu:arg value='virtio-net-pci,netdev=tap0'/>    <qemu:arg value='-netdev'/>    <qemu:arg value='tap,id=tap1,script=/home/qemu-ifup,downscript=no,ifname=tap1,vhost=on'/>    <qemu:arg value='-device'/>    <qemu:arg value='virtio-net-pci,netdev=tap1'/>  </qemu:commandline></domain>



OR:

    <interface type='bridge'>      <mac address='52:54:00:6f:51:43'/>      <source bridge='br0'/>      <model type='virtio'/>      <driver name='vhost' txmode='iothread'/>      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>    </interface>