[libvirt PATCH 105/351] meson: add storage lvm build options

Pavel Hrdina phrdina at redhat.com
Thu Jul 16 09:55:41 UTC 2020


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 configure.ac           |  4 --
 m4/virt-storage-lvm.m4 | 90 ------------------------------------------
 meson.build            | 29 ++++++++++++++
 meson_options.txt      |  1 +
 4 files changed, 30 insertions(+), 94 deletions(-)
 delete mode 100644 m4/virt-storage-lvm.m4

diff --git a/configure.ac b/configure.ac
index 688425956e1..acfad8737ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -136,7 +136,6 @@ dnl
 dnl Storage driver checks
 dnl
 
-LIBVIRT_STORAGE_ARG_LVM
 LIBVIRT_STORAGE_ARG_SCSI
 LIBVIRT_STORAGE_ARG_MPATH
 LIBVIRT_STORAGE_ARG_RBD
@@ -145,7 +144,6 @@ LIBVIRT_STORAGE_ARG_ZFS
 LIBVIRT_STORAGE_ARG_VSTORAGE
 
 if test "$with_libvirtd" = "no"; then
-  with_storage_lvm=no
   with_storage_scsi=no
   with_storage_mpath=no
   with_storage_rbd=no
@@ -154,7 +152,6 @@ if test "$with_libvirtd" = "no"; then
   with_storage_vstorage=no
 fi
 
-LIBVIRT_STORAGE_CHECK_LVM
 LIBVIRT_STORAGE_CHECK_SCSI
 LIBVIRT_STORAGE_CHECK_MPATH
 LIBVIRT_STORAGE_CHECK_RBD
@@ -218,7 +215,6 @@ AC_MSG_NOTICE([=====================])
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Storage Drivers])
 AC_MSG_NOTICE([])
-LIBVIRT_STORAGE_RESULT_LVM
 LIBVIRT_STORAGE_RESULT_SCSI
 LIBVIRT_STORAGE_RESULT_MPATH
 LIBVIRT_STORAGE_RESULT_RBD
