1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

qemu: Reset the maximum locked memory on hotplug fail

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@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Eric Farman 2019-09-03 22:09:47 +02:00 committed by Pavel Hrdina
parent 4b2998432a
commit 94714594c5

View File

@ -1582,6 +1582,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;
@ -1623,6 +1624,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
if (qemuDomainAdjustMaxMemLockHostdev(vm, hostdev) < 0)
goto error;
teardownmemlock = true;
if (qemuDomainNamespaceSetupHostdev(vm, hostdev) < 0)
goto error;
@ -1690,6 +1692,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);