]> xenbits.xensource.com Git - libvirt.git/commitdiff
Use the force flag for mkfs -t xfs
authorJán Tomko <jtomko@redhat.com>
Thu, 3 Apr 2014 09:09:14 +0000 (11:09 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 3 Apr 2014 12:10:28 +0000 (14:10 +0200)
Without this, building an XFS pool on a formatted partition
fails with --overwrite.

https://bugzilla.redhat.com/show_bug.cgi?id=927172

src/storage/storage_backend_fs.c

index e0244ba18040b45c2137d7abaa2ed7633bcea70e..1d85871fb3825293db361707be1ed0e0de0a20e9 100644 (file)
@@ -665,11 +665,13 @@ virStorageBackendExecuteMKFS(const char *device,
     int ret = 0;
     virCommandPtr cmd = NULL;
 
-    cmd = virCommandNewArgList(MKFS,
-                               "-t",
-                               format,
-                               device,
-                               NULL);
+    cmd = virCommandNewArgList(MKFS, "-t", format, NULL);
+
+    /* use the force, otherwise mkfs.xfs won't overwrite existing fs */
+    if (STREQ(format, "xfs"))
+        virCommandAddArg(cmd, "-f");
+
+    virCommandAddArg(cmd, device);
 
     if (virCommandRun(cmd, NULL) < 0) {
         virReportSystemError(errno,