On 04/12/2012 09:42 AM, Stefan Bader wrote:
This is a re-send as there was some positive feedback but the
patch itself made it into the repo.
-Stefan
>From a3198c5c1ae8908818f6c0f0df4237dbe5ddeec7 Mon Sep 17 00:00:00 2001
From: Stefan Bader <stefan.bader(a)canonical.com>
Date: Thu, 12 Apr 2012 15:32:41 +0200
Subject: [PATCH] libvirt: xen: do not use ioemu type for any emulated NIC
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 (MAC address all zero).
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,
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(a)canonical.com>
---
src/xenxs/xen_sxpr.c | 4 +++-
src/xenxs/xen_xm.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index e1bbd76..71602fa 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -2012,7 +2012,9 @@ xenFormatSxprNet(virConnectPtr conn,
}
else {
virBufferEscapeSexpr(buf, "(model '%s')", def->model);
- virBufferAddLit(buf, "(type ioemu)");
+ /* See above. Also needed when model is specified. */
+ if (xendConfigVersion <= XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU)
+ virBufferAddLit(buf, "(type ioemu)");
}
I think it would be better if we just centralized this logic, as in, only set
that (type ioemu) bit in conditional rather than 2. Should be pretty
straightforward.
if (!isAttach)
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index d65e97a..e072599 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1394,7 +1394,9 @@ static int xenFormatXMNet(virConnectPtr conn,
}
else {
virBufferAsprintf(&buf, ",model=%s", net->model);
- virBufferAddLit(&buf, ",type=ioemu");
+ /* See above. Also needed if model is specified. */
+ if (xendConfigVersion <= XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU)
+ virBufferAddLit(&buf, ",type=ioemu");
}
if (net->ifname)
Same here as well.
Thanks,
Cole