From: Ján Tomko Date: Thu, 3 Apr 2014 09:09:14 +0000 (+0200) Subject: Use the force flag for mkfs -t xfs X-Git-Tag: v1.2.4-rc1~190 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=904e6e906be91c0518797ecee807fd2c03850f5c;p=thirdparty%2Flibvirt.git 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 --- 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,