
Dan Smith wrote:
# HG changeset patch # User Dan Smith <danms@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@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