Re: [libvirt] [PATCH] avoid shutting down the vm twice

From: Jiri Denemark <jdenemar redhat com>

To: Eric Blake <eblake redhat com>

Cc: libvir-list redhat com

Subject: Re: [libvirt] [PATCH] avoid shutting down the vm twice

Date: Wed, 2 Feb 2011 14:18:47 +0100

> > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> > index 6140f0f..c527bb7 100644
> > --- a/src/qemu/qemu_driver.c
> > +++ b/src/qemu/qemu_driver.c
> > @@ -2972,7 +2972,11 @@ cleanup:
> > * pretend we never started it */
> > virCommandFree(cmd);
> > VIR_FORCE_CLOSE(logfile);
> > - qemudShutdownVMDaemon(driver, vm, 0);
> > + /* The vm may be cloesd in other thread, so we should check whether the
>
> s/cloesd/closed/
>
> > + * vm is active before shutdown.
> > + */
> > + if (virDomainObjIsActive(vm))
> > + qemudShutdownVMDaemon(driver, vm, 0);
>
> I'm still playing with this patch, but at first glance, it is making
> sense to me.
The patch makes sense to me, since we may unlock the domain object several
times before we get to the cleanup code. Thus the state may have changed by
the time we get there.
Eric, what is the result of you playing with the patch? Is it ok to ack and
push it?
Jirka