On 9/3/19 5:09 PM, Eric Farman wrote:
If attaching a PCI hostdev fails, there are several things that
need to be un-done as part of the cleanup. One thing that is
not done is re-calculating/re-setting the maximum amount of locked
memory for the domain, since we may have changed that.
Let's fix that, just to ensure everything is back the way it was.
Signed-off-by: Eric Farman <farman@xxxxxxxxxxxxx>
---
Ouch. This is a bug fix that should be pushed regardless of the rest of the
series, IMHO.
Reviewed-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
src/qemu/qemu_hotplug.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 24e75e49be..979e97b608 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1469,6 +1469,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
bool teardowncgroup = false;
bool teardownlabel = false;
bool teardowndevice = false;
+ bool teardownmemlock = false;
int backend;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
unsigned int flags = 0;
@@ -1510,6 +1511,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
if (qemuDomainAdjustMaxMemLockHostdev(vm, hostdev) < 0)
goto error;
+ teardownmemlock = true;
if (qemuDomainNamespaceSetupHostdev(vm, hostdev) < 0)
goto error;
@@ -1577,6 +1579,8 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
if (teardowndevice &&
qemuDomainNamespaceTeardownHostdev(vm, hostdev) < 0)
VIR_WARN("Unable to remove host device from /dev");
+ if (teardownmemlock && qemuDomainAdjustMaxMemLock(vm) < 0)
+ VIR_WARN("Unable to reset maximum locked memory on hotplug fail");
if (releaseaddr)
qemuDomainReleaseDeviceAddress(vm, info);
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list