[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v5.1 04/11] qemu: Record the default NIC model in the domain XML



On 04/04/2013 02:10 PM, Peter Krempa wrote:
> This patch implements the devices post parse cllback and uses it to fill
> the default qemu network card model into the XML if none is specified.
> 
> Libvirt assumes that the network card model for qemu is the "rtl8139".
> Record this in the XML using the new callback to avoid user
> confusion.
> +    if (dev->type == VIR_DOMAIN_DEVICE_NET &&
> +        dev->data.net->type != VIR_DOMAIN_NET_TYPE_HOSTDEV) {
> +        if (!dev->data.net->model &&
> +            !(dev->data.net->model = strdup("rtl8139")))
> +                goto no_memory;
> +    }

Not sure about other architectures, but this will break s390.
You should squash in something similar to (hope t-bird isn't breaking
format again):

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index e5e9223..c3a7aff 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -678,7 +678,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
 
 static int
 qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
-                             virDomainDefPtr def ATTRIBUTE_UNUSED,
+                             virDomainDefPtr def,
                              virCapsPtr caps ATTRIBUTE_UNUSED,
                              void *opaque)
 {
@@ -688,9 +688,15 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
 
     if (dev->type == VIR_DOMAIN_DEVICE_NET &&
         dev->data.net->type != VIR_DOMAIN_NET_TYPE_HOSTDEV) {
+        const char *model = NULL;
+        if (def->os.arch == VIR_ARCH_S390 ||
+            def->os.arch == VIR_ARCH_S390X)
+            model = "virtio";
+        else
+            model = "rtl8139";
         if (!dev->data.net->model &&
-            !(dev->data.net->model = strdup("rtl8139")))
-                goto no_memory;
+            !(dev->data.net->model = strdup(model)))
+            goto no_memory;
     }
 
     /* set default disk types and drivers */

-- 

Mit freundlichen Grüßen/Kind Regards
   Viktor Mihajlovski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Köderitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294   


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]