Skip to content

Commit eae7c99

Browse files
committed
Support GlusterFS cinder backend
Commit 0971833 added support for multiple cinder backend types. It initially only contains lvm and nfs. The following patch adds glusterfs to the backends supported. Change-Id: I9d5c1dfd4e0d05fcbfe3c35172150c57aa4e6eb2
1 parent 5dd1778 commit eae7c99

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

lib/cinder_backends/glusterfs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# lib/cinder_backends/glusterfs
2+
# Configure the glusterfs backend
3+
4+
# Enable with:
5+
#
6+
# CINDER_ENABLED_BACKENDS+=,glusterfs:<volume-type-name>
7+
8+
# Dependencies:
9+
#
10+
# - ``functions`` file
11+
# - ``cinder`` configurations
12+
13+
# CINDER_CONF
14+
# CINDER_CONF_DIR
15+
# CINDER_GLUSTERFS_SHARES - Contents of glusterfs shares config file
16+
17+
# configure_cinder_backend_glusterfs - Configure Cinder for GlusterFS backends
18+
19+
# Save trace setting
20+
GLUSTERFS_XTRACE=$(set +o | grep xtrace)
21+
set +o xtrace
22+
23+
24+
# Entry Points
25+
# ------------
26+
27+
# configure_cinder_backend_glusterfs - Set config files, create data dirs, etc
28+
function configure_cinder_backend_glusterfs {
29+
local be_name=$1
30+
iniset $CINDER_CONF $be_name volume_backend_name $be_name
31+
iniset $CINDER_CONF $be_name volume_driver "cinder.volume.drivers.glusterfs.GlusterfsDriver"
32+
iniset $CINDER_CONF $be_name glusterfs_shares_config "$CINDER_CONF_DIR/glusterfs-shares-$be_name.conf"
33+
34+
if [[ -n "$CINDER_GLUSTERFS_SHARES" ]]; then
35+
CINDER_GLUSTERFS_SHARES=$(echo $CINDER_GLUSTERFS_SHARES | tr ";" "\n")
36+
echo "$CINDER_GLUSTERFS_SHARES" | tee "$CINDER_CONF_DIR/glusterfs-shares-$be_name.conf"
37+
fi
38+
}
39+
40+
41+
# Restore xtrace
42+
$GLUSTERFS_XTRACE
43+
44+
# Local variables:
45+
# mode: shell-script
46+
# End:

0 commit comments

Comments
 (0)