meson: add storage fs driver build option

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 10:55:52 +02:00
parent b957520a8b
commit 9b86c4965f
4 changed files with 46 additions and 99 deletions

View File

@ -134,7 +134,6 @@ dnl
dnl Storage driver checks dnl Storage driver checks
dnl dnl
LIBVIRT_STORAGE_ARG_FS
LIBVIRT_STORAGE_ARG_LVM LIBVIRT_STORAGE_ARG_LVM
LIBVIRT_STORAGE_ARG_ISCSI LIBVIRT_STORAGE_ARG_ISCSI
LIBVIRT_STORAGE_ARG_ISCSI_DIRECT LIBVIRT_STORAGE_ARG_ISCSI_DIRECT
@ -147,7 +146,6 @@ LIBVIRT_STORAGE_ARG_ZFS
LIBVIRT_STORAGE_ARG_VSTORAGE LIBVIRT_STORAGE_ARG_VSTORAGE
if test "$with_libvirtd" = "no"; then if test "$with_libvirtd" = "no"; then
with_storage_fs=no
with_storage_lvm=no with_storage_lvm=no
with_storage_iscsi=no with_storage_iscsi=no
with_storage_iscsi_direct=no with_storage_iscsi_direct=no
@ -160,13 +158,6 @@ if test "$with_libvirtd" = "no"; then
with_storage_vstorage=no with_storage_vstorage=no
fi fi
dnl storage-fs does not work on macOS
if test "$with_macos" = "yes"; then
with_storage_fs=no
fi
LIBVIRT_STORAGE_CHECK_FS
LIBVIRT_STORAGE_CHECK_LVM LIBVIRT_STORAGE_CHECK_LVM
LIBVIRT_STORAGE_CHECK_ISCSI LIBVIRT_STORAGE_CHECK_ISCSI
LIBVIRT_STORAGE_CHECK_ISCSI_DIRECT LIBVIRT_STORAGE_CHECK_ISCSI_DIRECT
@ -234,7 +225,6 @@ AC_MSG_NOTICE([=====================])
AC_MSG_NOTICE([]) AC_MSG_NOTICE([])
AC_MSG_NOTICE([Storage Drivers]) AC_MSG_NOTICE([Storage Drivers])
AC_MSG_NOTICE([]) AC_MSG_NOTICE([])
LIBVIRT_STORAGE_RESULT_FS
LIBVIRT_STORAGE_RESULT_LVM LIBVIRT_STORAGE_RESULT_LVM
LIBVIRT_STORAGE_RESULT_ISCSI LIBVIRT_STORAGE_RESULT_ISCSI
LIBVIRT_STORAGE_RESULT_ISCSI_DIRECT LIBVIRT_STORAGE_RESULT_ISCSI_DIRECT

View File

@ -1,89 +0,0 @@
dnl The storage fs 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_FS], [
LIBVIRT_ARG_WITH_FEATURE([STORAGE_FS], [FileSystem backend for the storage driver],
[check])
])
AC_DEFUN([LIBVIRT_STORAGE_CHECK_FS], [
if test "$with_storage_fs" = "yes" || test "$with_storage_fs" = "check"; then
AC_CHECK_HEADER([mntent.h], , [
if test "$with_storage_fs" = "check"; then
with_storage_fs=no
AC_MSG_NOTICE([<mntent.h> is required for the FS storage driver, disabling it])
else
AC_MSG_ERROR([<mntent.h> is required for the FS storage driver])
fi
])
fi
if test "$with_storage_fs" = "yes" || test "$with_storage_fs" = "check"; then
AC_PATH_PROG([MOUNT], [mount], [], [$LIBVIRT_SBIN_PATH])
AC_PATH_PROG([UMOUNT], [umount], [], [$LIBVIRT_SBIN_PATH])
AC_PATH_PROG([MKFS], [mkfs], [], [$LIBVIRT_SBIN_PATH])
if test "$with_storage_fs" = "yes" ; then
if test -z "$MOUNT" ; then
AC_MSG_ERROR([We need mount for FS storage driver])
fi
if test -z "$UMOUNT" ; then
AC_MSG_ERROR([We need umount for FS storage driver])
fi
if test -z "$MKFS" ; then
AC_MSG_ERROR([We need mkfs for FS storage driver])
fi
else
if test -z "$MOUNT" ; then
with_storage_fs=no
fi
if test -z "$UMOUNT" ; then
with_storage_fs=no
fi
if test -z "$MKFS" ; then
with_storage_fs=no
fi
if test "$with_storage_fs" = "check" ; then
with_storage_fs=yes
fi
fi
if test "$with_storage_fs" = "yes" ; then
AC_DEFINE_UNQUOTED([WITH_STORAGE_FS], 1,
[whether FS backend for storage driver is enabled])
AC_DEFINE_UNQUOTED([MOUNT], ["$MOUNT"],
[Location or name of the mount program])
AC_DEFINE_UNQUOTED([UMOUNT], ["$UMOUNT"],
[Location or name of the mount program])
AC_DEFINE_UNQUOTED([MKFS], ["$MKFS"],
[Location or name of the mkfs program])
fi
fi
AM_CONDITIONAL([WITH_STORAGE_FS], [test "$with_storage_fs" = "yes"])
if test "$with_storage_fs" = "yes"; then
AC_PATH_PROG([SHOWMOUNT], [showmount], [], [$LIBVIRT_SBIN_PATH])
AC_DEFINE_UNQUOTED([SHOWMOUNT], ["$SHOWMOUNT"],
[Location or name of the showmount program])
fi
])
AC_DEFUN([LIBVIRT_STORAGE_RESULT_FS], [
LIBVIRT_RESULT([FS], [$with_storage_fs])
LIBVIRT_RESULT([NetFS], [$with_storage_fs])
])

