From 6c3639df31680a03e03ad1e0f1ad489db595c02d Mon Sep 17 00:00:00 2001
From: Bihong Yu <yubihong@huawei.com>
Date: Tue, 11 Jan 2022 10:28:43 +0100
Subject: [PATCH 02/22] qemu: Log which API is trying to acquire a job
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Log which API is trying to acquire a job.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Bihong Yu <yubihong@huawei.com>
---
 src/qemu/qemu_domain.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index b7fb4eb9f9..bf09ad517b 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9811,9 +9811,11 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
     unsigned long long duration = 0;
     unsigned long long agentDuration = 0;
     unsigned long long asyncDuration = 0;
+    const char *currentAPI = virThreadJobGet();
 
-    VIR_DEBUG("Starting job: job=%s agentJob=%s asyncJob=%s "
+    VIR_DEBUG("Starting job: API=%s job=%s agentJob=%s asyncJob=%s "
               "(vm=%p name=%s, current job=%s agentJob=%s async=%s)",
+              NULLSTR(currentAPI),
               qemuDomainJobTypeToString(job),
               qemuDomainAgentJobTypeToString(agentJob),
               qemuDomainAsyncJobTypeToString(asyncJob),
@@ -9916,13 +9918,14 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
     if (priv->job.asyncJob && priv->job.asyncStarted)
         asyncDuration = now - priv->job.asyncStarted;
 
-    VIR_WARN("Cannot start job (%s, %s, %s) for domain %s; "
+    VIR_WARN("Cannot start job (%s, %s, %s) in API %s for domain %s; "
              "current job is (%s, %s, %s) "
              "owned by (%llu %s, %llu %s, %llu %s (flags=0x%lx)) "
              "for (%llus, %llus, %llus)",
              qemuDomainJobTypeToString(job),
              qemuDomainAgentJobTypeToString(agentJob),
              qemuDomainAsyncJobTypeToString(asyncJob),
+             NULLSTR(currentAPI),
              obj->def->name,
              qemuDomainJobTypeToString(priv->job.active),
              qemuDomainAgentJobTypeToString(priv->job.agentActive),
-- 
2.33.0

