[libvirt PATCH v2] storage_backend_fs: use MKFS ony if WITH_STORAGE_FS is defined

The code in storage_backend_fs is used for storage_dir and storage_fs drivers so some parts need to be guarded by checking for WITH_STORAGE_FS. Fixes: 16c69e7aaed4cabfd8e8c19cc326854d4c480437 Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- GitLab CI faild on MacOS and FreeBSD where storage_fs is disabled. Changes in v2: - guard only virFindFileInPath instead of the whole function src/storage/storage_backend_fs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index af645ea9de..be3c3c6839 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -402,7 +402,11 @@ virStorageBackendExecuteMKFS(const char *device, const char *format) { g_autoptr(virCommand) cmd = NULL; - g_autofree char *mkfs = virFindFileInPath(MKFS); + g_autofree char *mkfs = NULL; + +#if WITH_STORAGE_FS + mkfs = virFindFileInPath(MKFS); +#endif /* WITH_STORAGE_FS */ if (!mkfs) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -412,7 +416,7 @@ virStorageBackendExecuteMKFS(const char *device, return -1; } - cmd = virCommandNewArgList(MKFS, "-t", format, NULL); + cmd = virCommandNewArgList(mkfs, "-t", format, NULL); /* use the force, otherwise mkfs.xfs won't overwrite existing fs. * Similarly mkfs.ext2, mkfs.ext3, and mkfs.ext4 require supplying -F -- 2.30.2

On 4/21/21 5:17 PM, Pavel Hrdina wrote:
The code in storage_backend_fs is used for storage_dir and storage_fs drivers so some parts need to be guarded by checking for WITH_STORAGE_FS.
Fixes: 16c69e7aaed4cabfd8e8c19cc326854d4c480437 Signed-off-by: Pavel Hrdina <phrdina@redhat.com> ---
GitLab CI faild on MacOS and FreeBSD where storage_fs is disabled.
Changes in v2: - guard only virFindFileInPath instead of the whole function
src/storage/storage_backend_fs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index af645ea9de..be3c3c6839 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -402,7 +402,11 @@ virStorageBackendExecuteMKFS(const char *device, const char *format) { g_autoptr(virCommand) cmd = NULL; - g_autofree char *mkfs = virFindFileInPath(MKFS); + g_autofree char *mkfs = NULL; + +#if WITH_STORAGE_FS + mkfs = virFindFileInPath(MKFS); +#endif /* WITH_STORAGE_FS */
if (!mkfs) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -412,7 +416,7 @@ virStorageBackendExecuteMKFS(const char *device, return -1; }
- cmd = virCommandNewArgList(MKFS, "-t", format, NULL); + cmd = virCommandNewArgList(mkfs, "-t", format, NULL);
/* use the force, otherwise mkfs.xfs won't overwrite existing fs. * Similarly mkfs.ext2, mkfs.ext3, and mkfs.ext4 require supplying -F
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Michal
participants (2)
-
Michal Privoznik
-
Pavel Hrdina