[libvirt] [PATCH 0/2] Allow using custom tap and vhost devices

This allows usage of alternative tun/tap/vhost backends implemented in userspace via cuse. Ján Tomko (2): conf: add backend element to interfaces Wire up the interface backend options docs/formatdomain.html.in | 20 +++++++++ docs/schemas/domaincommon.rng | 10 +++++ src/bhyve/bhyve_command.c | 2 +- src/bhyve/bhyve_process.c | 2 +- src/conf/domain_conf.c | 11 +++++ src/conf/domain_conf.h | 4 ++ src/network/bridge_driver.c | 6 +-- src/qemu/qemu_command.c | 22 +++++++--- src/qemu/qemu_process.c | 2 +- src/uml/uml_conf.c | 2 +- src/uml/uml_driver.c | 3 +- src/util/virnetdevtap.c | 37 +++++++++++----- src/util/virnetdevtap.h | 5 ++- tests/qemuxml2argvdata/qemuxml2argv-tap-vhost.xml | 52 +++++++++++++++++++++++ tests/qemuxml2xmltest.c | 2 + 15 files changed, 154 insertions(+), 26 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-tap-vhost.xml -- 1.8.5.5

For tuning the network, alternative devices for creating tap and vhost devices can be specified via: <backend tap='/dev/net/tun' vhost='/dev/net-vhost'/> --- docs/formatdomain.html.in | 20 +++++++++ docs/schemas/domaincommon.rng | 10 +++++ src/conf/domain_conf.c | 11 +++++ src/conf/domain_conf.h | 4 ++ tests/qemuxml2argvdata/qemuxml2argv-tap-vhost.xml | 52 +++++++++++++++++++++++ tests/qemuxml2xmltest.c | 2 + 6 files changed, 99 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-tap-vhost.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index a2ea758..bb50cb4 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3951,6 +3951,26 @@ qemu-kvm -net nic,model=? /dev/null </dd> </dl> + <h5><a name="elementsBackendOptions">Setting network backend-specific options</a></h5> + +<pre> + ... + <devices> + <interface type='network'> + <source network='default'/> + <target dev='vnet1'/> + <model type='virtio'/> + <b><backend tap='/dev/net/tun' vhost='/dev/net-vhost'/></b> + <driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off' queues='5'/> + </interface> + </devices> + ...</pre> + + <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>, + allowing to override the default devices for creating tap and vhost devices. + </p> <h5><a name="elementsNICSTargetOverride">Overriding the target element</a></h5> <pre> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 6ae940a..a9be522 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2335,6 +2335,16 @@ </element> </optional> <optional> + <element name="backend"> + <attribute name='tap'> + <ref name='absFilePath'/> + </attribute> + <attribute name='vhost'> + <ref name='absFilePath'/> + </attribute> + </element> + </optional> + <optional> <element name="driver"> <choice> <group> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a2a7d92..4b8303e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1415,6 +1415,8 @@ void virDomainNetDefFree(virDomainNetDefPtr def) break; } + VIR_FREE(def->backend.tap); + VIR_FREE(def->backend.vhost); VIR_FREE(def->virtPortProfile); VIR_FREE(def->script); VIR_FREE(def->ifname); @@ -7046,6 +7048,9 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, } else if (xmlStrEqual(cur->name, BAD_CAST "vlan")) { if (virNetDevVlanParse(cur, ctxt, &def->vlan) < 0) goto error; + } else if (xmlStrEqual(cur->name, BAD_CAST "backend")) { + def->backend.tap = virXMLPropString(cur, "tap"); + def->backend.vhost = virXMLPropString(cur, "vhost"); } } cur = cur->next; @@ -16602,6 +16607,12 @@ virDomainNetDefFormat(virBufferPtr buf, virBufferAddLit(buf, "/>\n"); } } + if (def->backend.tap || def->backend.vhost) { + virBufferAddLit(buf, "<backend"); + virBufferEscapeString(buf, " tap='%s'", def->backend.tap); + virBufferEscapeString(buf, " vhost='%s'", def->backend.vhost); + virBufferAddLit(buf, "/>\n"); + } if (def->filter) { if (virNWFilterFormatParamAttributes(buf, def->filterparams, def->filter) < 0) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index efae2f5..f055188 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -897,6 +897,10 @@ struct _virDomainNetDef { unsigned int queues; /* Multiqueue virtio-net */ } virtio; } driver; + struct { + char *tap; + char *vhost; + } backend; union { struct { char *dev; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-tap-vhost.xml b/tests/qemuxml2argvdata/qemuxml2argv-tap-vhost.xml new file mode 100644 index 0000000..3237c6a --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-tap-vhost.xml @@ -0,0 +1,52 @@ +<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> + <disk type='file' device='disk'> + <driver name='qemu' type='qcow2' event_idx='on'/> + <source file='/var/lib/libvirt/images/f14.img'/> + <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </disk> + <disk type='file' device='cdrom'> + <driver name='qemu' type='raw'/> + <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/> + <target dev='hdc' bus='ide'/> + <readonly/> + <address type='drive' controller='0' bus='1' target='0' unit='0'/> + </disk> + <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='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> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 34cdb97..5a996c4 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -398,6 +398,8 @@ mymain(void) DO_TEST("bios-nvram"); + DO_TEST("tap-vhost"); + virObjectUnref(driver.caps); virObjectUnref(driver.xmlopt); -- 1.8.5.5