View File

@ -1895,6 +1895,49 @@ if conf.has('WITH_LIBVIRTD')
elif get_option('storage_disk').enabled() elif get_option('storage_disk').enabled()
error('You must install libparted and libdevmapper to compile libvirt with disk storage driver') error('You must install libparted and libdevmapper to compile libvirt with disk storage driver')
endif endif
if not get_option('storage_fs').disabled()
fs_enable = true
# storage-fs does not work on macOS
if host_machine.system() == 'darwin'
fs_enable = false
endif
if fs_enable and not cc.has_header('mntent.h')
if get_option('storage_fs').enabled()
error('<mntent.h> is required for the FS storage driver')
else
fs_enable = false
endif
endif
if fs_enable
mount_prog = find_program('mount', required: get_option('storage_fs'), dirs: libvirt_sbin_path)
umount_prog = find_program('umount', required: get_option('storage_fs'), dirs: libvirt_sbin_path)
mkfs_prog = find_program('mkfs', required: get_option('storage_fs'), dirs: libvirt_sbin_path)
if not mount_prog.found() or not umount_prog.found() or not mkfs_prog.found()
fs_enable = false
endif
endif
if fs_enable
use_storage = true
conf.set('WITH_STORAGE_FS', 1)
conf.set_quoted('MOUNT', mount_prog.path())
conf.set_quoted('UMOUNT', umount_prog.path())
conf.set_quoted('MKFS', mkfs_prog.path())
showmount_prog = find_program('showmount', required: false, dirs: libvirt_sbin_path)
showmount_path = ''
if showmount_prog.found()
showmount_path = showmount_prog.path()
endif
conf.set_quoted('SHOWMOUNT', showmount_path)
endif
endif
endif endif
if use_storage if use_storage
@ -1941,6 +1984,8 @@ summary(driver_summary, section: 'Drivers', bool_yn: true)
storagedriver_summary = { storagedriver_summary = {
'Dir': conf.has('WITH_STORAGE_DIR'), 'Dir': conf.has('WITH_STORAGE_DIR'),
'FS': conf.has('WITH_STORAGE_FS'),
'NetFS': conf.has('WITH_STORAGE_FS'),
'Disk': conf.has('WITH_STORAGE_DISK'), 'Disk': conf.has('WITH_STORAGE_DISK'),
} }
summary(storagedriver_summary, section: 'Storage Drivers', bool_yn: true) summary(storagedriver_summary, section: 'Storage Drivers', bool_yn: true)

View File

@ -77,3 +77,4 @@ option('secdriver_selinux', type: 'feature', value: 'auto', description: 'use SE
# storage driver options # storage driver options
option('storage_dir', type: 'feature', value: 'auto', description: 'directory backand for the storage driver') option('storage_dir', type: 'feature', value: 'auto', description: 'directory backand for the storage driver')
option('storage_disk', type: 'feature', value: 'auto', description: 'GPartd Disk backend for the storage driver') option('storage_disk', type: 'feature', value: 'auto', description: 'GPartd Disk backend for the storage driver')
option('storage_fs', type: 'feature', value: 'auto', description: 'FileSystem backend for the storage driver')