psss / rpms / libguestfs

Forked from rpms/libguestfs 5 years ago
Clone

Blame 0001-Allow-network-interface-to-be-configured.patch

9f24b45
From b5b87cdb764dc757295316878a7fd6e2ff01bec4 Mon Sep 17 00:00:00 2001
9f24b45
From: Richard Jones <rjones@trick.home.annexia.org>
9f24b45
Date: Fri, 7 Aug 2009 09:31:35 +0100
9f24b45
Subject: [PATCH] Allow network interface to be configured.
9f24b45
9f24b45
Add ./configure --with-net-if=(virtio|ne2k_pci) option.
9f24b45
9f24b45
This lets you workaround the following virtio_net bug:
9f24b45
9f24b45
https://bugzilla.redhat.com/show_bug.cgi?id=516022
9f24b45
---
9f24b45
 configure.ac  |   11 +++++++++++
9f24b45
 src/guestfs.c |    2 +-
9f24b45
 2 files changed, 12 insertions(+), 1 deletions(-)
9f24b45
9f24b45
diff --git a/configure.ac b/configure.ac
9f24b45
index f6f1735..cf0591d 100644
9f24b45
--- a/configure.ac
9f24b45
+++ b/configure.ac
9f24b45
@@ -138,6 +138,17 @@ AC_ARG_WITH([drive-if],
9f24b45
         [with_drive_if=ide])
9f24b45
 AC_DEFINE_UNQUOTED([DRIVE_IF],["$with_drive_if"],[Default drive interface.])
9f24b45
 
9f24b45
+dnl Set interface used by the network.  Normally you should
9f24b45
+dnl leave this at the default (virtio) but you can use the
9f24b45
+dnl alternative (ne2k_pci) because of bugs in virtio networking
9f24b45
+dnl eg. https://bugzilla.redhat.com/show_bug.cgi?id=516022
9f24b45
+AC_ARG_WITH([net-if],
9f24b45
+        [AS_HELP_STRING([--with-net-if],
9f24b45
+          [set default net driver (virtio|ne2k_pci) @<:@default=virtio@:>@])],
9f24b45
+        [],
9f24b45
+        [with_net_if=virtio])
9f24b45
+AC_DEFINE_UNQUOTED([NET_IF],["$with_net_if"],[Default network interface.])
9f24b45
+
9f24b45
 dnl Check for febootstrap etc.
9f24b45
 AC_CHECK_PROG([FEBOOTSTRAP],
9f24b45
         [febootstrap],[febootstrap],[no])
9f24b45
diff --git a/src/guestfs.c b/src/guestfs.c
9f24b45
index de63275..186c570 100644
9f24b45
--- a/src/guestfs.c
9f24b45
+++ b/src/guestfs.c
9f24b45
@@ -1103,7 +1103,7 @@ guestfs_launch (guestfs_h *g)
9f24b45
     }
9f24b45
 #endif
9f24b45
     add_cmdline (g, "-net");
9f24b45
-    add_cmdline (g, "nic,model=virtio,vlan=0"); /* model=ne2k_pci also works */
9f24b45
+    add_cmdline (g, "nic,model=" NET_IF ",vlan=0");
9f24b45
 
9f24b45
     /* These options recommended by KVM developers to improve reliability. */
9f24b45
     if (qemu_supports (g, "-no-hpet"))
9f24b45
-- 
9f24b45
1.6.2.5
9f24b45