john-griffith | d0860cc | 2014-01-23 11:31:10 -0700 | [diff] [blame] | 1 | # lib/cinder_plugins/glusterfs |
| 2 | # Configure the glusterfs driver |
| 3 | |
| 4 | # Enable with: |
| 5 | # |
| 6 | # CINDER_DRIVER=glusterfs |
| 7 | |
| 8 | # Dependencies: |
| 9 | # |
| 10 | # - ``functions`` file |
| 11 | # - ``cinder`` configurations |
| 12 | |
| 13 | # configure_cinder_driver - make configuration changes, including those to other services |
| 14 | |
| 15 | # Save trace setting |
| 16 | MY_XTRACE=$(set +o | grep xtrace) |
| 17 | set +o xtrace |
| 18 | |
| 19 | |
| 20 | # Defaults |
| 21 | # -------- |
| 22 | |
| 23 | # Set up default directories |
| 24 | |
| 25 | |
| 26 | # Entry Points |
| 27 | # ------------ |
| 28 | |
| 29 | # configure_cinder_driver - Set config files, create data dirs, etc |
| 30 | function configure_cinder_driver() { |
| 31 | # To use glusterfs, set the following in localrc: |
| 32 | # CINDER_DRIVER=glusterfs |
| 33 | # CINDER_GLUSTERFS_SHARES="127.0.0.1:/vol1;127.0.0.1:/vol2" |
| 34 | # Shares are <host>:<volume> and separated by semicolons. |
| 35 | |
| 36 | iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.glusterfs.GlusterfsDriver" |
| 37 | iniset $CINDER_CONF DEFAULT glusterfs_shares_config "$CINDER_CONF_DIR/glusterfs_shares" |
| 38 | touch $CINDER_CONF_DIR/glusterfs_shares |
| 39 | if [ ! -z "$CINDER_GLUSTERFS_SHARES" ]; then |
| 40 | CINDER_GLUSTERFS_SHARES=$(echo $CINDER_GLUSTERFS_SHARES | tr ";" "\n") |
| 41 | echo "$CINDER_GLUSTERFS_SHARES" > $CINDER_CONF_DIR/glusterfs_shares |
| 42 | fi |
| 43 | } |
| 44 | |
| 45 | # Restore xtrace |
| 46 | $MY_XTRACE |
| 47 | |
| 48 | # Local variables: |
| 49 | # mode: shell-script |
| 50 | # End: |