[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 5/8] virsh: Prefer virDomainGetState over virDomainGetInfo



On Wed, May 04, 2011 at 17:35:42 -0600, Eric Blake wrote:
> > +    bool noGetState;            /* virDomainGetState is not supported in
> > +                                 * current connection */
> 
> Nice - remembering the failure once, so you don't have to repeat it.
> However, I don't like double negatives; could we instead have:

Yeah, I especially wanted this for virsh list to avoid calling
virDomainGetState over and over even though it is not supported.

> bool useGetInfo /* must use virDomainGetInfo, since virDomainGetState
> failed */

Makes sense.

> > @@ -3063,12 +3068,6 @@ cmdSetmaxmem(vshControl *ctl, const vshCmd *cmd)
> >          return false;
> >      }
> >  
> > -    if (virDomainGetInfo(dom, &info) != 0) {
> > -        virDomainFree(dom);
> > -        vshError(ctl, "%s", _("Unable to verify current MemorySize"));
> > -        return false;
> > -    }
> > -
> 
> This seems like one case where we still want to keep the
> virDomainGetInfo and actually query the guest.

I don't think this is needed since it doesn't really verify anything. It just
checks if virDomainGetInfo fails or not. And even if it did verify something,
it's really a job of virDomainSetMaxMemory or virDomainSetMemoryFlags, virsh
should only check the parameters it got from its user.

Jirka


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]