[Libvir] PATCH: Support network interface model in Xen and QEMU driver

Jim Paris jim at jtan.com
Wed Apr 30 04:29:18 UTC 2008


Daniel P. Berrange wrote:
> This patch finishes off the work from Rich / Soren to support network
> interface model in both Xen and QEMU drivers, and adds test cases for
> the new syntax

I still think our consensus from when I posted this patch last year
(<nic model=...>) makes more sense ... but getting any form of this
patch upstream sounds good to me.

> -            if (snprintf(nic, sizeof(nic), "nic,macaddr=%02x:%02x:%02x:%02x:%02x:%02x,vlan=%d",
> +            if (net->model[0] != '\0') {
> +                if (snprintf (model, sizeof (model), ",model=%s", net->model)
> +                    >= sizeof (model))
> +                    goto error;
> +            } else
> +                model[0] = '\0';
> +
> +            if (snprintf(nic, sizeof(nic),
> +                         "nic,macaddr=%02x:%02x:%02x:%02x:%02x:%02x,vlan=%d%s",
>                           net->mac[0], net->mac[1],
>                           net->mac[2], net->mac[3],
>                           net->mac[4], net->mac[5],
> -                         vlan) >= sizeof(nic))
> +                         vlan, model) >= sizeof(nic))

You could simplify this and not require the temporary buffer if you do
it this way:
  http://www.mail-archive.com/libvir-list@redhat.com/msg03557.html

-jim




More information about the libvir-list mailing list