Re: [PATCH 2/4] conf: Parse and format disk <wwn>

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

 



On 08/30/2012 09:14 AM, Paolo Bonzini wrote:
> Il 29/08/2012 18:36, Osier Yang ha scritto:
>> @@ -11557,6 +11564,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
>>      if (def->transient)
>>          virBufferAddLit(buf, "      <transient/>\n");
>>      virBufferEscapeString(buf, "      <serial>%s</serial>\n", def->serial);
>> +    virBufferEscapeString(buf, "      <wwn>%s</wwn>\n", def->wwn);
> 
> What happens if the wwn was not passed?

virBufferEscapeString() is magic - if def->wwn is NULL, then the entire
output string is omitted from buf.  We use that idiom all over the place.

> 
> If it is NULL, it's a bug (same for serial).
> 
> If it is empty, the output will not obey the schema, so the whole
> element should be left out.

Yep, that is what will happen, with the code as-is.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]