[libvirt] [PATCH] qemu: fix attach/detach of netdevs with matching mac addrs

Eric Blake eblake at redhat.com
Fri Oct 26 20:54:46 UTC 2012


On 10/25/2012 02:31 PM, Laine Stump wrote:
> This resolves:
> 
>    https://bugzilla.redhat.com/show_bug.cgi?id=862515
> 
> which describes inconsistencies in dealing with duplicate mac
> addresses on network devices in a domain.
> 
> (at any rate, it resolves *almost* everything, and prints out an
> informative error message for the one problem that isn't solved, but
> has a workaround.)
> 

> @@ -6158,14 +6158,6 @@ qemuDomainAttachDeviceConfig(qemuCapsPtr caps,
>  
>      case VIR_DOMAIN_DEVICE_NET:
>          net = dev->data.net;
> -        if (virDomainNetIndexByMac(vmdef, &net->mac) >= 0) {
> -            char macbuf[VIR_MAC_STRING_BUFLEN];
> -
> -            virMacAddrFormat(&net->mac, macbuf);
> -            virReportError(VIR_ERR_INVALID_ARG,
> -                           _("mac %s already exists"), macbuf);
> -            return -1;
> -        }
>          if (virDomainNetInsert(vmdef, net)) {

Are you dropping functionality here?  Shouldn't you still be checking
that the new NetFindIdx function returns -1?

> -    vshError(ctl, _("No found interface whose MAC address is %s"), mac);
> -    goto cleanup;
> +    if (!matchNode) {
> +        vshError(ctl, _("No found interface whose MAC address is %s"), mac);

This would read better as 'No interface found', since you are already
touching this line.

ACK with those nits addressed; I like the overall improvement in error
messages.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121026/30ec1179/attachment-0001.sig>


More information about the libvir-list mailing list