mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Make sure qemudDomainSetVcpus doesn't hang.
The code to add job support into libvirtd caused a problem in qemudDomainSetVcpus. In particular, a qemuDomainObjEndJob() call was added at the end of the function, but a corresponding qemuDomainObjBeginJob() was not. Additionally, a call to qemuDomainObj{Enter,Exit}Monitor() was also missed in qemudDomainHotplugVcpus(). These missing calls conspired to cause a hang in the libvirtd process after the command was finished. Fix this by adding the missing calls. Signed-off-by: Chris Lalancette <clalance@redhat.com>
This commit is contained in:
parent
8a7f4b8dc1
commit
2c555d87b0
@ -4514,7 +4514,9 @@ static int qemudDomainHotplugVcpus(virDomainObjPtr vm, unsigned int nvcpus)
|
|||||||
if (nvcpus > vm->def->vcpus) {
|
if (nvcpus > vm->def->vcpus) {
|
||||||
for (i = vm->def->vcpus ; i < nvcpus ; i++) {
|
for (i = vm->def->vcpus ; i < nvcpus ; i++) {
|
||||||
/* Online new CPU */
|
/* Online new CPU */
|
||||||
|
qemuDomainObjEnterMonitor(vm);
|
||||||
rc = qemuMonitorSetCPU(priv->mon, i, 1);
|
rc = qemuMonitorSetCPU(priv->mon, i, 1);
|
||||||
|
qemuDomainObjExitMonitor(vm);
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
goto unsupported;
|
goto unsupported;
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
@ -4525,7 +4527,9 @@ static int qemudDomainHotplugVcpus(virDomainObjPtr vm, unsigned int nvcpus)
|
|||||||
} else {
|
} else {
|
||||||
for (i = vm->def->vcpus - 1 ; i >= nvcpus ; i--) {
|
for (i = vm->def->vcpus - 1 ; i >= nvcpus ; i--) {
|
||||||
/* Offline old CPU */
|
/* Offline old CPU */
|
||||||
|
qemuDomainObjEnterMonitor(vm);
|
||||||
rc = qemuMonitorSetCPU(priv->mon, i, 0);
|
rc = qemuMonitorSetCPU(priv->mon, i, 0);
|
||||||
|
qemuDomainObjExitMonitor(vm);
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
goto unsupported;
|
goto unsupported;
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
@ -4558,18 +4562,21 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
|
|||||||
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||||
qemuDriverUnlock(driver);
|
qemuDriverUnlock(driver);
|
||||||
|
|
||||||
|
if (qemuDomainObjBeginJob(vm) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (!vm) {
|
if (!vm) {
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
virUUIDFormat(dom->uuid, uuidstr);
|
virUUIDFormat(dom->uuid, uuidstr);
|
||||||
qemuReportError(VIR_ERR_NO_DOMAIN,
|
qemuReportError(VIR_ERR_NO_DOMAIN,
|
||||||
_("no domain with matching uuid '%s'"), uuidstr);
|
_("no domain with matching uuid '%s'"), uuidstr);
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virDomainObjIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
qemuReportError(VIR_ERR_OPERATION_INVALID,
|
qemuReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(type = virDomainVirtTypeToString(vm->def->virtType))) {
|
if (!(type = virDomainVirtTypeToString(vm->def->virtType))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user