mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 03:21:19 +00:00
libxl: Fix initialization of nictype in libxl_device_nic
As pointed out by the Xen folks [1], HVM nics should always be set to type LIBXL_NIC_TYPE_VIF_IOEMU unless the user explicity requests LIBXL_NIC_TYPE_VIF via model='netfront'. The current logic in libxlMakeNic() only sets the nictype to LIBXL_NIC_TYPE_VIF_IOEMU if a model is specified that is not 'netfront', which breaks PXE booting configurations where no model is specified (i.e. use the hypervisor default). Reported-by: Stefan Bader <stefan.bader@canonical.com> [1] https://www.redhat.com/archives/libvir-list/2013-December/msg01156.html
This commit is contained in:
parent
f3e359d665
commit
7c98d1c153
@ -855,8 +855,12 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
libxlMakeNic(virDomainNetDefPtr l_nic, libxl_device_nic *x_nic)
|
libxlMakeNic(virDomainDefPtr def,
|
||||||
|
virDomainNetDefPtr l_nic,
|
||||||
|
libxl_device_nic *x_nic)
|
||||||
{
|
{
|
||||||
|
bool ioemu_nic = STREQ(def->os.type, "hvm");
|
||||||
|
|
||||||
/* TODO: Where is mtu stored?
|
/* TODO: Where is mtu stored?
|
||||||
*
|
*
|
||||||
* x_nics[i].mtu = 1492;
|
* x_nics[i].mtu = 1492;
|
||||||
@ -866,11 +870,15 @@ libxlMakeNic(virDomainNetDefPtr l_nic, libxl_device_nic *x_nic)
|
|||||||
|
|
||||||
virMacAddrGetRaw(&l_nic->mac, x_nic->mac);
|
virMacAddrGetRaw(&l_nic->mac, x_nic->mac);
|
||||||
|
|
||||||
if (l_nic->model && !STREQ(l_nic->model, "netfront")) {
|
if (ioemu_nic)
|
||||||
|
x_nic->nictype = LIBXL_NIC_TYPE_VIF_IOEMU;
|
||||||
|
else
|
||||||
|
x_nic->nictype = LIBXL_NIC_TYPE_VIF;
|
||||||
|
|
||||||
|
if (l_nic->model) {
|
||||||
if (VIR_STRDUP(x_nic->model, l_nic->model) < 0)
|
if (VIR_STRDUP(x_nic->model, l_nic->model) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
x_nic->nictype = LIBXL_NIC_TYPE_VIF_IOEMU;
|
if (STREQ(l_nic->model, "netfront"))
|
||||||
} else {
|
|
||||||
x_nic->nictype = LIBXL_NIC_TYPE_VIF;
|
x_nic->nictype = LIBXL_NIC_TYPE_VIF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -908,7 +916,7 @@ libxlMakeNicList(virDomainDefPtr def, libxl_domain_config *d_config)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < nnics; i++) {
|
for (i = 0; i < nnics; i++) {
|
||||||
if (libxlMakeNic(l_nics[i], &x_nics[i]))
|
if (libxlMakeNic(def, l_nics[i], &x_nics[i]))
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,9 @@ libxlMakeCapabilities(libxl_ctx *ctx);
|
|||||||
int
|
int
|
||||||
libxlMakeDisk(virDomainDiskDefPtr l_dev, libxl_device_disk *x_dev);
|
libxlMakeDisk(virDomainDiskDefPtr l_dev, libxl_device_disk *x_dev);
|
||||||
int
|
int
|
||||||
libxlMakeNic(virDomainNetDefPtr l_nic, libxl_device_nic *x_nic);
|
libxlMakeNic(virDomainDefPtr def,
|
||||||
|
virDomainNetDefPtr l_nic,
|
||||||
|
libxl_device_nic *x_nic);
|
||||||
int
|
int
|
||||||
libxlMakeVfb(libxlDriverPrivatePtr driver,
|
libxlMakeVfb(libxlDriverPrivatePtr driver,
|
||||||
virDomainGraphicsDefPtr l_vfb, libxl_device_vfb *x_vfb);
|
virDomainGraphicsDefPtr l_vfb, libxl_device_vfb *x_vfb);
|
||||||
|
Loading…
Reference in New Issue
Block a user