[libvirt] [PATCHv4 02/10] Implement domainMemoryStats API slot for LXC driver.

Michal Privoznik mprivozn at redhat.com
Fri Feb 21 08:03:40 UTC 2014


On 20.02.2014 22:04, Thorsten Behrens wrote:
> Hi Michal,
>
> thx for further cleaning up, and pushing -
>
> Michal Privoznik wrote:
>>> +    if (!virCgroupGetMemoryUsage(priv->cgroup, &mem_usage))
>>> +        goto cleanup;
>>> +
>>> +    ret = 0;
>>> +    if (!virDomainObjIsActive(vm))
>>> +        goto cleanup;
>>
>> I think these two lines (well three), otherwise we don't fail on
>> inactive domain, in contrast with qemu driver for instance.
>>
> Yeah. Though there are cases (e.g. lxcDomainGetInfo()), where a
> stopped domain is not a hard error. I might have been mislead, but was
> working under the assumption that get methods (that could return
> something sensible, like zero cpu time for a stopped domain) would be
> fine to fail more gracefully?

I don't think so. I mean, we allow users to get status of any domain. So 
they can just check the status of domain prior to getting any runtime 
info. We shouldn't return an empty info as it might confuse callers: is 
the domain not running or libvirt isn't possible to get any data? And to 
distinguish these two states, they'd have to call getDomainState anyway.

Michal




More information about the libvir-list mailing list