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

Laine Stump laine at redhat.com
Thu Sep 26 17:03:22 UTC 2019


On 9/26/19 11:51 AM, Laine Stump wrote:
> 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.


... although to be fair, lxc doesn't support <interface type='hostdev'> 
(or <hostdev mode='subsystem' type='pci'> at all, which is what's 
implied by <interface type='hostdev'>).


Still, it doesn't harm anything to use the common function (which 
reduces to just replacing the nets entry




More information about the libvir-list mailing list