Re: [PATCH] storage: Fix incorrect format for <disk> <auth> XML

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

 



On 06.10.2015 23:22, John Ferlan wrote:
> 
> 
> On 10/06/2015 09:19 AM, Michal Privoznik wrote:
>> On 23.09.2015 22:54, John Ferlan wrote:
>>> https://bugzilla.redhat.com/show_bug.cgi?id=1256999
>>>
>>> When creating a copy of the 'authdef', need to take into account the
>>> slight variation between <disk> and <pool> before blindly copying
>>> the 'authType' field. This ensures virStorageAuthDefFormat will
>>> properly format the <auth> XML for a <disk>.
>>>
>>> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
>>> ---
>>>  src/util/virstoragefile.c | 7 ++++++-
>>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
>>> index 2aa1d90..0b72cb3 100644
>>> --- a/src/util/virstoragefile.c
>>> +++ b/src/util/virstoragefile.c
>>> @@ -1522,7 +1522,12 @@ virStorageAuthDefCopy(const virStorageAuthDef *src)
>>>      /* Not present for storage pool, but used for disk source */
>>>      if (VIR_STRDUP(ret->secrettype, src->secrettype) < 0)
>>>          goto error;
>>> -    ret->authType = src->authType;
>>> +    /* A <disk> uses secrettype, while a <pool> uses authType, so
>>> +     * if we have a secrettype, then don't copy authType; otherwise,
>>> +     * we will format the authType in <disk>
>>> +     */
>>> +    if (!ret->secrettype)
>>> +        ret->authType = src->authType;
>>>      ret->secretType = src->secretType;
>>
>> This seems like we have a bug somewhere if authType and secretType are
>> both set at the same time. Because the way I understand the code is that
>> only one from the pair can be non-null at the time. If so, I think we
>> should fix the bug and drop this if() here. 
> 
> The short answer is the bug was written long ago when disk and pool's
> were "allowed" to use a different formatted authdef XML and now we're
> stuck with it. The longer answer and details follow.

Oh, well. ACK then. If you want to propose any follow up patch, feel
free :-)

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]