[libvirt PATCH] qemu: Update asyncOwnerAPI when entering async job phase

Jiri Denemark posted 1 patch 3 years, 1 month ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/ec802dc52f07286af7e7a1371f1974c878db60a1.1616190145.git.jdenemar@redhat.com
src/qemu/qemu_domainjob.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[libvirt PATCH] qemu: Update asyncOwnerAPI when entering async job phase
Posted by Jiri Denemark 3 years, 1 month ago
In case an async job spans multiple APIs (e.g., incoming migration) the
API that started the job is recorded as the asyncOwnerAPI even though it
is no longer running and the owner thread is updated properly to the one
currently handling the job. Let's also update asyncOwnerAPI to make it
more obvious which is the current (or the most recent) API involved in
the job.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_domainjob.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index b58d6837ad..50cfc45f5b 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -711,7 +711,9 @@ qemuDomainObjSetJobPhase(virQEMUDriverPtr driver,
               qemuDomainAsyncJobTypeToString(priv->job.asyncJob),
               qemuDomainAsyncJobPhaseToString(priv->job.asyncJob, phase));
 
-    if (priv->job.asyncOwner && me != priv->job.asyncOwner) {
+    if (priv->job.asyncOwner == 0) {
+        priv->job.asyncOwnerAPI = g_strdup(virThreadJobGet());
+    } else if (me != priv->job.asyncOwner) {
         VIR_WARN("'%s' async job is owned by thread %llu",
                  qemuDomainAsyncJobTypeToString(priv->job.asyncJob),
                  priv->job.asyncOwner);
-- 
2.31.0

Re: [libvirt PATCH] qemu: Update asyncOwnerAPI when entering async job phase
Posted by Erik Skultety 3 years ago
On Fri, Mar 19, 2021 at 10:42:25PM +0100, Jiri Denemark wrote:
> In case an async job spans multiple APIs (e.g., incoming migration) the
> API that started the job is recorded as the asyncOwnerAPI even though it
> is no longer running and the owner thread is updated properly to the one
> currently handling the job. Let's also update asyncOwnerAPI to make it
> more obvious which is the current (or the most recent) API involved in
> the job.
> 
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
Reviewed-by: Erik Skultety <eskultet@redhat.com>

Re: [libvirt PATCH] qemu: Update asyncOwnerAPI when entering async job phase
Posted by Michal Privoznik 3 years ago
On 3/19/21 10:42 PM, Jiri Denemark wrote:
> In case an async job spans multiple APIs (e.g., incoming migration) the
> API that started the job is recorded as the asyncOwnerAPI even though it
> is no longer running and the owner thread is updated properly to the one
> currently handling the job. Let's also update asyncOwnerAPI to make it
> more obvious which is the current (or the most recent) API involved in
> the job.
> 
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>   src/qemu/qemu_domainjob.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
> index b58d6837ad..50cfc45f5b 100644
> --- a/src/qemu/qemu_domainjob.c
> +++ b/src/qemu/qemu_domainjob.c
> @@ -711,7 +711,9 @@ qemuDomainObjSetJobPhase(virQEMUDriverPtr driver,
>                 qemuDomainAsyncJobTypeToString(priv->job.asyncJob),
>                 qemuDomainAsyncJobPhaseToString(priv->job.asyncJob, phase));
>   
> -    if (priv->job.asyncOwner && me != priv->job.asyncOwner) {
> +    if (priv->job.asyncOwner == 0) {
> +        priv->job.asyncOwnerAPI = g_strdup(virThreadJobGet());
> +    } else if (me != priv->job.asyncOwner) {
>           VIR_WARN("'%s' async job is owned by thread %llu",
>                    qemuDomainAsyncJobTypeToString(priv->job.asyncJob),
>                    priv->job.asyncOwner);
> 

Could this be related to a problem I've reviewed earlier?

https://listman.redhat.com/archives/libvir-list/2021-March/msg00933.html

Or maybe not. IDK.

Michal

Re: [libvirt PATCH] qemu: Update asyncOwnerAPI when entering async job phase
Posted by Jiri Denemark 3 years ago
On Mon, Mar 22, 2021 at 11:17:12 +0100, Michal Privoznik wrote:
> On 3/19/21 10:42 PM, Jiri Denemark wrote:
> > In case an async job spans multiple APIs (e.g., incoming migration) the
> > API that started the job is recorded as the asyncOwnerAPI even though it
> > is no longer running and the owner thread is updated properly to the one
> > currently handling the job. Let's also update asyncOwnerAPI to make it
> > more obvious which is the current (or the most recent) API involved in
> > the job.
> > 
> > Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> > ---
> >   src/qemu/qemu_domainjob.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
> > index b58d6837ad..50cfc45f5b 100644
> > --- a/src/qemu/qemu_domainjob.c
> > +++ b/src/qemu/qemu_domainjob.c
> > @@ -711,7 +711,9 @@ qemuDomainObjSetJobPhase(virQEMUDriverPtr driver,
> >                 qemuDomainAsyncJobTypeToString(priv->job.asyncJob),
> >                 qemuDomainAsyncJobPhaseToString(priv->job.asyncJob, phase));
> >   
> > -    if (priv->job.asyncOwner && me != priv->job.asyncOwner) {
> > +    if (priv->job.asyncOwner == 0) {
> > +        priv->job.asyncOwnerAPI = g_strdup(virThreadJobGet());
> > +    } else if (me != priv->job.asyncOwner) {
> >           VIR_WARN("'%s' async job is owned by thread %llu",
> >                    qemuDomainAsyncJobTypeToString(priv->job.asyncJob),
> >                    priv->job.asyncOwner);
> > 
> 
> Could this be related to a problem I've reviewed earlier?
> 
> https://listman.redhat.com/archives/libvir-list/2021-March/msg00933.html
> 
> Or maybe not. IDK.

I don't think so. This just making debug and error messages a bit more
logical as asyncOwnerAPI is not really used for anything but showing
which thread is "hanging" in a job in case another thread times out
waiting for a job.

Jirka