Thang Pham | eae7c99 | 2014-07-27 00:06:52 -0400 | [diff] [blame^] | 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: |