[Libvirt-cim] [PATCH 1 of 2] Make domain_online() re-lookup domain to make sure we're getting fresh info
Jay Gagnon
grendel at linux.vnet.ibm.com
Tue Mar 25 13:59:10 UTC 2008
Dan Smith wrote:
> # HG changeset patch
> # User Dan Smith <danms at us.ibm.com>
> # Date 1206112986 25200
> # Node ID c3dca3932e0b9f80778cbd6cbdfa09de4a7632a9
> # Parent 594c9195e59c8025ea18b3d6b5ca43b322db55e1
> Make domain_online() re-lookup domain to make sure we're getting fresh info
>
> This is necessary if you're using domain_online() in a polling loop.
>
> Signed-off-by: Dan Smith <danms at us.ibm.com>
>
> diff -r 594c9195e59c -r c3dca3932e0b libxkutil/misc_util.c
> --- a/libxkutil/misc_util.c Thu Mar 20 13:13:57 2008 -0700
> +++ b/libxkutil/misc_util.c Fri Mar 21 08:23:06 2008 -0700
> @@ -378,12 +378,25 @@ bool domain_online(virDomainPtr dom)
> bool domain_online(virDomainPtr dom)
> {
> virDomainInfo info;
> -
> - if (virDomainGetInfo(dom, &info) != 0)
> + virDomainPtr _dom;
> + bool rc;
> +
> + _dom = virDomainLookupByName(virDomainGetConnect(dom),
> + virDomainGetName(dom));
> + if (_dom == NULL) {
> + CU_DEBUG("Unable to re-lookup domain");
> return false;
>
I definitely could be wrong here, but I thought that virDomainGetInfo
got live info regardless of the age of the virDomainPtr, as long as it
still referenced the right domain. I seem to remember running into that
when I was writing the ComputerSystemModifiedIndication code, and that
was the reason I had to get XML description and store it, instead of
just pulling from two different virDomainPtrs and comparing.
That said, this can't hurt, so if we don't have a definite answer I'm
totally cool with it.
--
-Jay
More information about the Libvirt-cim
mailing list