mirror of https://gitee.com/openkylin/libvirt.git
Only parse custom vhost path for virtio interfaces
It is only supported for virtio adapters. Silently drop it if it was specified for other models, as is done for other virtio attributes. Also mention this in the documentation. https://bugzilla.redhat.com/show_bug.cgi?id=1147195
This commit is contained in:
parent
481881f50a
commit
84f741812f
|
@ -4142,7 +4142,9 @@ qemu-kvm -net nic,model=? /dev/null
|
|||
|
||||
<p>
|
||||
For tuning the backend of the network, the <code>backend</code> element
|
||||
can be used. Supported attributes are <code>tap</code> and <code>vhost</code>,
|
||||
can be used. The <code>vhost</code> attribute can override the default vhost
|
||||
device path (<code>/dev/vhost-net</code>) for devices with <code>virtio</code> model.
|
||||
Supported attributes are <code>tap</code> and <code>vhost</code>,
|
||||
allowing to override the default devices for creating tap and vhost devices.
|
||||
</p>
|
||||
<h5><a name="elementsNICSTargetOverride">Overriding the target element</a></h5>
|
||||
|
|
|
@ -7369,6 +7369,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||
char *vhostuser_path = NULL;
|
||||
char *vhostuser_type = NULL;
|
||||
char *trustGuestRxFilters = NULL;
|
||||
char *vhost_path = NULL;
|
||||
virNWFilterHashTablePtr filterparams = NULL;
|
||||
virDomainActualNetDefPtr actual = NULL;
|
||||
xmlNodePtr oldnode = ctxt->node;
|
||||
|
@ -7550,8 +7551,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||
def->backend.tap = virFileSanitizePath(tmp);
|
||||
VIR_FREE(tmp);
|
||||
|
||||
if ((tmp = virXMLPropString(cur, "vhost")))
|
||||
def->backend.vhost = virFileSanitizePath(tmp);
|
||||
if (!vhost_path && (tmp = virXMLPropString(cur, "vhost")))
|
||||
vhost_path = virFileSanitizePath(tmp);
|
||||
VIR_FREE(tmp);
|
||||
}
|
||||
}
|
||||
|
@ -7992,6 +7993,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||
}
|
||||
def->driver.virtio.guest.ufo = val;
|
||||
}
|
||||
def->backend.vhost = vhost_path;
|
||||
vhost_path = NULL;
|
||||
}
|
||||
|
||||
def->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT;
|
||||
|
@ -8061,6 +8064,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||
VIR_FREE(addrtype);
|
||||
VIR_FREE(trustGuestRxFilters);
|
||||
VIR_FREE(ips);
|
||||
VIR_FREE(vhost_path);
|
||||
virNWFilterHashTableFree(filterparams);
|
||||
|
||||
return def;
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<domain type='qemu'>
|
||||
<name>test</name>
|
||||
<uuid>bba65c0e-c049-934f-b6aa-4e2c0582acdf</uuid>
|
||||
<memory unit='KiB'>1048576</memory>
|
||||
<currentMemory unit='KiB'>1048576</currentMemory>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='pc-0.13'>hvm</type>
|
||||
<boot dev='cdrom'/>
|
||||
<boot dev='hd'/>
|
||||
<bootmenu enable='yes'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu</emulator>
|
||||
<controller type='usb' index='0'/>
|
||||
<controller type='virtio-serial' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'/>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<interface type='user'>
|
||||
<mac address='52:54:00:e5:48:58'/>
|
||||
<model type='definitely-not-virtio'/>
|
||||
<driver name='vhost' queues='5'/>
|
||||
<backend tap='/dev/null' vhost='/dev/zero'/>
|
||||
</interface>
|
||||
<serial type='pty'>
|
||||
<target port='0'/>
|
||||
</serial>
|
||||
<console type='pty'>
|
||||
<target type='serial' port='0'/>
|
||||
</console>
|
||||
<memballoon model='virtio'/>
|
||||
</devices>
|
||||
</domain>
|
|
@ -0,0 +1,38 @@
|
|||
<domain type='qemu'>
|
||||
<name>test</name>
|
||||
<uuid>bba65c0e-c049-934f-b6aa-4e2c0582acdf</uuid>
|
||||
<memory unit='KiB'>1048576</memory>
|
||||
<currentMemory unit='KiB'>1048576</currentMemory>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='pc-0.13'>hvm</type>
|
||||
<boot dev='cdrom'/>
|
||||
<boot dev='hd'/>
|
||||
<bootmenu enable='yes'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu</emulator>
|
||||
<controller type='usb' index='0'/>
|
||||
<controller type='virtio-serial' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'/>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<interface type='user'>
|
||||
<mac address='52:54:00:e5:48:58'/>
|
||||
<model type='definitely-not-virtio'/>
|
||||
<backend tap='/dev/null'/>
|
||||
</interface>
|
||||
<serial type='pty'>
|
||||
<target port='0'/>
|
||||
</serial>
|
||||
<console type='pty'>
|
||||
<target type='serial' port='0'/>
|
||||
</console>
|
||||
<memballoon model='virtio'/>
|
||||
</devices>
|
||||
</domain>
|
|
@ -417,6 +417,7 @@ mymain(void)
|
|||
DO_TEST("bios-nvram");
|
||||
|
||||
DO_TEST("tap-vhost");
|
||||
DO_TEST_DIFFERENT("tap-vhost-incorrect");
|
||||
DO_TEST("shmem");
|
||||
DO_TEST("smbios");
|
||||
|
||||
|
|
Loading…
Reference in New Issue