Pass the user-specified tun path down when creating tap device when called from the qemu driver. Also honor the vhost device path specified by user. --- src/bhyve/bhyve_command.c | 2 +- src/bhyve/bhyve_process.c | 2 +- src/network/bridge_driver.c | 6 +++--- src/qemu/qemu_command.c | 22 +++++++++++++++------- src/qemu/qemu_process.c | 2 +- src/uml/uml_conf.c | 2 +- src/uml/uml_driver.c | 3 ++- src/util/virnetdevtap.c | 37 +++++++++++++++++++++++++++---------- src/util/virnetdevtap.h | 5 ++++- 9 files changed, 55 insertions(+), 26 deletions(-) diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 94829e7..bea4a59 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -72,7 +72,7 @@ bhyveBuildNetArgStr(const virDomainDef *def, if (!dryRun) { if (virNetDevTapCreateInBridgePort(brname, &net->ifname, &net->mac, - def->uuid, NULL, 0, + def->uuid, NULL, NULL, 0, virDomainNetGetActualVirtPortProfile(net), virDomainNetGetActualVlan(net), VIR_NETDEV_TAP_CREATE_IFUP | VIR_NETDEV_TAP_CREATE_PERSIST) < 0) { diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 6b5403d..0bbe388 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -82,7 +82,7 @@ bhyveNetCleanup(virDomainObjPtr vm) ignore_value(virNetDevBridgeRemovePort( virDomainNetGetActualBridgeName(net), net->ifname)); - ignore_value(virNetDevTapDelete(net->ifname)); + ignore_value(virNetDevTapDelete(net->ifname, NULL)); } } } diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 0bc4a4d..979fb13 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -1991,7 +1991,7 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver, /* Keep tun fd open and interface up to allow for IPv6 DAD to happen */ if (virNetDevTapCreateInBridgePort(network->def->bridge, &macTapIfName, &network->def->mac, - NULL, &tapfd, 1, NULL, NULL, + NULL, NULL, &tapfd, 1, NULL, NULL, VIR_NETDEV_TAP_CREATE_USE_MAC_FOR_BRIDGE | VIR_NETDEV_TAP_CREATE_IFUP | VIR_NETDEV_TAP_CREATE_PERSIST) < 0) { @@ -2117,7 +2117,7 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver, if (macTapIfName) { VIR_FORCE_CLOSE(tapfd); - ignore_value(virNetDevTapDelete(macTapIfName)); + ignore_value(virNetDevTapDelete(macTapIfName, NULL)); VIR_FREE(macTapIfName); } @@ -2156,7 +2156,7 @@ static int networkShutdownNetworkVirtual(virNetworkDriverStatePtr driver ATTRIBU if (network->def->mac_specified) { char *macTapIfName = networkBridgeDummyNicName(network->def->bridge); if (macTapIfName) { - ignore_value(virNetDevTapDelete(macTapIfName)); + ignore_value(virNetDevTapDelete(macTapIfName, NULL)); VIR_FREE(macTapIfName); } } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 665a590..fc17aab 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -290,6 +290,10 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, bool template_ifname = false; int actualType = virDomainNetGetActualType(net); virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); + const char *tunpath = "/dev/net/tun"; + + if (net->backend.tap) + tunpath = net->backend.tap; if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK) { bool fail = false; @@ -338,18 +342,18 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, if (cfg->privileged) { if (virNetDevTapCreateInBridgePort(brname, &net->ifname, &net->mac, - def->uuid, tapfd, *tapfdSize, + def->uuid, tunpath, tapfd, *tapfdSize, virDomainNetGetActualVirtPortProfile(net), virDomainNetGetActualVlan(net), tap_create_flags) < 0) { - virDomainAuditNetDevice(def, net, "/dev/net/tun", false); + virDomainAuditNetDevice(def, net, tunpath, false); goto cleanup; } } else { if (qemuCreateInBridgePortWithHelper(cfg, brname, &net->ifname, tapfd, tap_create_flags) < 0) { - virDomainAuditNetDevice(def, net, "/dev/net/tun", false); + virDomainAuditNetDevice(def, net, tunpath, false); goto cleanup; } /* qemuCreateInBridgePortWithHelper can only create a single FD */ @@ -359,7 +363,7 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, } } - virDomainAuditNetDevice(def, net, "/dev/net/tun", true); + virDomainAuditNetDevice(def, net, tunpath, true); if (cfg->macFilter && ebtablesAddForwardAllowIn(driver->ebtables, @@ -443,6 +447,10 @@ qemuOpenVhostNet(virDomainDefPtr def, int *vhostfdSize) { size_t i; + const char *vhostnet_path = net->backend.vhost; + + if (!vhostnet_path) + vhostnet_path = "/dev/vhost-net"; /* If running a plain QEMU guest, or * if the config says explicitly to not use vhost, return now*/ @@ -480,13 +488,13 @@ qemuOpenVhostNet(virDomainDefPtr def, } for (i = 0; i < *vhostfdSize; i++) { - vhostfd[i] = open("/dev/vhost-net", O_RDWR); + vhostfd[i] = open(vhostnet_path, O_RDWR); /* If the config says explicitly to use vhost and we couldn't open it, * report an error. */ if (vhostfd[i] < 0) { - virDomainAuditNetDevice(def, net, "/dev/vhost-net", false); + virDomainAuditNetDevice(def, net, vhostnet_path, false); if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("vhost-net was requested for an interface, " @@ -499,7 +507,7 @@ qemuOpenVhostNet(virDomainDefPtr def, break; } } - virDomainAuditNetDevice(def, net, "/dev/vhost-net", *vhostfdSize); + virDomainAuditNetDevice(def, net, vhostnet_path, *vhostfdSize); return 0; error: diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ac40ea8..9ab9521 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4766,7 +4766,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, case VIR_DOMAIN_NET_TYPE_NETWORK: #ifdef VIR_NETDEV_TAP_REQUIRE_MANUAL_CLEANUP if (!(vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)) - ignore_value(virNetDevTapDelete(net->ifname)); + ignore_value(virNetDevTapDelete(net->ifname, net->backend.tun)); #endif break; } diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c index 41ce03c..407a79b 100644 --- a/src/uml/uml_conf.c +++ b/src/uml/uml_conf.c @@ -124,7 +124,7 @@ umlConnectTapDevice(virConnectPtr conn, } if (virNetDevTapCreateInBridgePort(bridge, &net->ifname, &net->mac, - vm->uuid, &tapfd, 1, + vm->uuid, net->backend.tun, &tapfd, 1, virDomainNetGetActualVirtPortProfile(net), virDomainNetGetActualVlan(net), VIR_NETDEV_TAP_CREATE_IFUP | diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 5bede07..9404005 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -1032,7 +1032,8 @@ static void umlCleanupTapDevices(virDomainObjPtr vm) def->type != VIR_DOMAIN_NET_TYPE_NETWORK) continue; - ignore_value(virNetDevTapDelete(def->ifname)); + ignore_value(virNetDevTapDelete(def->ifname, + def->backend.tun)); } } diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c index d64e64f..3674f9b 100644 --- a/src/util/virnetdevtap.c +++ b/src/util/virnetdevtap.c @@ -216,6 +216,7 @@ virNetDevProbeVnetHdr(int tapfd) /** * virNetDevTapCreate: * @ifname: the interface name + * @tunpath: path to the tun device (if NULL, /dev/net/tun is used) * @tapfds: array of file descriptors return value for the new tap device * @tapfdSize: number of file descriptors in @tapfd * @flags: OR of virNetDevTapCreateFlags. Only one flag is recognized: @@ -233,6 +234,7 @@ virNetDevProbeVnetHdr(int tapfd) * Returns 0 in case of success or -1 on failure. */ int virNetDevTapCreate(char **ifname, + const char *tunpath, int *tapfd, int tapfdSize, unsigned int flags) @@ -242,11 +244,15 @@ int virNetDevTapCreate(char **ifname, int ret = -1; int fd; + if (!tunpath) + tunpath = "/dev/net/tun"; + memset(&ifr, 0, sizeof(ifr)); for (i = 0; i < tapfdSize; i++) { - if ((fd = open("/dev/net/tun", O_RDWR)) < 0) { - virReportSystemError(errno, "%s", - _("Unable to open /dev/net/tun, is tun module loaded?")); + if ((fd = open(tunpath, O_RDWR)) < 0) { + virReportSystemError(errno, + _("Unable to open %s, is tun module loaded?"), + tunpath); goto cleanup; } @@ -316,15 +322,20 @@ int virNetDevTapCreate(char **ifname, } -int virNetDevTapDelete(const char *ifname) +int virNetDevTapDelete(const char *ifname, + const char *tunpath) { struct ifreq try; int fd; int ret = -1; - if ((fd = open("/dev/net/tun", O_RDWR)) < 0) { - virReportSystemError(errno, "%s", - _("Unable to open /dev/net/tun, is tun module loaded?")); + if (!tunpath) + tunpath = "/dev/net/tun"; + + if ((fd = open(tunpath, O_RDWR)) < 0) { + virReportSystemError(errno, + _("Unable to open %s, is tun module loaded?"), + tunpath); return -1; } @@ -358,6 +369,7 @@ int virNetDevTapDelete(const char *ifname) } #elif defined(SIOCIFCREATE2) && defined(SIOCIFDESTROY) && defined(IF_MAXUNIT) int virNetDevTapCreate(char **ifname, + const char *tunpath ATTRIBUTE_UNUSED, int *tapfd, int tapfdSize, unsigned int flags ATTRIBUTE_UNUSED) @@ -444,7 +456,8 @@ int virNetDevTapCreate(char **ifname, return ret; } -int virNetDevTapDelete(const char *ifname) +int virNetDevTapDelete(const char *ifname, + const char *tunpath ATTRIBUTE_UNUSED) { int s; struct ifreq ifr; @@ -468,6 +481,7 @@ int virNetDevTapDelete(const char *ifname) #else int virNetDevTapCreate(char **ifname ATTRIBUTE_UNUSED, + const char *tunpath ATTRIBUTE_UNUSED, int *tapfd ATTRIBUTE_UNUSED, int tapfdSize ATTRIBUTE_UNUSED, unsigned int flags ATTRIBUTE_UNUSED) @@ -476,7 +490,8 @@ int virNetDevTapCreate(char **ifname ATTRIBUTE_UNUSED, _("Unable to create TAP devices on this platform")); return -1; } -int virNetDevTapDelete(const char *ifname ATTRIBUTE_UNUSED) +int virNetDevTapDelete(const char *ifname ATTRIBUTE_UNUSED, + const char *tunpath ATTRIBUTE_UNUSED) { virReportSystemError(ENOSYS, "%s", _("Unable to delete TAP devices on this platform")); @@ -490,6 +505,7 @@ int virNetDevTapDelete(const char *ifname ATTRIBUTE_UNUSED) * @brname: the bridge name * @ifname: the interface name (or name template) * @macaddr: desired MAC address + * @tunpath: path to the tun device (if NULL, /dev/net/tun is used) * @tapfd: array of file descriptor return value for the new tap device * @tapfdSize: number of file descriptors in @tapfd * @virtPortProfile: bridge/port specific configuration @@ -518,6 +534,7 @@ int virNetDevTapCreateInBridgePort(const char *brname, char **ifname, const virMacAddr *macaddr, const unsigned char *vmuuid, + const char *tunpath, int *tapfd, int tapfdSize, virNetDevVPortProfilePtr virtPortProfile, @@ -528,7 +545,7 @@ int virNetDevTapCreateInBridgePort(const char *brname, char macaddrstr[VIR_MAC_STRING_BUFLEN]; size_t i; - if (virNetDevTapCreate(ifname, tapfd, tapfdSize, flags) < 0) + if (virNetDevTapCreate(ifname, tunpath, tapfd, tapfdSize, flags) < 0) return -1; /* We need to set the interface MAC before adding it diff --git a/src/util/virnetdevtap.h b/src/util/virnetdevtap.h index 03fb5f8..c0a4e15 100644 --- a/src/util/virnetdevtap.h +++ b/src/util/virnetdevtap.h @@ -34,12 +34,14 @@ # endif int virNetDevTapCreate(char **ifname, + const char *tunpath, int *tapfd, int tapfdSize, unsigned int flags) ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK; -int virNetDevTapDelete(const char *ifname) +int virNetDevTapDelete(const char *ifname, + const char *tunpath) ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK; int virNetDevTapGetName(int tapfd, char **ifname) @@ -64,6 +66,7 @@ int virNetDevTapCreateInBridgePort(const char *brname, char **ifname, const virMacAddr *macaddr, const unsigned char *vmuuid, + const char *tunpath, int *tapfd, int tapfdSize, virNetDevVPortProfilePtr virtPortProfile, -- 1.8.5.5

On Thu, Sep 11, 2014 at 05:27:12PM +0200, Ján Tomko wrote:
Pass the user-specified tun path down when creating tap device when called from the qemu driver.
Also honor the vhost device path specified by user. --- src/bhyve/bhyve_command.c | 2 +- src/bhyve/bhyve_process.c | 2 +- src/network/bridge_driver.c | 6 +++--- src/qemu/qemu_command.c | 22 +++++++++++++++------- src/qemu/qemu_process.c | 2 +- src/uml/uml_conf.c | 2 +- src/uml/uml_driver.c | 3 ++- src/util/virnetdevtap.c | 37 +++++++++++++++++++++++++++---------- src/util/virnetdevtap.h | 5 ++++- 9 files changed, 55 insertions(+), 26 deletions(-)
[...]
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ac40ea8..9ab9521 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4766,7 +4766,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, case VIR_DOMAIN_NET_TYPE_NETWORK: #ifdef VIR_NETDEV_TAP_REQUIRE_MANUAL_CLEANUP if (!(vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)) - ignore_value(virNetDevTapDelete(net->ifname)); + ignore_value(virNetDevTapDelete(net->ifname, net->backend.tun));
s/tun/tap/
#endif break; } diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c index 41ce03c..407a79b 100644 --- a/src/uml/uml_conf.c +++ b/src/uml/uml_conf.c @@ -124,7 +124,7 @@ umlConnectTapDevice(virConnectPtr conn, }
if (virNetDevTapCreateInBridgePort(bridge, &net->ifname, &net->mac, - vm->uuid, &tapfd, 1, + vm->uuid, net->backend.tun, &tapfd, 1,
Same here.
virDomainNetGetActualVirtPortProfile(net), virDomainNetGetActualVlan(net), VIR_NETDEV_TAP_CREATE_IFUP | diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 5bede07..9404005 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -1032,7 +1032,8 @@ static void umlCleanupTapDevices(virDomainObjPtr vm) def->type != VIR_DOMAIN_NET_TYPE_NETWORK) continue;
- ignore_value(virNetDevTapDelete(def->ifname)); + ignore_value(virNetDevTapDelete(def->ifname, + def->backend.tun));
And here. Although I'd name it tun in the first place :) ACK series with these fixed. Martin

On 09/16/2014 01:03 PM, Martin Kletzander wrote:
On Thu, Sep 11, 2014 at 05:27:12PM +0200, Ján Tomko wrote:
Pass the user-specified tun path down when creating tap device when called from the qemu driver.
Also honor the vhost device path specified by user. --- src/bhyve/bhyve_command.c | 2 +- src/bhyve/bhyve_process.c | 2 +- src/network/bridge_driver.c | 6 +++--- src/qemu/qemu_command.c | 22 +++++++++++++++------- src/qemu/qemu_process.c | 2 +- src/uml/uml_conf.c | 2 +- src/uml/uml_driver.c | 3 ++- src/util/virnetdevtap.c | 37 +++++++++++++++++++++++++++---------- src/util/virnetdevtap.h | 5 ++++- 9 files changed, 55 insertions(+), 26 deletions(-)
[...]
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ac40ea8..9ab9521 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4766,7 +4766,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, case VIR_DOMAIN_NET_TYPE_NETWORK: #ifdef VIR_NETDEV_TAP_REQUIRE_MANUAL_CLEANUP if (!(vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)) - ignore_value(virNetDevTapDelete(net->ifname)); + ignore_value(virNetDevTapDelete(net->ifname, net->backend.tun));
s/tun/tap/
#endif break; } diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c index 41ce03c..407a79b 100644 --- a/src/uml/uml_conf.c +++ b/src/uml/uml_conf.c @@ -124,7 +124,7 @@ umlConnectTapDevice(virConnectPtr conn, }
if (virNetDevTapCreateInBridgePort(bridge, &net->ifname, &net->mac, - vm->uuid, &tapfd, 1, + vm->uuid, net->backend.tun, &tapfd, 1,
Same here.
virDomainNetGetActualVirtPortProfile(net), virDomainNetGetActualVlan(net), VIR_NETDEV_TAP_CREATE_IFUP | diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 5bede07..9404005 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -1032,7 +1032,8 @@ static void umlCleanupTapDevices(virDomainObjPtr vm) def->type != VIR_DOMAIN_NET_TYPE_NETWORK) continue;
- ignore_value(virNetDevTapDelete(def->ifname)); + ignore_value(virNetDevTapDelete(def->ifname, + def->backend.tun));
And here. Although I'd name it tun in the first place :)
ACK series with these fixed.
I fixed the three occurences and pushed the series. Thanks for the review! Jan
participants (2)
-
Ján Tomko
-
Martin Kletzander