|
|
c401cc |
From 1660908c3c568d85ce71f9f2237bb1c1a84b6f3c Mon Sep 17 00:00:00 2001
|
|
|
c401cc |
Message-Id: <1660908c3c568d85ce71f9f2237bb1c1a84b6f3c@dist-git>
|
|
|
c401cc |
From: Eric Blake <eblake@redhat.com>
|
|
|
c401cc |
Date: Wed, 26 Feb 2014 14:54:20 +0100
|
|
|
c401cc |
Subject: [PATCH] storage: initial support for linking with libgfapi
|
|
|
c401cc |
|
|
|
c401cc |
https://bugzilla.redhat.com/show_bug.cgi?id=1032370
|
|
|
c401cc |
|
|
|
c401cc |
We support gluster volumes in domain XML, so we also ought to
|
|
|
c401cc |
support them as a storage pool. Besides, a future patch will
|
|
|
c401cc |
want to take advantage of libgfapi to handle the case of a
|
|
|
c401cc |
gluster device holding qcow2 rather than raw storage, and for
|
|
|
c401cc |
that to work, we need a storage backend that can read gluster
|
|
|
c401cc |
storage volume contents. This sets up the framework.
|
|
|
c401cc |
|
|
|
c401cc |
Note that the new pool is named 'gluster' to match a
|
|
|
c401cc |
<disk type='network'><source protocol='gluster'> image source
|
|
|
c401cc |
already supported in a <domain>; it does NOT match the
|
|
|
c401cc |
<pool type='netfs'><source><target type='glusterfs'>,
|
|
|
c401cc |
since that uses a FUSE mount to a local file name rather than
|
|
|
c401cc |
a network name.
|
|
|
c401cc |
|
|
|
c401cc |
This and subsequent patches have been tested against glusterfs
|
|
|
c401cc |
3.4.1 (available on Fedora 19); there are likely bugs in older
|
|
|
c401cc |
versions that may prevent decent use of gfapi, so this patch
|
|
|
c401cc |
enforces the minimum version tested. A future patch may lower
|
|
|
c401cc |
the minimum. On the other hand, I hit at least two bugs in
|
|
|
c401cc |
3.4.1 that will be fixed in 3.5/3.4.2, where it might be worth
|
|
|
c401cc |
raising the minimum: glfs_readdir is nicer to use than
|
|
|
c401cc |
glfs_readdir_r [1], and glfs_fini should only return failure on
|
|
|
c401cc |
an actual failure [2].
|
|
|
c401cc |
|
|
|
c401cc |
[1] http://lists.gnu.org/archive/html/gluster-devel/2013-10/msg00085.html
|
|
|
c401cc |
[2] http://lists.gnu.org/archive/html/gluster-devel/2013-10/msg00086.html
|
|
|
c401cc |
|
|
|
c401cc |
* configure.ac (WITH_STORAGE_GLUSTER): New conditional.
|
|
|
c401cc |
* m4/virt-gluster.m4: new file.
|
|
|
c401cc |
* libvirt.spec.in (BuildRequires): Support gluster in spec file.
|
|
|
c401cc |
* src/conf/storage_conf.h (VIR_STORAGE_POOL_GLUSTER): New pool
|
|
|
c401cc |
type.
|
|
|
c401cc |
* src/conf/storage_conf.c (poolTypeInfo): Treat similar to
|
|
|
c401cc |
sheepdog and rbd.
|
|
|
c401cc |
(virStoragePoolDefFormat): Don't output target for gluster.
|
|
|
c401cc |
* src/storage/storage_backend_gluster.h: New file.
|
|
|
c401cc |
* src/storage/storage_backend_gluster.c: Likewise.
|
|
|
c401cc |
* po/POTFILES.in: Add new file.
|
|
|
c401cc |
* src/storage/storage_backend.c (backends): Register new type.
|
|
|
c401cc |
* src/Makefile.am (STORAGE_DRIVER_GLUSTER_SOURCES): Build new files.
|
|
|
c401cc |
* src/storage/storage_backend.h (_virStorageBackend): Documet
|
|
|
c401cc |
assumption.
|
|
|
c401cc |
|
|
|
c401cc |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
c401cc |
(cherry picked from commit 318ea3cb77d9b2784ffb26e58c2f371050035b40)
|
|
|
c401cc |
|
|
|
c401cc |
Conflicts:
|
|
|
c401cc |
configure.ac - ff777421042a4583916e534795bb375d9e3cca10 not
|
|
|
c401cc |
backported
|
|
|
c401cc |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c401cc |
---
|
|
|
c401cc |
configure.ac | 21 ++++++++++++++++
|
|
|
c401cc |
libvirt.spec.in | 15 ++++++++++++
|
|
|
c401cc |
m4/virt-gluster.m4 | 28 +++++++++++++++++++++
|
|
|
c401cc |
po/POTFILES.in | 1 +
|
|
|
c401cc |
src/Makefile.am | 10 ++++++++
|
|
|
c401cc |
src/conf/storage_conf.c | 26 +++++++++++++++++---
|
|
|
c401cc |
src/conf/storage_conf.h | 3 ++-
|
|
|
c401cc |
src/storage/storage_backend.c | 6 +++++
|
|
|
c401cc |
src/storage/storage_backend.h | 6 +++--
|
|
|
c401cc |
src/storage/storage_backend_gluster.c | 46 +++++++++++++++++++++++++++++++++++
|
|
|
c401cc |
src/storage/storage_backend_gluster.h | 29 ++++++++++++++++++++++
|
|
|
c401cc |
11 files changed, 184 insertions(+), 7 deletions(-)
|
|
|
c401cc |
create mode 100644 m4/virt-gluster.m4
|
|
|
c401cc |
create mode 100644 src/storage/storage_backend_gluster.c
|
|
|
c401cc |
create mode 100644 src/storage/storage_backend_gluster.h
|
|
|
c401cc |
|
|
|
c401cc |
diff --git a/configure.ac b/configure.ac
|
|
|
c401cc |
index 9734c33..e02c163 100644
|
|
|
c401cc |
--- a/configure.ac
|
|
|
c401cc |
+++ b/configure.ac
|
|
|
c401cc |
@@ -171,6 +171,7 @@ LIBVIRT_CHECK_CAPNG
|
|
|
c401cc |
LIBVIRT_CHECK_CURL
|
|
|
c401cc |
LIBVIRT_CHECK_DBUS
|
|
|
c401cc |
LIBVIRT_CHECK_FUSE
|
|
|
c401cc |
+LIBVIRT_CHECK_GLUSTER
|
|
|
c401cc |
LIBVIRT_CHECK_HAL
|
|
|
c401cc |
LIBVIRT_CHECK_NETCF
|
|
|
c401cc |
LIBVIRT_CHECK_NUMACTL
|
|
|
c401cc |
@@ -1589,6 +1590,10 @@ AC_ARG_WITH([storage-rbd],
|
|
|
c401cc |
AC_HELP_STRING([--with-storage-rbd], [with RADOS Block Device backend for the storage driver @<:@default=check@:>@]),[],[with_storage_rbd=check])
|
|
|
c401cc |
AC_ARG_WITH([storage-sheepdog],
|
|
|
c401cc |
AC_HELP_STRING([--with-storage-sheepdog], [with Sheepdog backend for the storage driver @<:@default=check@:>@]),[],[with_storage_sheepdog=check])
|
|
|
c401cc |
+AC_ARG_WITH([storage-gluster],
|
|
|
c401cc |
+ [AS_HELP_STRING([--with-storage-gluster],
|
|
|
c401cc |
+ [with Gluster backend for the storage driver @<:@default=check@:>@])],
|
|
|
c401cc |
+ [],[with_storage_gluster=check])
|
|
|
c401cc |
|
|
|
c401cc |
if test "$with_libvirtd" = "no"; then
|
|
|
c401cc |
with_storage_dir=no
|
|
|
c401cc |
@@ -1600,6 +1605,7 @@ if test "$with_libvirtd" = "no"; then
|
|
|
c401cc |
with_storage_disk=no
|
|
|
c401cc |
with_storage_rbd=no
|
|
|
c401cc |
with_storage_sheepdog=no
|
|
|
c401cc |
+ with_storage_gluster=no
|
|
|
c401cc |
fi
|
|
|
c401cc |
if test "$with_storage_dir" = "yes" ; then
|
|
|
c401cc |
AC_DEFINE_UNQUOTED([WITH_STORAGE_DIR], 1, [whether directory backend for storage driver is enabled])
|
|
|
c401cc |
@@ -1801,6 +1807,19 @@ fi
|
|
|
c401cc |
AM_CONDITIONAL([WITH_STORAGE_SHEEPDOG],
|
|
|
c401cc |
[test "$with_storage_sheepdog" = "yes"])
|
|
|
c401cc |
|
|
|
c401cc |
+LIBGLUSTER_LIBS=
|
|
|
c401cc |
+if test "$with_storage_gluster" = "check"; then
|
|
|
c401cc |
+ with_storage_gluster=$with_glusterfs
|
|
|
c401cc |
+fi
|
|
|
c401cc |
+if test "$with_storage_gluster" = "yes"; then
|
|
|
c401cc |
+ if test "$with_glusterfs" = no; then
|
|
|
c401cc |
+ AC_MSG_ERROR([Need glusterfs (libgfapi) for gluster storage driver])
|
|
|
c401cc |
+ fi
|
|
|
c401cc |
+ AC_DEFINE_UNQUOTED([WITH_STORAGE_GLUSTER], [1],
|
|
|
c401cc |
+ [whether Gluster backend for storage driver is enabled])
|
|
|
c401cc |
+fi
|
|
|
c401cc |
+AM_CONDITIONAL([WITH_STORAGE_GLUSTER], [test "$with_storage_gluster" = "yes"])
|
|
|
c401cc |
+
|
|
|
c401cc |
|
|
|
c401cc |
LIBPARTED_CFLAGS=
|
|
|
c401cc |
LIBPARTED_LIBS=
|
|
|
c401cc |
@@ -2570,6 +2589,7 @@ AC_MSG_NOTICE([ mpath: $with_storage_mpath])
|
|
|
c401cc |
AC_MSG_NOTICE([ Disk: $with_storage_disk])
|
|
|
c401cc |
AC_MSG_NOTICE([ RBD: $with_storage_rbd])
|
|
|
c401cc |
AC_MSG_NOTICE([Sheepdog: $with_storage_sheepdog])
|
|
|
c401cc |
+AC_MSG_NOTICE([ Gluster: $with_storage_gluster])
|
|
|
c401cc |
AC_MSG_NOTICE([])
|
|
|
c401cc |
AC_MSG_NOTICE([Security Drivers])
|
|
|
c401cc |
AC_MSG_NOTICE([])
|
|
|
c401cc |
@@ -2595,6 +2615,7 @@ LIBVIRT_RESULT_CAPNG
|
|
|
c401cc |
LIBVIRT_RESULT_CURL
|
|
|
c401cc |
LIBVIRT_RESULT_DBUS
|
|
|
c401cc |
LIBVIRT_RESULT_FUSE
|
|
|
c401cc |
+LIBVIRT_RESULT_GLUSTER
|
|
|
c401cc |
LIBVIRT_RESULT_HAL
|
|
|
c401cc |
LIBVIRT_RESULT_NETCF
|
|
|
c401cc |
LIBVIRT_RESULT_NUMACTL
|
|
|
c401cc |
diff --git a/m4/virt-gluster.m4 b/m4/virt-gluster.m4
|
|
|
c401cc |
new file mode 100644
|
|
|
c401cc |
index 0000000..5a4a263
|
|
|
c401cc |
--- /dev/null
|
|
|
c401cc |
+++ b/m4/virt-gluster.m4
|
|
|
c401cc |
@@ -0,0 +1,28 @@
|
|
|
c401cc |
+dnl The gluster libgfapi.so library
|
|
|
c401cc |
+dnl
|
|
|
c401cc |
+dnl Copyright (C) 2013 Red Hat, Inc.
|
|
|
c401cc |
+dnl
|
|
|
c401cc |
+dnl This library is free software; you can redistribute it and/or
|
|
|
c401cc |
+dnl modify it under the terms of the GNU Lesser General Public
|
|
|
c401cc |
+dnl License as published by the Free Software Foundation; either
|
|
|
c401cc |
+dnl version 2.1 of the License, or (at your option) any later version.
|
|
|
c401cc |
+dnl
|
|
|
c401cc |
+dnl This library is distributed in the hope that it will be useful,
|
|
|
c401cc |
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
c401cc |
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
c401cc |
+dnl Lesser General Public License for more details.
|
|
|
c401cc |
+dnl
|
|
|
c401cc |
+dnl You should have received a copy of the GNU Lesser General Public
|
|
|
c401cc |
+dnl License along with this library. If not, see
|
|
|
c401cc |
+dnl <http://www.gnu.org/licenses/>.
|
|
|
c401cc |
+dnl
|
|
|
c401cc |
+
|
|
|
c401cc |
+dnl Currently tested against Fedora 19 with glusterfs 3.4.1; earlier
|
|
|
c401cc |
+dnl versions may be possible but only with further testing
|
|
|
c401cc |
+AC_DEFUN([LIBVIRT_CHECK_GLUSTER],[
|
|
|
c401cc |
+ LIBVIRT_CHECK_PKG([GLUSTERFS], [glusterfs-api], [3.4.1])
|
|
|
c401cc |
+])
|
|
|
c401cc |
+
|
|
|
c401cc |
+AC_DEFUN([LIBVIRT_RESULT_GLUSTER],[
|
|
|
c401cc |
+ LIBVIRT_RESULT_LIB([GLUSTERFS])
|
|
|
c401cc |
+])
|
|
|
c401cc |
diff --git a/po/POTFILES.in b/po/POTFILES.in
|
|
|
c401cc |
index 0e4aa76..25cdf84 100644
|
|
|
c401cc |
--- a/po/POTFILES.in
|
|
|
c401cc |
+++ b/po/POTFILES.in
|
|
|
c401cc |
@@ -131,6 +131,7 @@ src/storage/parthelper.c
|
|
|
c401cc |
src/storage/storage_backend.c
|
|
|
c401cc |
src/storage/storage_backend_disk.c
|
|
|
c401cc |
src/storage/storage_backend_fs.c
|
|
|
c401cc |
+src/storage/storage_backend_gluster.c
|
|
|
c401cc |
src/storage/storage_backend_iscsi.c
|
|
|
c401cc |
src/storage/storage_backend_logical.c
|
|
|
c401cc |
src/storage/storage_backend_mpath.c
|
|
|
c401cc |
diff --git a/src/Makefile.am b/src/Makefile.am
|
|
|
c401cc |
index 948efb4..816e057 100644
|
|
|
c401cc |
--- a/src/Makefile.am
|
|
|
c401cc |
+++ b/src/Makefile.am
|
|
|
c401cc |
@@ -791,6 +791,9 @@ STORAGE_DRIVER_RBD_SOURCES = \
|
|
|
c401cc |
STORAGE_DRIVER_SHEEPDOG_SOURCES = \
|
|
|
c401cc |
storage/storage_backend_sheepdog.h storage/storage_backend_sheepdog.c
|
|
|
c401cc |
|
|
|
c401cc |
+STORAGE_DRIVER_GLUSTER_SOURCES = \
|
|
|
c401cc |
+ storage/storage_backend_gluster.h storage/storage_backend_gluster.c
|
|
|
c401cc |
+
|
|
|
c401cc |
STORAGE_HELPER_DISK_SOURCES = \
|
|
|
c401cc |
storage/parthelper.c
|
|
|
c401cc |
|
|
|
c401cc |
@@ -1401,6 +1404,12 @@ if WITH_STORAGE_SHEEPDOG
|
|
|
c401cc |
libvirt_driver_storage_impl_la_SOURCES += $(STORAGE_DRIVER_SHEEPDOG_SOURCES)
|
|
|
c401cc |
endif
|
|
|
c401cc |
|
|
|
c401cc |
+if WITH_STORAGE_GLUSTER
|
|
|
c401cc |
+libvirt_driver_storage_impl_la_SOURCES += $(STORAGE_DRIVER_GLUSTER_SOURCES)
|
|
|
c401cc |
+libvirt_driver_storage_impl_la_CFLAGS += $(GLUSTERFS_CFLAGS)
|
|
|
c401cc |
+libvirt_driver_storage_impl_la_LIBADD += $(GLUSTERFS_LIBS)
|
|
|
c401cc |
+endif WITH_STORAGE_GLUSTER
|
|
|
c401cc |
+
|
|
|
c401cc |
if WITH_NODE_DEVICES
|
|
|
c401cc |
# Needed to keep automake quiet about conditionals
|
|
|
c401cc |
if WITH_DRIVER_MODULES
|
|
|
c401cc |
@@ -1593,6 +1602,7 @@ EXTRA_DIST += \
|
|
|
c401cc |
$(STORAGE_DRIVER_DISK_SOURCES) \
|
|
|
c401cc |
$(STORAGE_DRIVER_RBD_SOURCES) \
|
|
|
c401cc |
$(STORAGE_DRIVER_SHEEPDOG_SOURCES) \
|
|
|
c401cc |
+ $(STORAGE_DRIVER_GLUSTER_SOURCES) \
|
|
|
c401cc |
$(NODE_DEVICE_DRIVER_SOURCES) \
|
|
|
c401cc |
$(NODE_DEVICE_DRIVER_HAL_SOURCES) \
|
|
|
c401cc |
$(NODE_DEVICE_DRIVER_UDEV_SOURCES) \
|
|
|
c401cc |
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
|
|
|
c401cc |
index a5f03c3..0723ca9 100644
|
|
|
c401cc |
--- a/src/conf/storage_conf.c
|
|
|
c401cc |
+++ b/src/conf/storage_conf.c
|
|
|
c401cc |
@@ -59,7 +59,7 @@ VIR_ENUM_IMPL(virStoragePool,
|
|
|
c401cc |
VIR_STORAGE_POOL_LAST,
|
|
|
c401cc |
"dir", "fs", "netfs",
|
|
|
c401cc |
"logical", "disk", "iscsi",
|
|
|
c401cc |
- "scsi", "mpath", "rbd", "sheepdog")
|
|
|
c401cc |
+ "scsi", "mpath", "rbd", "sheepdog", "gluster")
|
|
|
c401cc |
|
|
|
c401cc |
VIR_ENUM_IMPL(virStoragePoolFormatFileSystem,
|
|
|
c401cc |
VIR_STORAGE_POOL_FS_LAST,
|
|
|
c401cc |
@@ -248,6 +248,19 @@ static virStoragePoolTypeInfo poolTypeInfo[] = {
|
|
|
c401cc |
.formatToString = virStoragePoolFormatDiskTypeToString,
|
|
|
c401cc |
}
|
|
|
c401cc |
},
|
|
|
c401cc |
+ {.poolType = VIR_STORAGE_POOL_GLUSTER,
|
|
|
c401cc |
+ .poolOptions = {
|
|
|
c401cc |
+ .flags = (VIR_STORAGE_POOL_SOURCE_HOST |
|
|
|
c401cc |
+ VIR_STORAGE_POOL_SOURCE_NETWORK |
|
|
|
c401cc |
+ VIR_STORAGE_POOL_SOURCE_NAME |
|
|
|
c401cc |
+ VIR_STORAGE_POOL_SOURCE_DIR),
|
|
|
c401cc |
+ },
|
|
|
c401cc |
+ .volOptions = {
|
|
|
c401cc |
+ .defaultFormat = VIR_STORAGE_FILE_RAW,
|
|
|
c401cc |
+ .formatToString = virStorageFileFormatTypeToString,
|
|
|
c401cc |
+ .formatFromString = virStorageVolumeFormatFromString,
|
|
|
c401cc |
+ }
|
|
|
c401cc |
+ },
|
|
|
c401cc |
{.poolType = VIR_STORAGE_POOL_MPATH,
|
|
|
c401cc |
.volOptions = {
|
|
|
c401cc |
.formatToString = virStoragePoolFormatDiskTypeToString,
|
|
|
c401cc |
@@ -652,6 +665,10 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
|
|
|
c401cc |
}
|
|
|
c401cc |
|
|
|
c401cc |
source->dir = virXPathString("string(./dir/@path)", ctxt);
|
|
|
c401cc |
+ /* In gluster, a missing dir defaults to "/" */
|
|
|
c401cc |
+ if (!source->dir && pool_type == VIR_STORAGE_POOL_GLUSTER &&
|
|
|
c401cc |
+ VIR_STRDUP(source->dir, "/") < 0)
|
|
|
c401cc |
+ goto cleanup;
|
|
|
c401cc |
|
|
|
c401cc |
if ((adapter_type = virXPathString("string(./adapter/@type)", ctxt))) {
|
|
|
c401cc |
if ((source->adapter.type =
|
|
|
c401cc |
@@ -1196,10 +1213,11 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def)
|
|
|
c401cc |
if (virStoragePoolSourceFormat(&buf, options, &def->source) < 0)
|
|
|
c401cc |
goto cleanup;
|
|
|
c401cc |
|
|
|
c401cc |
- /* RBD and Sheepdog devices are not local block devs nor files, so it
|
|
|
c401cc |
- * doesn't have a target */
|
|
|
c401cc |
+ /* RBD, Sheepdog, and Gluster devices are not local block devs nor
|
|
|
c401cc |
+ * files, so they don't have a target */
|
|
|
c401cc |
if (def->type != VIR_STORAGE_POOL_RBD &&
|
|
|
c401cc |
- def->type != VIR_STORAGE_POOL_SHEEPDOG) {
|
|
|
c401cc |
+ def->type != VIR_STORAGE_POOL_SHEEPDOG &&
|
|
|
c401cc |
+ def->type != VIR_STORAGE_POOL_GLUSTER) {
|
|
|
c401cc |
virBufferAddLit(&buf, " <target>\n");
|
|
|
c401cc |
|
|
|
c401cc |
virBufferEscapeString(&buf, " <path>%s</path>\n", def->target.path);
|
|
|
c401cc |
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
|
|
|
c401cc |
index 4ed800c..644facc 100644
|
|
|
c401cc |
--- a/src/conf/storage_conf.h
|
|
|
c401cc |
+++ b/src/conf/storage_conf.h
|
|
|
c401cc |
@@ -1,7 +1,7 @@
|
|
|
c401cc |
/*
|
|
|
c401cc |
* storage_conf.h: config handling for storage driver
|
|
|
c401cc |
*
|
|
|
c401cc |
- * Copyright (C) 2006-2008, 2010-2012 Red Hat, Inc.
|
|
|
c401cc |
+ * Copyright (C) 2006-2008, 2010-2013 Red Hat, Inc.
|
|
|
c401cc |
* Copyright (C) 2006-2008 Daniel P. Berrange
|
|
|
c401cc |
*
|
|
|
c401cc |
* This library is free software; you can redistribute it and/or
|
|
|
c401cc |
@@ -129,6 +129,7 @@ enum virStoragePoolType {
|
|
|
c401cc |
VIR_STORAGE_POOL_MPATH, /* Multipath devices */
|
|
|
c401cc |
VIR_STORAGE_POOL_RBD, /* RADOS Block Device */
|
|
|
c401cc |
VIR_STORAGE_POOL_SHEEPDOG, /* Sheepdog device */
|
|
|
c401cc |
+ VIR_STORAGE_POOL_GLUSTER, /* Gluster device */
|
|
|
c401cc |
|
|
|
c401cc |
VIR_STORAGE_POOL_LAST,
|
|
|
c401cc |
};
|
|
|
c401cc |
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
|
|
|
c401cc |
index 4bbf988..d19c250 100644
|
|
|
c401cc |
--- a/src/storage/storage_backend.c
|
|
|
c401cc |
+++ b/src/storage/storage_backend.c
|
|
|
c401cc |
@@ -80,6 +80,9 @@
|
|
|
c401cc |
#if WITH_STORAGE_SHEEPDOG
|
|
|
c401cc |
# include "storage_backend_sheepdog.h"
|
|
|
c401cc |
#endif
|
|
|
c401cc |
+#if WITH_STORAGE_GLUSTER
|
|
|
c401cc |
+# include "storage_backend_gluster.h"
|
|
|
c401cc |
+#endif
|
|
|
c401cc |
|
|
|
c401cc |
#define VIR_FROM_THIS VIR_FROM_STORAGE
|
|
|
c401cc |
|
|
|
c401cc |
@@ -112,6 +115,9 @@ static virStorageBackendPtr backends[] = {
|
|
|
c401cc |
#if WITH_STORAGE_SHEEPDOG
|
|
|
c401cc |
&virStorageBackendSheepdog,
|
|
|
c401cc |
#endif
|
|
|
c401cc |
+#if WITH_STORAGE_GLUSTER
|
|
|
c401cc |
+ &virStorageBackendGluster,
|
|
|
c401cc |
+#endif
|
|
|
c401cc |
NULL
|
|
|
c401cc |
};
|
|
|
c401cc |
|
|
|
c401cc |
diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h
|
|
|
c401cc |
index 3dc9c64..55e0fee 100644
|
|
|
c401cc |
--- a/src/storage/storage_backend.h
|
|
|
c401cc |
+++ b/src/storage/storage_backend.h
|
|
|
c401cc |
@@ -1,7 +1,7 @@
|
|
|
c401cc |
/*
|
|
|
c401cc |
* storage_backend.h: internal storage driver backend contract
|
|
|
c401cc |
*
|
|
|
c401cc |
- * Copyright (C) 2007-2010, 2012 Red Hat, Inc.
|
|
|
c401cc |
+ * Copyright (C) 2007-2010, 2012-2013 Red Hat, Inc.
|
|
|
c401cc |
* Copyright (C) 2007-2008 Daniel P. Berrange
|
|
|
c401cc |
*
|
|
|
c401cc |
* This library is free software; you can redistribute it and/or
|
|
|
c401cc |
@@ -68,6 +68,8 @@ virStorageBackendFSImageToolTypeToFunc(int tool_type);
|
|
|
c401cc |
typedef struct _virStorageBackend virStorageBackend;
|
|
|
c401cc |
typedef virStorageBackend *virStorageBackendPtr;
|
|
|
c401cc |
|
|
|
c401cc |
+/* Callbacks are optional unless documented otherwise; but adding more
|
|
|
c401cc |
+ * callbacks provides better pool support. */
|
|
|
c401cc |
struct _virStorageBackend {
|
|
|
c401cc |
int type;
|
|
|
c401cc |
|
|
|
c401cc |
@@ -75,7 +77,7 @@ struct _virStorageBackend {
|
|
|
c401cc |
virStorageBackendCheckPool checkPool;
|
|
|
c401cc |
virStorageBackendStartPool startPool;
|
|
|
c401cc |
virStorageBackendBuildPool buildPool;
|
|
|
c401cc |
- virStorageBackendRefreshPool refreshPool;
|
|
|
c401cc |
+ virStorageBackendRefreshPool refreshPool; /* Must be non-NULL */
|
|
|
c401cc |
virStorageBackendStopPool stopPool;
|
|
|
c401cc |
virStorageBackendDeletePool deletePool;
|
|
|
c401cc |
|
|
|
c401cc |
diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
|
|
|
c401cc |
new file mode 100644
|
|
|
c401cc |
index 0000000..2863c73
|
|
|
c401cc |
--- /dev/null
|
|
|
c401cc |
+++ b/src/storage/storage_backend_gluster.c
|
|
|
c401cc |
@@ -0,0 +1,46 @@
|
|
|
c401cc |
+/*
|
|
|
c401cc |
+ * storage_backend_gluster.c: storage backend for Gluster handling
|
|
|
c401cc |
+ *
|
|
|
c401cc |
+ * Copyright (C) 2013 Red Hat, Inc.
|
|
|
c401cc |
+ *
|
|
|
c401cc |
+ * This library is free software; you can redistribute it and/or
|
|
|
c401cc |
+ * modify it under the terms of the GNU Lesser General Public
|
|
|
c401cc |
+ * License as published by the Free Software Foundation; either
|
|
|
c401cc |
+ * version 2.1 of the License, or (at your option) any later version.
|
|
|
c401cc |
+ *
|
|
|
c401cc |
+ * This library is distributed in the hope that it will be useful,
|
|
|
c401cc |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
c401cc |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
c401cc |
+ * Lesser General Public License for more details.
|
|
|
c401cc |
+ *
|
|
|
c401cc |
+ * You should have received a copy of the GNU Lesser General Public
|
|
|
c401cc |
+ * License along with this library. If not, see
|
|
|
c401cc |
+ * <http://www.gnu.org/licenses/>.
|
|
|
c401cc |
+ *
|
|
|
c401cc |
+ */
|
|
|
c401cc |
+
|
|
|
c401cc |
+#include <config.h>
|
|
|
c401cc |
+
|
|
|
c401cc |
+#include <glusterfs/api/glfs.h>
|
|
|
c401cc |
+
|
|
|
c401cc |
+#include "virerror.h"
|
|
|
c401cc |
+#include "storage_backend_gluster.h"
|
|
|
c401cc |
+#include "storage_conf.h"
|
|
|
c401cc |
+
|
|
|
c401cc |
+#define VIR_FROM_THIS VIR_FROM_STORAGE
|
|
|
c401cc |
+
|
|
|
c401cc |
+
|
|
|
c401cc |
+static int
|
|
|
c401cc |
+virStorageBackendGlusterRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|
|
c401cc |
+ virStoragePoolObjPtr pool ATTRIBUTE_UNUSED)
|
|
|
c401cc |
+{
|
|
|
c401cc |
+ virReportError(VIR_ERR_NO_SUPPORT, "%s",
|
|
|
c401cc |
+ _("gluster pool type not fully supported yet"));
|
|
|
c401cc |
+ return -1;
|
|
|
c401cc |
+}
|
|
|
c401cc |
+
|
|
|
c401cc |
+virStorageBackend virStorageBackendGluster = {
|
|
|
c401cc |
+ .type = VIR_STORAGE_POOL_GLUSTER,
|
|
|
c401cc |
+
|
|
|
c401cc |
+ .refreshPool = virStorageBackendGlusterRefreshPool,
|
|
|
c401cc |
+};
|
|
|
c401cc |
diff --git a/src/storage/storage_backend_gluster.h b/src/storage/storage_backend_gluster.h
|
|
|
c401cc |
new file mode 100644
|
|
|
c401cc |
index 0000000..b21bda7
|
|
|
c401cc |
--- /dev/null
|
|
|
c401cc |
+++ b/src/storage/storage_backend_gluster.h
|
|
|
c401cc |
@@ -0,0 +1,29 @@
|
|
|
c401cc |
+/*
|
|
|
c401cc |
+ * storage_backend_gluster.h: storage backend for Gluster handling
|
|
|
c401cc |
+ *
|
|
|
c401cc |
+ * Copyright (C) 2013 Red Hat, Inc.
|
|
|
c401cc |
+ *
|
|
|
c401cc |
+ * This library is free software; you can redistribute it and/or
|
|
|
c401cc |
+ * modify it under the terms of the GNU Lesser General Public
|
|
|
c401cc |
+ * License as published by the Free Software Foundation; either
|
|
|
c401cc |
+ * version 2.1 of the License, or (at your option) any later version.
|
|
|
c401cc |
+ *
|
|
|
c401cc |
+ * This library is distributed in the hope that it will be useful,
|
|
|
c401cc |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
c401cc |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
c401cc |
+ * Lesser General Public License for more details.
|
|
|
c401cc |
+ *
|
|
|
c401cc |
+ * You should have received a copy of the GNU Lesser General Public
|
|
|
c401cc |
+ * License along with this library. If not, see
|
|
|
c401cc |
+ * <http://www.gnu.org/licenses/>.
|
|
|
c401cc |
+ *
|
|
|
c401cc |
+ */
|
|
|
c401cc |
+
|
|
|
c401cc |
+#ifndef __VIR_STORAGE_BACKEND_GLUSTER_H__
|
|
|
c401cc |
+# define __VIR_STORAGE_BACKEND_GLUSTER_H__
|
|
|
c401cc |
+
|
|
|
c401cc |
+# include "storage_backend.h"
|
|
|
c401cc |
+
|
|
|
c401cc |
+extern virStorageBackend virStorageBackendGluster;
|
|
|
c401cc |
+
|
|
|
c401cc |
+#endif /* __VIR_STORAGE_BACKEND_GLUSTER_H__ */
|
|
|
c401cc |
--
|
|
|
c401cc |
1.9.0
|
|
|
c401cc |
|