This requires to define the binary name in code because we compile
src/util/viriscsi.c unconditionally.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
meson.build | 22 ++++++++++++++++------
src/util/viriscsi.h | 2 ++
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/meson.build b/meson.build
index fc8fc4f252..8c71e803bf 100644
--- a/meson.build
+++ b/meson.build
@@ -927,7 +927,6 @@ endforeach
optional_programs = [
'augparse',
'flake8',
- 'iscsiadm',
'pdwtags',
]
@@ -1802,11 +1801,22 @@ if conf.has('WITH_LIBVIRTD')
error('Need glusterfs (libgfapi) for gluster storage driver')
endif
- if not get_option('storage_iscsi').disabled() and iscsiadm_prog.found()
- use_storage = true
- conf.set('WITH_STORAGE_ISCSI', 1)
- elif get_option('storage_iscsi').enabled()
- error('We need iscsiadm for iSCSI storage driver')
+ if not get_option('storage_iscsi').disabled()
+ iscsi_enable = true
+ iscsiadm_prog = find_program('iscsiadm', required: false, dirs:
libvirt_sbin_path)
+
+ if not iscsiadm_prog.found()
+ if get_option('storage_iscsi').enabled()
+ error('We need iscsiadm for iSCSI storage driver')
+ else
+ iscsi_enable = false
+ endif
+ endif
+
+ if iscsi_enable
+ use_storage = true
+ conf.set('WITH_STORAGE_ISCSI', 1)
+ endif
endif
if not get_option('storage_iscsi_direct').disabled() and libiscsi_dep.found()
diff --git a/src/util/viriscsi.h b/src/util/viriscsi.h
index 6d17d139eb..fa7ff280c2 100644
--- a/src/util/viriscsi.h
+++ b/src/util/viriscsi.h
@@ -23,6 +23,8 @@
#include "internal.h"
+#define ISCSIADM "iscsiadm"
+
char *
virISCSIGetSession(const char *devpath,
bool probe)
--
2.30.2