[libvirt] [Xen-devel] [PATCH] libxl: Fix initialization of nictype in libxl_device_nic

Ian Campbell Ian.Campbell at citrix.com
Tue Jan 7 09:43:58 UTC 2014


On Mon, 2014-01-06 at 11:59 -0700, Jim Fehlig wrote:
> +    bool ioemu_nic = STREQ(def->os.type, "hvm");
> [...] 
> -    if (l_nic->model && !STREQ(l_nic->model, "netfront")) {
> -        if (VIR_STRDUP(x_nic->model, l_nic->model) < 0)
> -            return -1;
> +    if (ioemu_nic)
>          x_nic->nictype = LIBXL_NIC_TYPE_VIF_IOEMU;
> -    } else {
> +    else
>          x_nic->nictype = LIBXL_NIC_TYPE_VIF;

It's up to you but you could just leave nictype set to the default (as
initialised by libxl_device_nic_init and let the library do the right
thing based on the guest type. 

> +
> +    if (l_nic->model) {
> +        if (VIR_STRDUP(x_nic->model, l_nic->model) < 0)
> +            return -1;
> +        if (STREQ(l_nic->model, "netfront"))
> +            x_nic->nictype = LIBXL_NIC_TYPE_VIF;

This bit would remain valid whether or not you did the above.

Ultimately up to you whether you want to precisely control things or
just follow the defaults.

Ian.




More information about the libvir-list mailing list