diff --git a/m4/virt-storage-lvm.m4 b/m4/virt-storage-lvm.m4
deleted file mode 100644
index a0ccca7a00a..00000000000
--- a/m4/virt-storage-lvm.m4
+++ /dev/null
@@ -1,90 +0,0 @@
-dnl The storage LVM check
-dnl
-dnl Copyright (C) 2016 Red Hat, Inc.
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License, or (at your option) any later version.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library.  If not, see
-dnl <http://www.gnu.org/licenses/>.
-dnl
-
-AC_DEFUN([LIBVIRT_STORAGE_ARG_LVM], [
-  LIBVIRT_ARG_WITH_FEATURE([STORAGE_LVM], [LVM backend for storage driver], [check])
-])
-
-AC_DEFUN([LIBVIRT_STORAGE_CHECK_LVM], [
-  if test "$with_storage_lvm" = "yes" || test "$with_storage_lvm" = "check"; then
-    AC_PATH_PROG([PVCREATE], [pvcreate], [], [$LIBVIRT_SBIN_PATH])
-    AC_PATH_PROG([VGCREATE], [vgcreate], [], [$LIBVIRT_SBIN_PATH])
-    AC_PATH_PROG([LVCREATE], [lvcreate], [], [$LIBVIRT_SBIN_PATH])
-    AC_PATH_PROG([PVREMOVE], [pvremove], [], [$LIBVIRT_SBIN_PATH])
-    AC_PATH_PROG([VGREMOVE], [vgremove], [], [$LIBVIRT_SBIN_PATH])
-    AC_PATH_PROG([LVREMOVE], [lvremove], [], [$LIBVIRT_SBIN_PATH])
-    AC_PATH_PROG([LVCHANGE], [lvchange], [], [$LIBVIRT_SBIN_PATH])
-    AC_PATH_PROG([VGCHANGE], [vgchange], [], [$LIBVIRT_SBIN_PATH])
-    AC_PATH_PROG([VGSCAN], [vgscan], [], [$LIBVIRT_SBIN_PATH])
-    AC_PATH_PROG([PVS], [pvs], [], [$LIBVIRT_SBIN_PATH])
-    AC_PATH_PROG([VGS], [vgs], [], [$LIBVIRT_SBIN_PATH])
-    AC_PATH_PROG([LVS], [lvs], [], [$LIBVIRT_SBIN_PATH])
-
-    if test "$with_storage_lvm" = "yes" ; then
-      if test -z "$PVCREATE" ; then AC_MSG_ERROR([We need pvcreate for LVM storage driver]) ; fi
-      if test -z "$VGCREATE" ; then AC_MSG_ERROR([We need vgcreate for LVM storage driver]) ; fi
-      if test -z "$LVCREATE" ; then AC_MSG_ERROR([We need lvcreate for LVM storage driver]) ; fi
-      if test -z "$PVREMOVE" ; then AC_MSG_ERROR([We need pvremove for LVM storage driver]) ; fi
-      if test -z "$VGREMOVE" ; then AC_MSG_ERROR([We need vgremove for LVM storage driver]) ; fi
-      if test -z "$LVREMOVE" ; then AC_MSG_ERROR([We need lvremove for LVM storage driver]) ; fi
-      if test -z "$LVCHANGE" ; then AC_MSG_ERROR([We need lvchange for LVM storage driver]) ; fi
-      if test -z "$VGCHANGE" ; then AC_MSG_ERROR([We need vgchange for LVM storage driver]) ; fi
-      if test -z "$VGSCAN" ; then AC_MSG_ERROR([We need vgscan for LVM storage driver]) ; fi
-      if test -z "$PVS" ; then AC_MSG_ERROR([We need pvs for LVM storage driver]) ; fi
-      if test -z "$VGS" ; then AC_MSG_ERROR([We need vgs for LVM storage driver]) ; fi
-      if test -z "$LVS" ; then AC_MSG_ERROR([We need lvs for LVM storage driver]) ; fi
-    else
-      if test -z "$PVCREATE" ; then with_storage_lvm=no ; fi
-      if test -z "$VGCREATE" ; then with_storage_lvm=no ; fi
-      if test -z "$LVCREATE" ; then with_storage_lvm=no ; fi
-      if test -z "$PVREMOVE" ; then with_storage_lvm=no ; fi
-      if test -z "$VGREMOVE" ; then with_storage_lvm=no ; fi
-      if test -z "$LVREMOVE" ; then with_storage_lvm=no ; fi
-      if test -z "$LVCHANGE" ; then with_storage_lvm=no ; fi
-      if test -z "$VGCHANGE" ; then with_storage_lvm=no ; fi
-      if test -z "$VGSCAN" ; then with_storage_lvm=no ; fi
-      if test -z "$PVS" ; then with_storage_lvm=no ; fi
-      if test -z "$VGS" ; then with_storage_lvm=no ; fi
-      if test -z "$LVS" ; then with_storage_lvm=no ; fi
-
-      if test "$with_storage_lvm" = "check" ; then with_storage_lvm=yes ; fi
-    fi
-
-    if test "$with_storage_lvm" = "yes" ; then
-      AC_DEFINE_UNQUOTED([WITH_STORAGE_LVM], 1, [whether LVM backend for storage driver is enabled])
-      AC_DEFINE_UNQUOTED([PVCREATE],["$PVCREATE"],[Location of pvcreate program])
-      AC_DEFINE_UNQUOTED([VGCREATE],["$VGCREATE"],[Location of vgcreate program])
-      AC_DEFINE_UNQUOTED([LVCREATE],["$LVCREATE"],[Location of lvcreate program])
-      AC_DEFINE_UNQUOTED([PVREMOVE],["$PVREMOVE"],[Location of pvremove program])
-      AC_DEFINE_UNQUOTED([VGREMOVE],["$VGREMOVE"],[Location of vgremove program])
-      AC_DEFINE_UNQUOTED([LVREMOVE],["$LVREMOVE"],[Location of lvremove program])
-      AC_DEFINE_UNQUOTED([LVCHANGE],["$LVCHANGE"],[Location of lvchange program])
-      AC_DEFINE_UNQUOTED([VGCHANGE],["$VGCHANGE"],[Location of vgchange program])
-      AC_DEFINE_UNQUOTED([VGSCAN],["$VGSCAN"],[Location of vgscan program])
-      AC_DEFINE_UNQUOTED([PVS],["$PVS"],[Location of pvs program])
-      AC_DEFINE_UNQUOTED([VGS],["$VGS"],[Location of vgs program])
-      AC_DEFINE_UNQUOTED([LVS],["$LVS"],[Location of lvs program])
-    fi
-  fi
-  AM_CONDITIONAL([WITH_STORAGE_LVM], [test "$with_storage_lvm" = "yes"])
-])
-
-AC_DEFUN([LIBVIRT_STORAGE_RESULT_LVM], [
-  LIBVIRT_RESULT([LVM], [$with_storage_lvm])
-])
diff --git a/meson.build b/meson.build
index 4576f18a6e2..cecc161ed85 100644
--- a/meson.build
+++ b/meson.build
@@ -1941,6 +1941,34 @@ if conf.has('WITH_LIBVIRTD')
   elif get_option('storage_iscsi_direct').enabled()
     error('Need libiscsi for iscsi-direct storage driver')
   endif
