[libvirt] [PATCH] conf: utility function to update entry in def->nets array

Laine Stump laine at redhat.com
Thu Sep 26 15:51:00 UTC 2019


On 9/26/19 3:28 AM, Michal Privoznik wrote:
> On 9/25/19 6:57 PM, Laine Stump wrote:
>
>> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>> index 0753904472..5f63c4f51e 100644
>> --- a/src/qemu/qemu_driver.c
>> +++ b/src/qemu/qemu_driver.c
>> @@ -8786,8 +8786,10 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr 
>> vmdef,
>>                                            false) < 0)
>>               return -1;
>>   -        virDomainNetDefFree(vmdef->nets[pos]);
>> -        vmdef->nets[pos] = net;
>> +        if (virDomainNetUpdate(vmdef, pos, net))
>> +            return -1;
>> +
>> +        virDomainNetDefFree(oldDev.data.net);
>>           dev->data.net = NULL;
>>           break;
>>
>
> The same code pattern occurrs in lxcDomainUpdateDeviceConfig() so you 
> may want to fix it the same way as you're doing here.


Sure. I try to keep changes in sync for all the hypervisors that support 
any particular operation, but sometimes I'm too focused on eliminating 
my specific problem and forget.





More information about the libvir-list mailing list