[Libguestfs] [PATCH v2 6/9] daemon: Always pass -F option to mke2fs.

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


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

Apparently e2fsprogs only knows that "/dev/sda" is a whole device, but
doesn't think that "/dev/vda" is.  On switching the default device
over to virtio-scsi, that causes mke2fs without -F option to complain
and ask for an interactive prompt.  Adding -F forces it to go ahead
anyway.

This caused several less-used APIs to break with virtio-scsi.
---
 daemon/ext2.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/daemon/ext2.c b/daemon/ext2.c
index 6824752..7876e66 100644
--- a/daemon/ext2.c
+++ b/daemon/ext2.c
@@ -377,7 +377,7 @@ do_mke2journal (int blocksize, const char *device)
   snprintf (blocksize_s, sizeof blocksize_s, "%d", blocksize);
 
   r = command (NULL, &err,
-               prog, "-O", "journal_dev", "-b", blocksize_s,
+               prog, "-F", "-O", "journal_dev", "-b", blocksize_s,
                device, NULL);
   if (r == -1) {
     reply_with_error ("%s", err);
@@ -409,7 +409,7 @@ do_mke2journal_L (int blocksize, const char *label, const char *device)
   snprintf (blocksize_s, sizeof blocksize_s, "%d", blocksize);
 
   r = command (NULL, &err,
-               prog, "-O", "journal_dev", "-b", blocksize_s,
+               prog, "-F", "-O", "journal_dev", "-b", blocksize_s,
                "-L", label,
                device, NULL);
   if (r == -1) {
@@ -436,7 +436,7 @@ do_mke2journal_U (int blocksize, const char *uuid, const char *device)
   snprintf (blocksize_s, sizeof blocksize_s, "%d", blocksize);
 
   r = command (NULL, &err,
-               prog, "-O", "journal_dev", "-b", blocksize_s,
+               prog, "-F", "-O", "journal_dev", "-b", blocksize_s,
                "-U", uuid,
                device, NULL);
   if (r == -1) {
@@ -468,7 +468,7 @@ do_mke2fs_J (const char *fstype, int blocksize, const char *device,
   snprintf (jdev, len+32, "device=%s", journal);
 
   r = command (NULL, &err,
-               prog, "-t", fstype, "-J", jdev, "-b", blocksize_s,
+               prog, "-F", "-t", fstype, "-J", jdev, "-b", blocksize_s,
                device, NULL);
   if (r == -1) {
     reply_with_error ("%s", err);
@@ -505,7 +505,7 @@ do_mke2fs_JL (const char *fstype, int blocksize, const char *device,
   snprintf (jdev, len+32, "device=LABEL=%s", label);
 
   r = command (NULL, &err,
-               prog, "-t", fstype, "-J", jdev, "-b", blocksize_s,
+               prog, "-F", "-t", fstype, "-J", jdev, "-b", blocksize_s,
                device, NULL);
   if (r == -1) {
     reply_with_error ("%s", err);
@@ -536,7 +536,7 @@ do_mke2fs_JU (const char *fstype, int blocksize, const char *device,
   snprintf (jdev, len+32, "device=UUID=%s", uuid);
 
   r = command (NULL, &err,
-               prog, "-t", fstype, "-J", jdev, "-b", blocksize_s,
+               prog, "-F", "-t", fstype, "-J", jdev, "-b", blocksize_s,
                device, NULL);
   if (r == -1) {
     reply_with_error ("%s", err);
-- 
1.7.10.1




More information about the Libguestfs mailing list