int ret = -1;
size_t i;
+ if (netdef->forward.npfs == 0 || netdef->forward.nifs > 0)
+ return 0;
+
if ((virNetDevGetVirtualFunctions(netdef->forward.pfs->dev,
&vfNames, &virtFns, &numVirtFns)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
goto cleanup;
}
- netdef->forward.nifs = 0;
if (VIR_ALLOC_N(netdef->forward.ifs, numVirtFns) < 0)
goto cleanup;
virDomainHostdevSubsysPCIBackendType backend;
iface->data.network.actual->type = actualType = VIR_DOMAIN_NET_TYPE_HOSTDEV;
- if (netdef->forward.npfs > 0 && netdef->forward.nifs <= 0 &&
- networkCreateInterfacePool(netdef) < 0) {
+ if (networkCreateInterfacePool(netdef) < 0)
goto error;
- }
/* pick first dev with 0 connections */
for (i = 0; i < netdef->forward.nifs; i++) {
} else {
/* pick an interface from the pool */
- if (netdef->forward.npfs > 0 && netdef->forward.nifs == 0 &&
- networkCreateInterfacePool(netdef) < 0) {
+ if (networkCreateInterfacePool(netdef) < 0)
goto error;
- }
/* PASSTHROUGH mode, and PRIVATE Mode + 802.1Qbh both
* require exclusive access to a device, so current
goto success;
}
- if (netdef->forward.npfs > 0 && netdef->forward.nifs == 0 &&
- networkCreateInterfacePool(netdef) < 0) {
+ if (networkCreateInterfacePool(netdef) < 0)
goto error;
- }
+
if (netdef->forward.nifs == 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("network '%s' uses a direct or hostdev mode, "