[libvirt] [PATCH] LXC fix virCgroupGetValueStr on handling a string terminated with '\n'

Ryota Ozaki ozaki.ryota at gmail.com
Wed Oct 21 11:54:59 UTC 2009


On Mon, Oct 19, 2009 at 9:39 PM, Daniel Veillard <veillard at redhat.com> wrote:
> On Sat, Oct 17, 2009 at 09:30:12AM +0900, Ryota Ozaki wrote:

>> OK, I've looked into a bit deep and found the following sequence happens.
>>
>> In cmdDominfo (virsh.c), if virDomainGetInfo fails, 'ret' is set with FALSE.
>> Even so, further virNodeGetSecurityModel is called too. And if it also fails
>> then VIR_ERR_NO_SUPPORT is set. Normally, VIR_ERR_NO_SUPPORT does not lead
>> cmdDominfo failed, however, 'ret' is previously set with FALSE, then virsh
>> fails.
>
>  Okidoc, I applied the last patch. Thanks !
>
>  I wonder if we also need to fix the logic in virsh.c:cmdDominfo() ,
> maybe by making:
>
>  if (last_error->code != VIR_ERR_NO_SUPPORT) {
>
>  into
>
>  if ((last_error->code != VIR_ERR_NO_SUPPORT) && (ret != FALSE)) {
>
> or by resetting last_error as well as setting ret to false when
> virDomainGetInfo() fails.

I'm not sure I understand you are saying, I think it's not sufficient
because what we need to consider in the case is that
virDomainGetInfo() fails and virNodeGetSecurityModel() fails
with VIR_ERR_NO_SUPPORT.

So we probably need to save an error of virDomainGetInfo()
before calling virNodeGetSecurityModel() and restore it if
virNodeGetSecurityModel() fails with VIR_ERR_NO_SUPPORT.

Nonetheless, if both functions fails (with except
VIR_ERR_NO_SUPPORT), we have to discard either of
two error codes because we have one container for them...

  ozaki-r

>
> Daniel
>
> --
> Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
> daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
> http://veillard.com/ | virtualization library  http://libvirt.org/
>




More information about the libvir-list mailing list