]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuDomainObjBeginJobInternal: Report agent job in error message
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 20 Jun 2018 12:17:45 +0000 (14:17 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 26 Jun 2018 13:10:17 +0000 (15:10 +0200)
If a thread is unable to acquire a job (e.g. because of timeout)
an error is reported and the error message contains reference to
the other thread holding the job. Well, the error message should
report agent job too as it is yet another source of possible
failure.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_domain.c

index 6d203e1f2e61786efdf73dbc50da88d590cffefb..f8a662f7475d18f67cb9b4ed1026062701e8be05 100644 (file)
@@ -6420,6 +6420,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
     bool async = job == QEMU_JOB_ASYNC;
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
     const char *blocker = NULL;
+    const char *agentBlocker = NULL;
     int ret = -1;
     unsigned long long duration = 0;
     unsigned long long agentDuration = 0;
@@ -6549,16 +6550,32 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
              priv->job.apiFlags,
              duration / 1000, agentDuration / 1000, asyncDuration / 1000);
 
-    if (nested || qemuDomainNestedJobAllowed(priv, job))
-        blocker = priv->job.ownerAPI;
-    else
-        blocker = priv->job.asyncOwnerAPI;
+    if (job) {
+        if (nested || qemuDomainNestedJobAllowed(priv, job))
+            blocker = priv->job.ownerAPI;
+        else
+            blocker = priv->job.asyncOwnerAPI;
+    }
+
+    if (agentJob)
+        agentBlocker = priv->job.agentOwnerAPI;
 
     if (errno == ETIMEDOUT) {
-        if (blocker) {
+        if (blocker && agentBlocker) {
+            virReportError(VIR_ERR_OPERATION_TIMEOUT,
+                           _("cannot acquire state change "
+                             "lock (held by monitor=%s agent=%s)"),
+                           blocker, agentBlocker);
+        } else if (blocker) {
             virReportError(VIR_ERR_OPERATION_TIMEOUT,
-                           _("cannot acquire state change lock (held by %s)"),
+                           _("cannot acquire state change "
+                             "lock (held by monitor=%s)"),
                            blocker);
+        } else if (agentBlocker) {
+            virReportError(VIR_ERR_OPERATION_TIMEOUT,
+                           _("cannot acquire state change "
+                             "lock (held by agent=%s)"),
+                           agentBlocker);
         } else {
             virReportError(VIR_ERR_OPERATION_TIMEOUT, "%s",
                            _("cannot acquire state change lock"));
@@ -6566,11 +6583,24 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
         ret = -2;
     } else if (cfg->maxQueuedJobs &&
                priv->jobs_queued > cfg->maxQueuedJobs) {
-        if (blocker) {
+        if (blocker && agentBlocker) {
+            virReportError(VIR_ERR_OPERATION_FAILED,
+                           _("cannot acquire state change "
+                             "lock (held by monitor=%s agent=%s) "
+                             "due to max_queued limit"),
+                           blocker, agentBlocker);
+        } else if (blocker) {
             virReportError(VIR_ERR_OPERATION_FAILED,
-                           _("cannot acquire state change lock (held by %s) "
+                           _("cannot acquire state change "
+                             "lock (held by monitor=%s) "
                              "due to max_queued limit"),
                            blocker);
+        } else if (agentBlocker) {
+            virReportError(VIR_ERR_OPERATION_FAILED,
+                           _("cannot acquire state change "
+                             "lock (held by agent=%s) "
+                             "due to max_queued limit"),
+                           agentBlocker);
         } else {
             virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                            _("cannot acquire state change lock "