[libvirt] [PATCH] fix virsh dominfo returns error when virNodeGetSecurityModel() is not supported.

Tatsuro Enokura fj2026af at aa.jp.fujitsu.com
Mon Jun 22 04:24:53 UTC 2009


Hi Dan,

Daniel P. Berrange wrote:
>>> Index: src/virsh.c
>>> ===================================================================
>>> RCS file: /data/cvs/libvirt/src/virsh.c,v
>>> retrieving revision 1.210
>>> diff -u -p -u -r1.210 virsh.c
>>> --- src/virsh.c	3 Jun 2009 12:13:52 -0000	1.210
>>> +++ src/virsh.c	18 Jun 2009 11:14:44 -0000
>>> @@ -1643,8 +1643,10 @@ cmdDominfo(vshControl *ctl, const vshCmd
>>>       /* Security model and label information */
>>>       memset(&secmodel, 0, sizeof secmodel);
>>>       if (virNodeGetSecurityModel(ctl->conn,&secmodel) == -1) {
>>> -        virDomainFree(dom);
>>> -        return FALSE;
>>> +        if (last_error->code != VIR_ERR_NO_SUPPORT) {
>>> +            virDomainFree(dom);
>>> +            return FALSE;
>>> +        }
>>>       } else {
>>>           /* Only print something if a security model is active */
>>>           if (secmodel.model[0] != '\0') {
>> Don't check last_error->code of virDomainGetSecurityLabel()?
>> should check the same as virNodeGetSecurityModel().
>
> I don't think that is neccessary. You'll only invoke virDomainGetSecurityLabel
> if virNodeGetSecurityModel() was asuccessfull and the returned secmodel
> is not the empty string. In such a scenario I'd expect the call to
> virDomainGetSecurityLabel() to always be successful and would want the
> user to see any error if it fail

OK, I understood.

I try your patch, works fine.

Thanks
Tatsuro Enokura




More information about the libvir-list mailing list