]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
xen: do not use ioemu type for any emulated NIC
authorStefan Bader <stefan.bader@canonical.com>
Fri, 13 Apr 2012 13:14:56 +0000 (15:14 +0200)
committerCole Robinson <crobinso@redhat.com>
Fri, 15 Jun 2012 14:58:24 +0000 (10:58 -0400)
When using the xm/xend stack to manage instances there is a bug
that causes the emulated interfaces to be unusable when the vif
config contains type=ioemu.

The current code already has a special quirk to not use this
keyword if no specific model is given for the emulated NIC
(defaulting to rtl8139).
Essentially it works because regardless of the type argument,i
the Xen stack always creates emulated and paravirt interfaces and
lets the guest decide which one to use. So neither xl nor xm stack
actually require the type keyword for emulated NICs.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
(cherry picked from commit 10c31135f321851f02ad1985684389a42f6f5e54)

src/xenxs/xen_sxpr.c
src/xenxs/xen_xm.c

index 19fbcaa9a098698b117bedd52fff50b722cdbc8d..dcf7aa4137eaf4559e19cf44c50fb21d808499f9 100644 (file)
@@ -1837,20 +1837,22 @@ xenFormatSxprNet(virConnectPtr conn,
         if (def->model != NULL)
             virBufferEscapeSexpr(buf, "(model '%s')", def->model);
     }
-    else if (def->model == NULL) {
-        /*
-         * apparently (type ioemu) breaks paravirt drivers on HVM so skip
-         * this from XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU
-         */
-        if (xendConfigVersion <= XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU)
-            virBufferAddLit(buf, "(type ioemu)");
-    }
-    else if (STREQ(def->model, "netfront")) {
-        virBufferAddLit(buf, "(type netfront)");
-    }
     else {
-        virBufferEscapeSexpr(buf, "(model '%s')", def->model);
-        virBufferAddLit(buf, "(type ioemu)");
+        if (def->model != NULL && STREQ(def->model, "netfront")) {
+            virBufferAddLit(buf, "(type netfront)");
+        }
+        else {
+            if (def->model != NULL) {
+                virBufferEscapeSexpr(buf, "(model '%s')", def->model);
+            }
+            /*
+             * apparently (type ioemu) breaks paravirt drivers on HVM so skip
+             * this from XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU
+             */
+            if (xendConfigVersion <= XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU) {
+                virBufferAddLit(buf, "(type ioemu)");
+            }
+        }
     }
 
     if (!isAttach)
index ff173d8de3bae95542fe8b06a87551348f90922e..98e251dafc266f024960e802ad075822b014d134 100644 (file)
@@ -1319,20 +1319,21 @@ static int xenFormatXMNet(virConnectPtr conn,
         if (net->model != NULL)
             virBufferAsprintf(&buf, ",model=%s", net->model);
     }
-    else if (net->model == NULL) {
-        /*
-         * apparently type ioemu breaks paravirt drivers on HVM so skip this
-         * from XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU
-         */
-        if (xendConfigVersion <= XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU)
-            virBufferAddLit(&buf, ",type=ioemu");
-    }
-    else if (STREQ(net->model, "netfront")) {
-        virBufferAddLit(&buf, ",type=netfront");
-    }
     else {
-        virBufferAsprintf(&buf, ",model=%s", net->model);
-        virBufferAddLit(&buf, ",type=ioemu");
+        if (net->model != NULL && STREQ(net->model, "netfront")) {
+            virBufferAddLit(&buf, ",type=netfront");
+        }
+        else {
+            if (net->model != NULL)
+                virBufferAsprintf(&buf, ",model=%s", net->model);
+
+            /*
+             * apparently type ioemu breaks paravirt drivers on HVM so skip this
+             * from XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU
+             */
+            if (xendConfigVersion <= XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU)
+                virBufferAddLit(&buf, ",type=ioemu");
+        }
     }
 
     if (net->ifname)