Currently, qemuDomainGetXMLDesc and qemudDomainGetInfo check for
outstanding synchronous job before (eventual) monitor entering.
However, there can be already async job set, e.g. migration.
---
src/qemu/qemu_domain.c | 12 +++++++++---
src/qemu/qemu_domain.h | 2 ++
src/qemu/qemu_driver.c | 4 ++--
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 320a35c..d3ad192 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -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);
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 3b09419..cdf1375 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -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__ */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ffa8b4c..a094fcc 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2019,7 +2019,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))
@@ -4351,7 +4351,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;
--
1.7.3.4
Show replies by date
On 09/29/2011 09:01 AM, Michal Privoznik wrote:
Currently, qemuDomainGetXMLDesc and qemudDomainGetInfo check for
outstanding synchronous job before (eventual) monitor entering.
However, there can be already async job set, e.g. migration.
---
src/qemu/qemu_domain.c | 12 +++++++++---
src/qemu/qemu_domain.h | 2 ++
src/qemu/qemu_driver.c | 4 ++--
3 files changed, 13 insertions(+), 5 deletions(-)
Looks reasonable. ACK.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org
On 29.09.2011 17:26, Eric Blake wrote:
On 09/29/2011 09:01 AM, Michal Privoznik wrote:
> Currently, qemuDomainGetXMLDesc and qemudDomainGetInfo check for
> outstanding synchronous job before (eventual) monitor entering.
> However, there can be already async job set, e.g. migration.
> ---
> src/qemu/qemu_domain.c | 12 +++++++++---
> src/qemu/qemu_domain.h | 2 ++
> src/qemu/qemu_driver.c | 4 ++--
> 3 files changed, 13 insertions(+), 5 deletions(-)
Looks reasonable. ACK.
Thanks, pushed.