提交 c3e2f6e3 编写于 作者: A Andrea Bolognani

hostdev: Save netdev configuration of actual device

We would be just fine looking up the information in pcidevs most
of the time; however, some corner cases would not be handled
properly, so look up the actual device instead.
上级 81128609
...@@ -689,7 +689,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr, ...@@ -689,7 +689,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
/* Step 7: Now set the original states for hostdev def */ /* Step 7: Now set the original states for hostdev def */
for (i = 0; i < nhostdevs; i++) { for (i = 0; i < nhostdevs; i++) {
virPCIDevicePtr pci; virPCIDevicePtr actual;
virDomainHostdevDefPtr hostdev = hostdevs[i]; virDomainHostdevDefPtr hostdev = hostdevs[i];
virDomainHostdevSubsysPCIPtr pcisrc = &hostdev->source.subsys.u.pci; virDomainHostdevSubsysPCIPtr pcisrc = &hostdev->source.subsys.u.pci;
...@@ -698,24 +698,27 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr, ...@@ -698,24 +698,27 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
continue; continue;
pci = virPCIDeviceListFindByIDs(pcidevs, /* We need to look up the actual device because it's the one
pcisrc->addr.domain, * that contains the information we care about (unbind_from_stub,
pcisrc->addr.bus, * remove_slot, reprobe) */
pcisrc->addr.slot, actual = virPCIDeviceListFindByIDs(mgr->activePCIHostdevs,
pcisrc->addr.function); pcisrc->addr.domain,
pcisrc->addr.bus,
pcisrc->addr.slot,
pcisrc->addr.function);
/* Appropriate values for the unbind_from_stub, remove_slot /* Appropriate values for the unbind_from_stub, remove_slot
* and reprobe properties of the device were set earlier * and reprobe properties of the device were set earlier
* by virPCIDeviceDetach() */ * by virPCIDeviceDetach() */
if (pci) { if (actual) {
VIR_DEBUG("Saving network configuration of PCI device %s", VIR_DEBUG("Saving network configuration of PCI device %s",
virPCIDeviceGetName(pci)); virPCIDeviceGetName(actual));
hostdev->origstates.states.pci.unbind_from_stub = hostdev->origstates.states.pci.unbind_from_stub =
virPCIDeviceGetUnbindFromStub(pci); virPCIDeviceGetUnbindFromStub(actual);
hostdev->origstates.states.pci.remove_slot = hostdev->origstates.states.pci.remove_slot =
virPCIDeviceGetRemoveSlot(pci); virPCIDeviceGetRemoveSlot(actual);
hostdev->origstates.states.pci.reprobe = hostdev->origstates.states.pci.reprobe =
virPCIDeviceGetReprobe(pci); virPCIDeviceGetReprobe(actual);
} }
} }
...@@ -898,17 +901,17 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr, ...@@ -898,17 +901,17 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
if (virHostdevIsPCINetDevice(hostdev)) { if (virHostdevIsPCINetDevice(hostdev)) {
virDomainHostdevSubsysPCIPtr pcisrc = &hostdev->source.subsys.u.pci; virDomainHostdevSubsysPCIPtr pcisrc = &hostdev->source.subsys.u.pci;
virPCIDevicePtr pci; virPCIDevicePtr actual;
pci = virPCIDeviceListFindByIDs(pcidevs, actual = virPCIDeviceListFindByIDs(mgr->inactivePCIHostdevs,
pcisrc->addr.domain, pcisrc->addr.domain,
pcisrc->addr.bus, pcisrc->addr.bus,
pcisrc->addr.slot, pcisrc->addr.slot,
pcisrc->addr.function); pcisrc->addr.function);
if (pci) { if (actual) {
VIR_DEBUG("Restoring network configuration of PCI device %s", VIR_DEBUG("Restoring network configuration of PCI device %s",
virPCIDeviceGetName(pci)); virPCIDeviceGetName(actual));
virHostdevNetConfigRestore(hostdev, mgr->stateDir, virHostdevNetConfigRestore(hostdev, mgr->stateDir,
oldStateDir); oldStateDir);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册