[libvirt] [PATCH 2/2] qemu: Warn on possibly incorrect usage of EnterMonitor*

Eric Blake eblake at redhat.com
Tue Apr 10 16:25:17 UTC 2012


On 04/10/2012 09:05 AM, Jiri Denemark wrote:
> qemuDomainObjEnterMonitor{,WithDriver} should not be called from async
> jobs, only EnterMonitorAsync variant is allowed.
> ---
>  src/qemu/qemu_domain.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 7f1f8ee..4dda2e0 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -975,6 +975,9 @@ qemuDomainObjEnterMonitorInternal(struct qemud_driver *driver,
>                              _("unexpected async job %d"), asyncJob);
>              return -1;
>          }
> +        if (priv->job.asyncOwner != virThreadSelfID())
> +            VIR_WARN("This thread doesn't seem to be the async job owner: %d",
> +                     priv->job.asyncOwner);

virThreadSelfID() is not bullet-proof (it returns int, but there are
platforms with 64-bit thread ids); but it is adequate for our purposes
(you only check it for issuing a warning, rather than actually erroring
out, and on our common development platform of Linux, it does the right
thing).

ACK series.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120410/4e1c8ac3/attachment-0001.sig>


More information about the libvir-list mailing list