[libvirt] [PATCH v2 1/2] device_conf: Split virDomainDeviceInfoClear

Michal Privoznik mprivozn at redhat.com
Tue Aug 21 11:45:05 UTC 2018


On 08/21/2018 01:15 PM, Andrea Bolognani wrote:
> On Tue, 2018-08-21 at 12:12 +0200, Michal Privoznik wrote:
>>  void
>> -virDomainDeviceInfoClear(virDomainDeviceInfoPtr info)
>> +virDomainDeviceInfoClearAddress(virDomainDeviceInfoPtr info)
>>  {
>> -    VIR_FREE(info->alias);
>>      memset(&info->addr, 0, sizeof(info->addr));
>>      info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE;
>>      VIR_FREE(info->romfile);
> 
> Now virDomainDeviceInfoClearAddress() clears out *way more* than
> just the address, including romfile and other information not
> visible in the context... It should really only call memset and
> reset info->type in order for the name not to be very misleading.
> 
> [...]
>> +void
>> +virDomainDeviceInfoClear(virDomainDeviceInfoPtr info)
>> +{
>> +    VIR_FREE(info->alias);
>> +    virDomainDeviceInfoClearAddress(info);
>> +}
> 
> romfile and friends should be cleared out here along with the alias
> and, of course, the address :)
> 
> With that fixed
> 
>   Reviewed-by: Andrea Bolognani <abologna at redhat.com>
> 

Actually, this is not going to work either. If somebody specifies:
<master startport='1'/> into guestfwd XML we will parse it and format it
back. The only solution I see is to have a flag to
virDomainDeviceInfoParseXML() that parses just alias and nothing else.
Which of course doesn't fit into the rest of the flags it already has.
So the flag has to be the opposite: allow alias parsing and then fix all
the places where it is called.

Sigh. This is gotten too far for such unusual corner case. I'm just
going to close the bug as WONTFIX.

Thanks anyway.

Michal




More information about the libvir-list mailing list