virt-make-fs: Provide a clearer error message when mkfs fails (RHBZ#823883).

This commit is contained in:
Richard W.M. Jones
2012-05-24 12:30:50 +01:00
parent f904fa8223
commit 975a41db20

View File

@@ -456,7 +456,19 @@ eval {
# Create the filesystem.
if ($type ne "btrfs") {
$g->mkfs ($type, $dev);
eval {
$g->mkfs ($type, $dev);
};
if ($@) {
# Provide more guidance in the error message (RHBZ#823883).
print STDERR "'mkfs' (create filesystem) operation failed.\n";
if ($type eq "fat") {
print STDERR "Instead of 'fat', try 'vfat' (long filenames) or 'msdos' (short filenames).\n";
} else {
print STDERR "Is '$type' a correct filesystem type?\n";
}
die
}
} else {
$g->mkfs_btrfs ([$dev], datatype => "single", metadata => "single");
}