}
if (!*pfname) {
- /* this shouldn't be possible. A VF can't exist unless its
- * PF device is bound to a network driver
- */
+ /* The SRIOV standard does not require VF netdevs to have
+ * the netdev assigned to a PF. */
virReportError(VIR_ERR_INTERNAL_ERROR,
_("The PF device for VF %s has no network device name"),
ifname);
if ((is_vf = virNetDevIsVirtualFunction(ifname)) < 0)
return ret;
- if (is_vf == 1 && virNetDevGetPhysicalFunction(ifname, &pfname) < 0)
- goto cleanup;
+ if (is_vf == 1) {
+ /* Ignore error if PF does not have netdev assigned.
+ * In that case pfname == NULL. */
+ if (virNetDevGetPhysicalFunction(ifname, &pfname) < 0)
+ virResetLastError();
+ }
pci_device_ptr = pfname ? virNetDevGetPCIDevice(pfname) :
virNetDevGetPCIDevice(ifname);