mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
qemu: Check for outstanding async job too
Currently, qemuDomainGetXMLDesc and qemudDomainGetInfo check for outstanding synchronous job before (eventual) monitor entering. However, there can be already async job set, e.g. migration.
This commit is contained in:
parent
086608de34
commit
a111b9e24f
@ -696,11 +696,17 @@ qemuDomainObjDiscardAsyncJob(struct qemud_driver *driver, virDomainObjPtr obj)
|
||||
}
|
||||
|
||||
static bool
|
||||
qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv, enum qemuDomainJob job)
|
||||
qemuDomainNestedJobAllowed(qemuDomainObjPrivatePtr priv, enum qemuDomainJob job)
|
||||
{
|
||||
return !priv->job.asyncJob || (priv->job.mask & JOB_MASK(job)) != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv, enum qemuDomainJob job)
|
||||
{
|
||||
return !priv->job.active && qemuDomainNestedJobAllowed(priv, job);
|
||||
}
|
||||
|
||||
/* Give up waiting for mutex after 30 seconds */
|
||||
#define QEMU_JOB_WAIT_TIME (1000ull * 30)
|
||||
|
||||
@ -736,7 +742,7 @@ retry:
|
||||
goto error;
|
||||
}
|
||||
|
||||
while (!nested && !qemuDomainJobAllowed(priv, job)) {
|
||||
while (!nested && !qemuDomainNestedJobAllowed(priv, job)) {
|
||||
if (virCondWaitUntil(&priv->job.asyncCond, &obj->lock, then) < 0)
|
||||
goto error;
|
||||
}
|
||||
@ -748,7 +754,7 @@ retry:
|
||||
|
||||
/* No job is active but a new async job could have been started while obj
|
||||
* was unlocked, so we need to recheck it. */
|
||||
if (!nested && !qemuDomainJobAllowed(priv, job))
|
||||
if (!nested && !qemuDomainNestedJobAllowed(priv, job))
|
||||
goto retry;
|
||||
|
||||
qemuDomainObjResetJob(priv);
|
||||
|
@ -277,4 +277,6 @@ void qemuDomainSetFakeReboot(struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
bool value);
|
||||
|
||||
bool qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv,
|
||||
enum qemuDomainJob job);
|
||||
#endif /* __QEMU_DOMAIN_H__ */
|
||||
|
@ -2068,7 +2068,7 @@ static int qemudDomainGetInfo(virDomainPtr dom,
|
||||
if ((vm->def->memballoon != NULL) &&
|
||||
(vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE)) {
|
||||
info->memory = vm->def->mem.max_balloon;
|
||||
} else if (!priv->job.active) {
|
||||
} else if (qemuDomainJobAllowed(priv, QEMU_JOB_QUERY)) {
|
||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
|
||||
goto cleanup;
|
||||
if (!virDomainObjIsActive(vm))
|
||||
@ -4400,7 +4400,7 @@ static char *qemuDomainGetXMLDesc(virDomainPtr dom,
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
/* Don't delay if someone's using the monitor, just use
|
||||
* existing most recent data instead */
|
||||
if (!priv->job.active) {
|
||||
if (qemuDomainJobAllowed(priv, QEMU_JOB_QUERY)) {
|
||||
if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_QUERY) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user