meson: add storage lvm build options

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Pavel Hrdina 2020-04-30 11:00:49 +02:00
parent 69f9bc3022
commit f49fb5abc7
4 changed files with 30 additions and 94 deletions

View File

@ -134,7 +134,6 @@ dnl
dnl Storage driver checks
dnl
LIBVIRT_STORAGE_ARG_LVM
LIBVIRT_STORAGE_ARG_SCSI
LIBVIRT_STORAGE_ARG_MPATH
LIBVIRT_STORAGE_ARG_RBD
@ -143,7 +142,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
@ -152,7 +150,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
@ -216,7 +213,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

View File

@ -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])
])

View File

@ -1959,6 +1959,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@_prog'.format(name),
find_program(name, required: get_option('storage_lvm'), dirs: libvirt_sbin_path)
)
if not get_variable('@0@_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@_prog'.format(name)).path())
endforeach
endif
endif
endif
if use_storage
@ -2007,6 +2035,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'),

View File

@ -81,3 +81,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')