1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-11 09:17:52 +03:00

qemu: hotplug: Reset device removal waiting code after vCPU unplug

If the delivery of the DEVICE_DELETED event for the vCPU being deleted
would time out, the code would not call 'qemuDomainResetDeviceRemoval'.

Since the waiting thread did not unregister itself prior to stopping the
waiting the monitor code would try to wake it up instead of dispatching
it to the event worker. As a result the unplug process would not be
completed and the definition would not be updated.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1428893
          https://bugzilla.redhat.com/show_bug.cgi?id=1427801
This commit is contained in:
Peter Krempa 2017-03-03 16:04:57 +01:00
parent d59ca12048
commit 8af68ea478

View File

@ -5355,6 +5355,7 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver,
int oldvcpus = virDomainDefGetVcpus(vm->def);
unsigned int nvcpus = vcpupriv->vcpus;
int rc;
int ret = -1;
if (!vcpupriv->alias) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
@ -5369,11 +5370,11 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver,
rc = qemuMonitorDelDevice(qemuDomainGetMonitor(vm), vcpupriv->alias);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
return -1;
goto cleanup;
if (rc < 0) {
virDomainAuditVcpu(vm, oldvcpus, oldvcpus - nvcpus, "update", false);
return -1;
goto cleanup;
}
if ((rc = qemuDomainWaitForDeviceRemoval(vm)) <= 0) {
@ -5381,10 +5382,17 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver,
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("vcpu unplug request timed out"));
return -1;
goto cleanup;
}
return qemuDomainRemoveVcpu(driver, vm, vcpu);
if (qemuDomainRemoveVcpu(driver, vm, vcpu) < 0)
goto cleanup;
ret = 0;
cleanup:
qemuDomainResetDeviceRemoval(vm);
return ret;
}