}
-/* @oldStateDir:
- * For upgrade purpose:
- * To an existing VM on QEMU, the hostdev netconfig file is originally stored
- * in cfg->stateDir (/var/run/libvirt/qemu). Switch to new version, it uses new
- * location (mgr->stateDir) but certainly will not find it. In this
- * case, try to find in the old state dir.
- */
static int
virHostdevRestoreNetConfig(virDomainHostdevDefPtr hostdev,
- const char *stateDir,
- const char *oldStateDir)
+ const char *stateDir)
{
g_autofree char *linkdev = NULL;
g_autofree virMacAddrPtr MAC = NULL;
NULL,
port_profile_associate);
} else {
- /* we need to try 3 different places for the config file:
+ /* we need to try 2 different places for the config file:
* 1) ${stateDir}/${PF}_vf${vf}
* This is almost always where the saved config is
*
- * 2) ${oldStateDir/${PF}_vf${vf}
- * saved config is only here if this machine was running a
- * (by now *very*) old version of libvirt that saved the
- * file in a different directory
- *
- * 3) ${stateDir}${PF[1]}_vf${VF}
+ * 2) ${stateDir}${PF[1]}_vf${VF}
* PF[1] means "the netdev for port 2 of the PF device", and
* is only valid when the PF is a Mellanox dual port NIC with
* a VF that was created in "single port" mode.
return -1;
}
- /* 2) "old" (pre-1.2.3 circa 2014) location - whenever we get
- * to the point that nobody will ever upgrade directly from
- * 1.2.3 (or older) directly to current libvirt, we can
- * eliminate this clause
- **/
- if (!(adminMAC || vlan || MAC) && oldStateDir &&
- virNetDevReadNetConfig(linkdev, vf, oldStateDir,
- &adminMAC, &vlan, &MAC) < 0) {
- return -1;
- }
-
- /* 3) try using the PF's "port 2" netdev as the name of the
+ /* 2) try using the PF's "port 2" netdev as the name of the
* config file
*/
if (!(adminMAC || vlan || MAC)) {
resetvfnetconfig:
if (last_processed_hostdev_vf >= 0) {
for (i = 0; i <= last_processed_hostdev_vf; i++)
- virHostdevRestoreNetConfig(hostdevs[i], mgr->stateDir, NULL);
+ virHostdevRestoreNetConfig(hostdevs[i], mgr->stateDir);
}
reattachdevs:
const char *dom_name,
virPCIDeviceListPtr pcidevs,
virDomainHostdevDefPtr *hostdevs,
- int nhostdevs,
- const char *oldStateDir)
+ int nhostdevs)
{
size_t i;
if (actual) {
VIR_DEBUG("Restoring network configuration of PCI device %s",
virPCIDeviceGetName(actual));
- virHostdevRestoreNetConfig(hostdev, mgr->stateDir,
- oldStateDir);
+ virHostdevRestoreNetConfig(hostdev, mgr->stateDir);
}
}
}
}
-/* @oldStateDir:
- * For upgrade purpose: see virHostdevRestoreNetConfig
- */
void
virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
const char *drv_name,
const char *dom_name,
virDomainHostdevDefPtr *hostdevs,
- int nhostdevs,
- const char *oldStateDir)
+ int nhostdevs)
{
g_autoptr(virPCIDeviceList) pcidevs = NULL;
}
virHostdevReAttachPCIDevicesImpl(mgr, drv_name, dom_name, pcidevs,
- hostdevs, nhostdevs, oldStateDir);
+ hostdevs, nhostdevs);
}
return 0;
}
-/* @oldStateDir
- * For upgrade purpose: see virHostdevReAttachPCIHostdevs
- */
void
virHostdevReAttachDomainDevices(virHostdevManagerPtr mgr,
const char *driver,
virDomainDefPtr def,
- unsigned int flags,
- const char *oldStateDir)
+ unsigned int flags)
{
if (!def->nhostdevs || !mgr)
return;
if (flags & VIR_HOSTDEV_SP_PCI) {
virHostdevReAttachPCIDevices(mgr, driver, def->name,
- def->hostdevs, def->nhostdevs,
- oldStateDir);
+ def->hostdevs, def->nhostdevs);
}
if (flags & VIR_HOSTDEV_SP_USB) {
goto cleanup;
virHostdevReAttachPCIDevicesImpl(hostdev_mgr,
- drv_name, dom_name, pciDevices,
- NULL, 0, NULL);
+ drv_name, dom_name, pciDevices, NULL, 0);
for (i = 0; i < virNVMeDeviceListCount(nvmeDevices); i++) {
virNVMeDevicePtr temp = virNVMeDeviceListGet(nvmeDevices, i);
inactive_count = virPCIDeviceListCount(mgr->inactivePCIHostdevs);
VIR_TEST_DEBUG("Test 0 hostdevs");
- virHostdevReAttachPCIDevices(mgr, drv_name, dom_name, NULL, 0, NULL);
+ virHostdevReAttachPCIDevices(mgr, drv_name, dom_name, NULL, 0);
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count);
CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count);
VIR_TEST_DEBUG("Test >=1 unmanaged hostdevs");
virHostdevReAttachPCIDevices(mgr, drv_name, dom_name,
- hostdevs, nhostdevs, NULL);
+ hostdevs, nhostdevs);
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count - nhostdevs);
CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count + nhostdevs);
inactive_count = virPCIDeviceListCount(mgr->inactivePCIHostdevs);
VIR_TEST_DEBUG("Test 0 hostdevs");
- virHostdevReAttachPCIDevices(mgr, drv_name, dom_name, NULL, 0, NULL);
+ virHostdevReAttachPCIDevices(mgr, drv_name, dom_name, NULL, 0);
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count);
CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count);
VIR_TEST_DEBUG("Test >=1 hostdevs");
virHostdevReAttachPCIDevices(mgr, drv_name, dom_name,
- hostdevs, nhostdevs, NULL);
+ hostdevs, nhostdevs);
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count - nhostdevs);
/* If testing a mixed roundtrip, devices are added back to the inactive
* list as soon as we detach from the guest */
/* Don't rely on a state that previous test cases might have
* left the manager in. Start with a clean slate. */
virHostdevReAttachPCIDevices(mgr, drv_name, dom_name,
- hostdevs, nhostdevs, NULL);
+ hostdevs, nhostdevs);
CHECK_NVME_LIST_COUNT(mgr->activeNVMeHostdevs, 0);
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, 0);