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

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



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 redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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