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 | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index e0244ba..1d85871 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -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,
--
1.8.3.2