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