Make NIC model fallback to default when specified model is not supported
PATCH 1/1 Make NIC model fallback to default when specified model is not supported
Hi,
this is the patch to introduce a NIC model fallback to default when model specified is not supported. It's been tested on x86_64 host with current version of qemu-dm using the RHEL-5 i386 virtual machine and by trying to setup the invalid (unsupported) model of NIC device. Also, the new constant in the net.h called the DEFAULT_NIC_MODEL has been introduced to be able to change the default NIC model easily. This variable is being used to set the default NIC model when necessary.
It's been tested by running a guest with NIC model set to be "eee" which is not supported and when the guest was started I tried to issue "lspci" to list all the PCI devices and there was Realtek RTL-8239 (AS) card which is basically the ne2k_pci card (default for Xen-4.1 qemu-dm) so the old default has been preserved and it's being used as a fallback.
Michal
Signature · 2 lines
Michal Novotny<[email protected]>, RHCE Virtualization Team (xen userspace), Red Hat
Quoted 1 line
From
fabe98d01d43a7b8157726407f344a943a233ad7Mon Sep 17 00:00:00 2001
From: Michal Novotny <[email protected]>
Date: Mon, 20 Sep 2010 14:22:28 +0200
Subject: [PATCH] Make NIC model fallback to default when specified model is not supported
Hi,
this is the patch to introduce a NIC model fallback to default when model specified is not supported. It's been tested on x86_64 host with current version of qemu-dm using the RHEL-5 i386 virtual machine and by trying to setup the invalid (unsupported) model of NIC device. Also, the new constant in the net.h called the DEFAULT_NIC_MODEL has been introduced to be able to change the default NIC model easily. This variable is being used to set the default NIC model when necessary.
It's been tested by running a guest with NIC model set to be "eee" which is not supported and when the guest was started I tried to issue "lspci" to list all the PCI devices and there was Realtek RTL-8239 (AS) card which is basically the ne2k_pci card (default for Xen-4.1 qemu-dm) so the old default has been preserved and it's being used as a fallback.
Michal
--- hw/pc.c | 2 +- net.c | 11 ++++++++++- net.h | 3 +++ vl.c | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-)
hw/pc.c +1 -1
@@ -1077,7 +1077,7 @@ vga_bios_error:if (!pci_enabled || (nd->model &&strcmp (nd->model,"ne2k_isa" ) ==0 ))pc_init_ne2k_isa (nd, i8259);else -pci_nic_init (pci_bus, nd,-1 ,"ne2k_pci" ); +pci_nic_init (pci_bus, nd,-1 ,NIC_DEFAULT_MODEL ); }qemu_system_hot_add_init ();
net.c +10 -1
@@ -1610,12 +1610,21 @@ void qemu_check_nic_model_list(NICInfo *nd, const char * const *models,if (!nd->model) nd->model =strdup (default_model); +again:if (strcmp (nd->model,"?" ) !=0 ) {for (i =0 ; models[i]; i++)if (strcmp (nd->model, models[i]) ==0 )return ; -fprintf (stderr,"qemu: Unsupported NIC model: %s\n" , nd->model); +if (strcmp (nd->model,NIC_DEFAULT_MODEL ) !=0 ) { +fprintf (stderr,"qemu: Unsupported NIC model: %s, using default: %s\n" , + nd->model,NIC_DEFAULT_MODEL ); + nd->model =strdup (NIC_DEFAULT_MODEL ); + goto again; + } +else +fprintf (stderr,"qemu: Unsupported default NIC model: %s (probably a bug)\n" , nd->model); + exit_status =1 ; }
net.h +3 -0
@@ -3,6 +3,9 @@#include "qemu-common.h" +/* Default NIC model to be used - also used as a fallback model when model specified doesn't exist */ +#define NIC_DEFAULT_MODEL "ne2k_pci" +/* VLANs support */ typedef ssize_t (IOReadvHandler )(void *,const struct iovec *,int );
vl.c +1 -1
@@ -5727,7 +5727,7 @@ int main(int argc, char **argv, char **envp)char buf[1024 ];if (net_boot & (1 << i)) {if (model ==NULL ) - model ="ne2k_pci" ; + model =NIC_DEFAULT_MODEL ;snprintf (buf,sizeof (buf),"%s/pxe-%s.bin" , bios_dir, model);if (get_image_size (buf) >0 ) {if (nb_option_roms >=MAX_OPTION_ROMS ) {
Signature · 1 line
1.5.5.6
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 9 lines · Michal Novotny
Hi,
this is the patch to introduce a NIC model fallback to default when model specified is not supported. It's been tested onx86_64host with current version of qemu-dm using the RHEL-5 i386 virtual machine and by trying to setup the invalid (unsupported) model of NIC device. Also, the new constant in thenet.hcalled theDEFAULT_NIC_MODELhas been introduced to be able to change the default NIC model easily. This variable is being used to set the default NIC model when necessary.
Quoted 5 lines
It's been tested by running a guest with NIC model set to be "eee" which is not supported and when the guest was started I tried to issue "lspci" to list all the PCI devices and there was Realtek RTL-8239 (AS) card which is basically the
ne2k_pcicard (default for Xen-4.1 qemu-dm) so the old default has been preserved and it's being used as a fallback.
I don't think qemu-dm and upstream QEMU should diverge again, so this patch does not sound like a good thing for Xen's ioemu codebase.
Paolo
Michal Novotny writes ("[Xen-devel] [PATCH] Make NIC model fallback to default when specified model is not supported"):
Quoted 2 lines
this is the patch to introduce a NIC model fallback to default when model specified is not supported.
This functionality should be done in the toolstack (libxl, xend) not in qemu-dm. I see that currently it's done in xl_cmdimpl.c (ie, in xl) which I think is wrong. These default settings should be in libxl.
But touching qemu for this is definitely wrong.
Ian.