mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: remove redundant code that adds "template" netdev name
The lower level function virNetDevGenerateName() now understands that a blank ifname should be replaced with a generated name based on a template that it knows about itself - there is no need for the higher level functions to stuff a template name ("vnet%d") into ifname. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
08fe449848
commit
9606349172
@ -455,14 +455,10 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!net->ifname ||
|
|
||||||
STRPREFIX(net->ifname, VIR_NET_GENERATED_VNET_PREFIX) ||
|
if (!net->ifname)
|
||||||
strchr(net->ifname, '%')) {
|
|
||||||
VIR_FREE(net->ifname);
|
|
||||||
net->ifname = g_strdup(VIR_NET_GENERATED_VNET_PREFIX "%d");
|
|
||||||
/* avoid exposing vnet%d in getXMLDesc or error outputs */
|
|
||||||
template_ifname = true;
|
template_ifname = true;
|
||||||
}
|
|
||||||
if (virNetDevTapCreate(&net->ifname, tunpath, tapfd, tapfdSize,
|
if (virNetDevTapCreate(&net->ifname, tunpath, tapfd, tapfdSize,
|
||||||
tap_create_flags) < 0) {
|
tap_create_flags) < 0) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -559,14 +555,8 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!net->ifname ||
|
if (!net->ifname)
|
||||||
STRPREFIX(net->ifname, VIR_NET_GENERATED_VNET_PREFIX) ||
|
|
||||||
strchr(net->ifname, '%')) {
|
|
||||||
VIR_FREE(net->ifname);
|
|
||||||
net->ifname = g_strdup(VIR_NET_GENERATED_VNET_PREFIX "%d");
|
|
||||||
/* avoid exposing vnet%d in getXMLDesc or error outputs */
|
|
||||||
template_ifname = true;
|
template_ifname = true;
|
||||||
}
|
|
||||||
|
|
||||||
if (qemuInterfaceIsVnetCompatModel(net))
|
if (qemuInterfaceIsVnetCompatModel(net))
|
||||||
tap_create_flags |= VIR_NETDEV_TAP_CREATE_VNET_HDR;
|
tap_create_flags |= VIR_NETDEV_TAP_CREATE_VNET_HDR;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user