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
This commit is contained in:
Ján Tomko 2014-04-03 11:09:14 +02:00
parent cc7e150359
commit 904e6e906b

View 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,