mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
storage: use virFindFileInPath to validate presence of mkfs
Future patch will remove MKFS define as we will no longer check it during compilation. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
a6cc9e46fb
commit
16c69e7aae
@ -397,13 +397,20 @@ virStorageBackendFileSystemCheck(virStoragePoolObj *pool,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* some platforms don't support mkfs */
|
|
||||||
#ifdef MKFS
|
|
||||||
static int
|
static int
|
||||||
virStorageBackendExecuteMKFS(const char *device,
|
virStorageBackendExecuteMKFS(const char *device,
|
||||||
const char *format)
|
const char *format)
|
||||||
{
|
{
|
||||||
g_autoptr(virCommand) cmd = NULL;
|
g_autoptr(virCommand) cmd = NULL;
|
||||||
|
g_autofree char *mkfs = virFindFileInPath(MKFS);
|
||||||
|
|
||||||
|
if (!mkfs) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("mkfs is not available on this platform: "
|
||||||
|
"Failed to make filesystem of type '%s' on device '%s'"),
|
||||||
|
format, device);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
cmd = virCommandNewArgList(MKFS, "-t", format, NULL);
|
cmd = virCommandNewArgList(MKFS, "-t", format, NULL);
|
||||||
|
|
||||||
@ -426,19 +433,6 @@ virStorageBackendExecuteMKFS(const char *device,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else /* #ifdef MKFS */
|
|
||||||
static int
|
|
||||||
virStorageBackendExecuteMKFS(const char *device G_GNUC_UNUSED,
|
|
||||||
const char *format G_GNUC_UNUSED)
|
|
||||||
{
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
||||||
_("mkfs is not supported on this platform: "
|
|
||||||
"Failed to make filesystem of "
|
|
||||||
"type '%s' on device '%s'"),
|
|
||||||
format, device);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif /* #ifdef MKFS */
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virStorageBackendMakeFileSystem(virStoragePoolObj *pool,
|
virStorageBackendMakeFileSystem(virStoragePoolObj *pool,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user