+
+  if not get_option('storage_lvm').disabled()
+    lvm_enable = true
+    lvm_progs = [
+      'pvcreate', 'vgcreate', 'lvcreate',
+      'pvremove', 'vgremove', 'lvremove',
+      'lvchange', 'vgchange', 'vgscan',
+      'pvs', 'vgs', 'lvs',
+    ]
+    foreach name : lvm_progs
+      set_variable(
+        '@0 at _prog'.format(name),
+        find_program(name, required: get_option('storage_lvm'), dirs: libvirt_sbin_path)
+      )
+      if not get_variable('@0 at _prog'.format(name)).found()
+        lvm_enable = false
+      endif
+    endforeach
+
+    if lvm_enable
+      use_storage = true
+      conf.set('WITH_STORAGE_LVM', 1)
+
+      foreach name : lvm_progs
+        conf.set_quoted(name.to_upper(), get_variable('@0 at _prog'.format(name)).path())
+      endforeach
+    endif
+  endif
 endif
 
 if use_storage
@@ -1989,6 +2017,7 @@ storagedriver_summary = {
   'Dir': conf.has('WITH_STORAGE_DIR'),
   'FS': conf.has('WITH_STORAGE_FS'),
   'NetFS': conf.has('WITH_STORAGE_FS'),
+  'LVM': conf.has('WITH_STORAGE_LVM'),
   'iSCSI': conf.has('WITH_STORAGE_ISCSI'),
   'iscsi-direct': conf.has('WITH_STORAGE_ISCSI_DIRECT'),
   'Disk': conf.has('WITH_STORAGE_DISK'),
diff --git a/meson_options.txt b/meson_options.txt
index 975479e7b8c..66e232f59dc 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -80,3 +80,4 @@ option('storage_fs', type: 'feature', value: 'auto', description: 'FileSystem ba
 option('storage_gluster', type: 'feature', value: 'auto', description: 'Gluster backend for the storage driver')
 option('storage_iscsi', type: 'feature', value: 'auto', description: 'iscsi backend for the storage driver')
 option('storage_iscsi_direct', type: 'feature', value: 'auto', description: 'iscsi-direct backend for the storage driver')
+option('storage_lvm', type: 'feature', value: 'auto', description: 'LVM backend for the storage driver')
-- 
2.26.2




More information about the libvir-list mailing list