
On 08/15/2012 06:47 AM, Shradha Shah wrote:
On 08/14/2012 06:36 AM, Laine Stump wrote:
On 08/10/2012 12:23 PM, Shradha Shah wrote:
The network pool should be able to keep track of both, network device names nad PCI addresses, and return the appropriate one in the actualDevice when networkAllocateActualDevice is called.
Signed-off-by: Shradha Shah <sshah@solarflare.com> --- src/network/bridge_driver.c | 33 +++++++++++++++++++++++++++------ src/util/virnetdev.c | 25 ++++++++++++------------- src/util/virnetdev.h | 4 +++- 3 files changed, 42 insertions(+), 20 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index df3cc25..602e17d 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -59,6 +59,7 @@ #include "dnsmasq.h" #include "configmake.h" #include "virnetdev.h" +#include "pci.h" #include "virnetdevbridge.h" #include "virnetdevtap.h"
@@ -2737,10 +2738,11 @@ static int networkCreateInterfacePool(virNetworkDefPtr netdef) { unsigned int num_virt_fns = 0; char **vfname = NULL; + struct pci_config_address **virt_fns; int ret = -1, ii = 0;
if ((virNetDevGetVirtualFunctions(netdef->forwardPfs->dev, - &vfname, &num_virt_fns)) < 0) { + &vfname, &virt_fns, &num_virt_fns)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not get Virtual functions on %s"), netdef->forwardPfs->dev); @@ -2762,19 +2764,38 @@ networkCreateInterfacePool(virNetworkDefPtr netdef) { netdef->nForwardIfs = num_virt_fns;
for (ii = 0; ii < netdef->nForwardIfs; ii++) { - netdef->forwardIfs[ii].device.dev = strdup(vfname[ii]); - if (!netdef->forwardIfs[ii].device.dev) { - virReportOOMError(); - goto finish; To be pure in the separation of patches, the following if else should be removed from this patch, with just the contents of the "if" clause here. Then the if else + body of the else should be added in the next patch.
(And at any rate, the if() condition is incorrect here - really that part should happen for all forwardTypes except HOSTDEV (BRIDGE, PRIVATE, and VEPA also require netdev names.) I did not include the BRIDGE, PRIVATE and VEPA cases here because the networkCreateInterfacePool function is not called in those cases.
Should I still include the conditions for BRIDGE, PRIVATE and VEPA?
Ah. It *should* be called for those cases as well. I hadn't noticed that it wasn't. Those modes can also benefit from auto-creating the list of devices.