[libvirt PATCH 0/2] meson: Enable ZFS storage backend even more often

And drop some useless code. Andrea Bolognani (2): meson: Enable ZFS storage backend even more often meson: Stop looking up ZFS programs at build time meson.build | 16 ---------------- src/storage/storage_backend_zfs.c | 3 +++ 2 files changed, 3 insertions(+), 16 deletions(-) -- 2.31.1

Commit 73a2ff36163e already improved the situation a lot. This pushes things even further. If the user or, more likely, the distro packager explicitly asked for ZFS support to be enabled, then we should comply with that request regardless of whether the necessary programs are available at build time. This is particularly important in the context of Debian, where ZFS cannot be a build dependency of libvirt due to licensing issues but it can still be an optional runtime dependency. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 3a9066b9fe..5b73713e50 100644 --- a/meson.build +++ b/meson.build @@ -1978,7 +1978,7 @@ if conf.has('WITH_LIBVIRTD') foreach name : [ 'zfs', 'zpool' ] set_variable( '@0@_prog'.format(name), - find_program(name, required: get_option('storage_zfs'), dirs: libvirt_sbin_path) + find_program(name, required: false, dirs: libvirt_sbin_path) ) endforeach -- 2.31.1

At this point, we're no longer using the availability of the ZFS programs at build time to decide whether to enable ZFS support, so the only purpose of these find_program() calls is to record their absolute paths. However, the virCommand facilities that we're ultimately using to run them are already capable of performing this lookup at runtime, and in fact that's exactly what we already do in the case of, for example, vstorage. Drop the build time lookups and always perform them at runtime. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- meson.build | 16 ---------------- src/storage/storage_backend_zfs.c | 3 +++ 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/meson.build b/meson.build index 5b73713e50..414e10960d 100644 --- a/meson.build +++ b/meson.build @@ -1975,24 +1975,8 @@ if conf.has('WITH_LIBVIRTD') endif if not get_option('storage_zfs').disabled() - foreach name : [ 'zfs', 'zpool' ] - set_variable( - '@0@_prog'.format(name), - find_program(name, required: false, dirs: libvirt_sbin_path) - ) - endforeach - use_storage = true conf.set('WITH_STORAGE_ZFS', 1) - foreach name : [ 'zfs', 'zpool' ] - prog_var = get_variable('@0@_prog'.format(name)) - if prog_var.found() - prog_path = prog_var.path() - else - prog_path = name - endif - conf.set_quoted(name.to_upper(), prog_path) - endforeach endif endif diff --git a/src/storage/storage_backend_zfs.c b/src/storage/storage_backend_zfs.c index 6fabeade11..2a5d74357d 100644 --- a/src/storage/storage_backend_zfs.c +++ b/src/storage/storage_backend_zfs.c @@ -33,6 +33,9 @@ VIR_LOG_INIT("storage.storage_backend_zfs"); +#define ZFS "zfs" +#define ZPOOL "zpool" + /* * Some common flags of zfs and zpool commands we use: * -H -- don't print headers and separate fields by tab -- 2.31.1

On Wed, 2021-11-03 at 11:12 +0100, Andrea Bolognani wrote:
And drop some useless code.
Andrea Bolognani (2): meson: Enable ZFS storage backend even more often meson: Stop looking up ZFS programs at build time
meson.build | 16 ---------------- src/storage/storage_backend_zfs.c | 3 +++ 2 files changed, 3 insertions(+), 16 deletions(-)
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
participants (2)
-
Andrea Bolognani
-
Tim Wiederhake