On 11/12/13 05:19, Eric Blake wrote: > We support gluster volumes in domain XML, so we also ought to > support them as a storage pool. Besides, a future patch will > want to take advantage of libgfapi to handle the case of a > gluster device holding qcow2 rather than raw storage, and for > that to work, we need a storage backend that can read gluster > storage volume contents. This sets up the framework. > > * configure.ac (WITH_STORAGE_GLUSTER): New conditional. > * m4/virt-gluster.m4: new file. > * libvirt.spec.in (BuildRequires): Support gluster in spec file. > * src/conf/storage_conf.h (VIR_STORAGE_POOL_GLUSTER): New pool > type. > * src/conf/storage_conf.c (poolTypeInfo): Treat similar to > sheepdog and rbd. > (virStoragePoolDefFormat): Don't output target for gluster. > * src/storage/storage_backend_gluster.h: New file. > * src/storage/storage_backend_gluster.c: Likewise. > * po/POTFILES.in: Add new file. > * src/storage/storage_backend.c (backends): Register new type. > * src/Makefile.am (STORAGE_DRIVER_GLUSTER_SOURCES): Build new files. > * src/storage/storage_backend.h (_virStorageBackend): Documet > assumption. > > Signed-off-by: Eric Blake <eblake@xxxxxxxxxx> > --- > configure.ac | 21 ++++++++++++++++ > libvirt.spec.in | 15 ++++++++++++ > m4/virt-gluster.m4 | 26 ++++++++++++++++++++ > po/POTFILES.in | 1 + > src/Makefile.am | 9 +++++++ > src/conf/storage_conf.c | 20 ++++++++++++--- > src/conf/storage_conf.h | 3 ++- > src/storage/storage_backend.c | 6 +++++ > src/storage/storage_backend.h | 6 +++-- > src/storage/storage_backend_gluster.c | 46 +++++++++++++++++++++++++++++++++++ > src/storage/storage_backend_gluster.h | 29 ++++++++++++++++++++++ > 11 files changed, 175 insertions(+), 7 deletions(-) > create mode 100644 m4/virt-gluster.m4 > create mode 100644 src/storage/storage_backend_gluster.c > create mode 100644 src/storage/storage_backend_gluster.h > > diff --git a/configure.ac b/configure.ac > index 6003871..b193bc1 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -228,6 +228,7 @@ LIBVIRT_CHECK_CAPNG > LIBVIRT_CHECK_CURL > LIBVIRT_CHECK_DBUS > LIBVIRT_CHECK_FUSE > +LIBVIRT_CHECK_GLUSTER > LIBVIRT_CHECK_HAL > LIBVIRT_CHECK_NETCF > LIBVIRT_CHECK_NUMACTL > @@ -1643,6 +1644,10 @@ AC_ARG_WITH([storage-sheepdog], > [AS_HELP_STRING([--with-storage-sheepdog], > [with Sheepdog backend for the storage driver @<:@default=check@:>@])], > [],[with_storage_sheepdog=check]) > +AC_ARG_WITH([storage-gluster], > + [AS_HELP_STRING([--with-storage-gluster], > + [with Gluster backend for the storage driver @<:@default=check@:>@])], > + [],[with_storage_gluster=check]) > > if test "$with_libvirtd" = "no"; then > with_storage_dir=no > @@ -1654,6 +1659,7 @@ if test "$with_libvirtd" = "no"; then > with_storage_disk=no > with_storage_rbd=no > with_storage_sheepdog=no > + with_storage_gluster=no > fi > if test "$with_storage_dir" = "yes" ; then > AC_DEFINE_UNQUOTED([WITH_STORAGE_DIR], 1, [whether directory backend for storage driver is enabled]) > @@ -1855,6 +1861,19 @@ fi > AM_CONDITIONAL([WITH_STORAGE_SHEEPDOG], > [test "$with_storage_sheepdog" = "yes"]) > > +LIBGLUSTER_LIBS= > +if test "$with_storage_gluster" = "check"; then > + with_storage_gluster=$with_glfs > +fi > +if test "$with_storage_gluster" = "yes"; then > + if test "$with_glfs" = no; then > + AC_MSG_ERROR([Need glfs (libgfapi) for gluster storage driver]) > + fi > + AC_DEFINE_UNQUOTED([WITH_STORAGE_GLUSTER], [1], > + [whether Gluster backend for storage driver is enabled]) > +fi > +AM_CONDITIONAL([WITH_STORAGE_GLUSTER], [test "$with_storage_gluster" = "yes"]) > + > > LIBPARTED_CFLAGS= > LIBPARTED_LIBS= > @@ -2667,6 +2686,7 @@ AC_MSG_NOTICE([ mpath: $with_storage_mpath]) > AC_MSG_NOTICE([ Disk: $with_storage_disk]) > AC_MSG_NOTICE([ RBD: $with_storage_rbd]) > AC_MSG_NOTICE([Sheepdog: $with_storage_sheepdog]) > +AC_MSG_NOTICE([ Gluster: $with_storage_gluster]) > AC_MSG_NOTICE([]) > AC_MSG_NOTICE([Security Drivers]) > AC_MSG_NOTICE([]) > @@ -2692,6 +2712,7 @@ LIBVIRT_RESULT_CAPNG > LIBVIRT_RESULT_CURL > LIBVIRT_RESULT_DBUS > LIBVIRT_RESULT_FUSE > +LIBVIRT_RESULT_GLUSTER > LIBVIRT_RESULT_HAL > LIBVIRT_RESULT_NETCF > LIBVIRT_RESULT_NUMACTL > diff --git a/libvirt.spec.in b/libvirt.spec.in > index 72815f4..a90ee2b 100644 > --- a/libvirt.spec.in > +++ b/libvirt.spec.in > @@ -98,6 +98,11 @@ > %else > %define with_storage_sheepdog 0 > %endif > +%if 0%{?fedora} >= 19 > + %define with_storage_gluster 0%{!?_without_storage_gluster:%{server_drivers}} > +%else > + %define with_storage_gluster 0 > +%endif > %define with_numactl 0%{!?_without_numactl:%{server_drivers}} > %define with_selinux 0%{!?_without_selinux:%{server_drivers}} > > @@ -281,6 +286,7 @@ > %define with_storage_mpath 0 > %define with_storage_rbd 0 > %define with_storage_sheepdog 0 > + %define with_storage_gluster 0 > %define with_storage_disk 0 > %endif > > @@ -555,6 +561,10 @@ BuildRequires: device-mapper-devel > BuildRequires: ceph-devel > %endif > %endif > +%if %{with_storage_gluster} > +BuildRequires: glusterfs-api-devel > +BuildRequires: glusterfs-devel > +%endif > %if %{with_numactl} > # For QEMU/LXC numa info > BuildRequires: numactl-devel > @@ -1274,6 +1284,10 @@ of recent versions of Linux (and other OSes). > %define _without_storage_sheepdog --without-storage-sheepdog > %endif > > +%if ! %{with_storage_gluster} > + %define _without_storage_gluster --without-storage-gluster > +%endif > + > %if ! %{with_numactl} > %define _without_numactl --without-numactl > %endif > @@ -1396,6 +1410,7 @@ of recent versions of Linux (and other OSes). > %{?_without_storage_mpath} \ > %{?_without_storage_rbd} \ > %{?_without_storage_sheepdog} \ > + %{?_without_storage_gluster} \ > %{?_without_numactl} \ > %{?_without_numad} \ > %{?_without_capng} \ > diff --git a/m4/virt-gluster.m4 b/m4/virt-gluster.m4 > new file mode 100644 > index 0000000..4851e17 > --- /dev/null > +++ b/m4/virt-gluster.m4 > @@ -0,0 +1,26 @@ > +dnl The gluster libgfapi.so library > +dnl > +dnl Copyright (C) 2013 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_CHECK_GLUSTER],[ > + LIBVIRT_CHECK_PKG([GLFS], [glusterfs-api], [3.0]) > +]) > + > +AC_DEFUN([LIBVIRT_RESULT_GLUSTER],[ > + LIBVIRT_RESULT_LIB([GLFS]) > +]) For the hunks above, I can't provide any useful feedback as I don't really have experience with automake and stuff ... :/ <snip> Weak ACK based on complile testing the stuff above. Peter
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list