[Libguestfs] [PATCH v2 2/9] Remove ./configure --with-drive-if and --with-net-if options.

Richard W.M. Jones rjones at redhat.com
Tue Jun 12 21:15:47 UTC 2012


From: "Richard W.M. Jones" <rjones at redhat.com>

These were used to select the default drive and network interface.
They both default to 'virtio'.

These were added back in the day when virtio was buggy, so that
packagers could revert to using ide/ne2k_pci to work around distro
bugs.  However virtio has been stable in qemu for a very long time, so
it seems unlikely that any packager would need to use these, and in
any case it would be better to do this detection at runtime (cf. for
virtio-scsi).
---
 configure.ac |   23 -----------------------
 src/launch.c |   13 +++++++------
 2 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5ba2018..69da9a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -644,29 +644,6 @@ the --with-qemu option.
     fi
 fi
 
-dnl Set default drive interface used by the guestfs_add_drive_opts call
-dnl ('-drive ...,if=...' option to qemu).
-dnl
-dnl If you encounter performance problems with virtio (RHBZ#509383)
-dnl then try '--with-drive-if=ide'.
-AC_ARG_WITH([drive-if],
-        [AS_HELP_STRING([--with-drive-if],
-          [set default driver (ide|scsi|virtio) @<:@default=virtio@:>@])],
-        [],
-        [with_drive_if=virtio])
-AC_DEFINE_UNQUOTED([DRIVE_IF],["$with_drive_if"],[Default drive interface.])
-
-dnl Set interface used by the network.  Normally you should
-dnl leave this at the default (virtio-net-pci) but you can use the
-dnl alternative (ne2k_pci) because of bugs in virtio networking
-dnl eg. https://bugzilla.redhat.com/show_bug.cgi?id=516022
-AC_ARG_WITH([net-if],
-        [AS_HELP_STRING([--with-net-if],
-          [set default net driver (virtio-net-pci|ne2k_pci) @<:@default=virtio-net-pci@:>@])],
-        [],
-        [with_net_if=virtio-net-pci])
-AC_DEFINE_UNQUOTED([NET_IF],["$with_net_if"],[Default network interface.])
-
 dnl Enable packet dumps when in verbose mode.  This generates lots
 dnl of debug info, only useful for people debugging the RPC mechanism.
 AC_ARG_ENABLE([packet-dump],
diff --git a/src/launch.c b/src/launch.c
index 3b1f91c..7bc913b 100644
--- a/src/launch.c
+++ b/src/launch.c
@@ -356,7 +356,7 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
   format = optargs->bitmask & GUESTFS_ADD_DRIVE_OPTS_FORMAT_BITMASK
            ? safe_strdup (g, optargs->format) : NULL;
   iface = optargs->bitmask & GUESTFS_ADD_DRIVE_OPTS_IFACE_BITMASK
-          ? safe_strdup (g, optargs->iface) : safe_strdup (g, DRIVE_IF);
+          ? safe_strdup (g, optargs->iface) : NULL;
   name = optargs->bitmask & GUESTFS_ADD_DRIVE_OPTS_NAME_BITMASK
           ? safe_strdup (g, optargs->name) : NULL;
 
@@ -365,7 +365,7 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
            "format");
     goto err_out;
   }
-  if (!valid_format_iface (iface)) {
+  if (iface && !valid_format_iface (iface)) {
     error (g, _("%s parameter is empty or contains disallowed characters"),
            "iface");
     goto err_out;
@@ -788,7 +788,7 @@ launch_appliance (guestfs_h *g)
       add_cmdline (g, "-netdev");
       add_cmdline (g, "user,id=usernet,net=169.254.0.0/16");
       add_cmdline (g, "-device");
-      add_cmdline (g, NET_IF ",netdev=usernet");
+      add_cmdline (g, "virtio-net-pci,netdev=usernet");
     }
 
 #if defined(__arm__)
@@ -837,7 +837,7 @@ launch_appliance (guestfs_h *g)
 
       char buf2[PATH_MAX + 64];
       add_cmdline (g, "-drive");
-      snprintf (buf2, sizeof buf2, "file=%s,snapshot=on,if=" DRIVE_IF "%s",
+      snprintf (buf2, sizeof buf2, "file=%s,snapshot=on,if=virtio%s",
                 appliance, cachemode);
       add_cmdline (g, buf2);
     }
@@ -1464,7 +1464,8 @@ qemu_drive_param (guestfs_h *g, const struct drive *drv)
   char *r;
 
   len += strlen (drv->path) * 2; /* every "," could become ",," */
-  len += strlen (drv->iface);
+  if (drv->iface)
+    len += strlen (drv->iface);
   if (drv->format)
     len += strlen (drv->format);
 
@@ -1487,7 +1488,7 @@ qemu_drive_param (guestfs_h *g, const struct drive *drv)
             drv->use_cache_off ? ",cache=off" : "",
             drv->format ? ",format=" : "",
             drv->format ? drv->format : "",
-            drv->iface);
+            drv->iface ? drv->iface : "virtio");
 
   return r;                     /* caller frees */
 }
-- 
1.7.10.1




More information about the Libguestfs mailing list