Re: [PATCH 5/9] libxl: prevent attaching multiple netdevs with the same MAC

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

 



Jim Fehlig wrote:
> Marek Marczykowski-Górecki wrote:
>   
>> It will not be possible to detach such device later. Also improve
>> logging in such cases.
>>
>> Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
>> ---
>>  src/libxl/libxl_driver.c | 15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
>>
>> Changes in v4:
>>  - use virDomainHasNet instead of virDomainNetFindIdx
>>
>> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
>> index ce3a99b..1313d2e 100644
>> --- a/src/libxl/libxl_driver.c
>> +++ b/src/libxl/libxl_driver.c
>> @@ -2787,6 +2787,7 @@ libxlDomainAttachNetDevice(libxlDriverPrivatePtr driver,
>>      int actualType;
>>      libxl_device_nic nic;
>>      int ret = -1;
>> +    char mac[VIR_MAC_STRING_BUFLEN];
>>  
>>      /* preallocate new slot for device */
>>      if (VIR_REALLOC_N(vm->def->nets, vm->def->nnets + 1) < 0)
>> @@ -2801,6 +2802,13 @@ libxlDomainAttachNetDevice(libxlDriverPrivatePtr driver,
>>  
>>      actualType = virDomainNetGetActualType(net);
>>  
>> +    if (virDomainHasNet(vm->def, net)) {
>> +        virReportError(VIR_ERR_OPERATION_FAILED,
>> +                _("device matching mac address %s already exists"),
>>   
>> + virMacAddrFormat(&net->mac, mac));
>>     
>
> I think the error should be VIR_ERR_INVALID_ARG, like you've done in the
> last hunk below.  I'll change that, and use the same text in both error
> reports, before pushing.  Otherwise, ACK.
>   

With the exception of 4 and 5, the patches in this series are
unrelated.  I have a question about 6, but in the meantime it seemed
like a good point to push the first 5.  Done now.

Regards,
Jim

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