From 904e6e906be91c0518797ecee807fd2c03850f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Thu, 3 Apr 2014 11:09:14 +0200 Subject: [PATCH] Use the force flag for mkfs -t xfs 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 e0244ba180..1d85871fb3 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,