Add ./configure --with-drive-if=(ide|scsi|virtio)
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 2 Jul 2009 16:38:55 +0000 (17:38 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Thu, 2 Jul 2009 16:38:55 +0000 (17:38 +0100)
With this flag the packager can decide to default to a particular
qemu drive model.  The current default is 'ide', however note that
we intend to change this in future to 'virtio' once some upstream
regressions are fixed.  Packagers can force a particular drive
model if they wish.

configure.ac
src/generator.ml
src/guestfs.c

index 03f9388..ae0d81e 100644 (file)
@@ -102,6 +102,18 @@ the --with-qemu option.
     AC_MSG_RESULT([yes])
 fi
 
     AC_MSG_RESULT([yes])
 fi
 
+dnl Set drive interface used by the guestfs_add_drive{,_ro} calls
+dnl ('-drive ...,if=...' option to qemu).
+dnl
+dnl NB. We will change the default in future to virtio, but at the
+dnl moment this causes a performance problem, RHBZ#509383.
+AC_ARG_WITH([drive-if],
+       [AS_HELP_STRING([--with-drive-if],
+         [set default driver (ide|scsi|virtio) @<:@default=ide@:>@])],
+       [],
+       [with_drive_if=ide])
+AC_DEFINE_UNQUOTED([DRIVE_IF],["$with_drive_if"],[Default drive interface.])
+
 dnl Check for febootstrap etc.
 AC_CHECK_PROG([FEBOOTSTRAP],
        [febootstrap],[febootstrap],[no])
 dnl Check for febootstrap etc.
 AC_CHECK_PROG([FEBOOTSTRAP],
        [febootstrap],[febootstrap],[no])
index f41413e..239f021 100755 (executable)
@@ -378,7 +378,7 @@ just want to read the image or write access if you want to modify the
 image).
 
 This is equivalent to the qemu parameter
 image).
 
 This is equivalent to the qemu parameter
-C<-drive file=filename,cache=off,if=virtio>.
+C<-drive file=filename,cache=off,if=...>.
 
 Note that this call checks for the existence of C<filename>.  This
 stops you from specifying other types of drive which are supported
 
 Note that this call checks for the existence of C<filename>.  This
 stops you from specifying other types of drive which are supported
@@ -412,7 +412,7 @@ handle is closed.  We don't currently have any method to enable
 changes to be committed, although qemu can support this.
 
 This is equivalent to the qemu parameter
 changes to be committed, although qemu can support this.
 
 This is equivalent to the qemu parameter
-C<-drive file=filename,snapshot=on,if=virtio>.
+C<-drive file=filename,snapshot=on,if=...>.
 
 Note that this call checks for the existence of C<filename>.  This
 stops you from specifying other types of drive which are supported
 
 Note that this call checks for the existence of C<filename>.  This
 stops you from specifying other types of drive which are supported
index 9cdb2dd..c3bce0b 100644 (file)
@@ -708,7 +708,7 @@ guestfs_add_drive (guestfs_h *g, const char *filename)
   }
 
   /* cache=off improves reliability in the event of a host crash. */
   }
 
   /* cache=off improves reliability in the event of a host crash. */
-  snprintf (buf, len, "file=%s,cache=off,if=virtio", filename);
+  snprintf (buf, len, "file=%s,cache=off,if=%s", filename, DRIVE_IF);
 
   return guestfs_config (g, "-drive", buf);
 }
 
   return guestfs_config (g, "-drive", buf);
 }
@@ -729,7 +729,7 @@ guestfs_add_drive_ro (guestfs_h *g, const char *filename)
     return -1;
   }
 
     return -1;
   }
 
-  snprintf (buf, len, "file=%s,snapshot=on,if=virtio", filename);
+  snprintf (buf, len, "file=%s,snapshot=on,if=%s", filename, DRIVE_IF);
 
   return guestfs_config (g, "-drive", buf);
 }
 
   return guestfs_config (g, "-drive", buf);
 }