Sean Dague | e263c82 | 2014-12-05 14:25:28 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
Dean Troyer | 0971833 | 2014-07-03 10:46:57 -0500 | [diff] [blame] | 3 | # lib/cinder_backends/nfs |
| 4 | # Configure the nfs backend |
| 5 | |
| 6 | # Enable with: |
| 7 | # |
| 8 | # CINDER_ENABLED_BACKENDS+=,nfs:<volume-type-name> |
| 9 | |
| 10 | # Dependencies: |
| 11 | # |
| 12 | # - ``functions`` file |
| 13 | # - ``cinder`` configurations |
| 14 | |
| 15 | # CINDER_CONF |
| 16 | # CINDER_CONF_DIR |
| 17 | # CINDER_NFS_SERVERPATH - contents of nfs shares config file |
| 18 | |
| 19 | # configure_cinder_backend_nfs - Configure Cinder for NFS backends |
| 20 | |
| 21 | # Save trace setting |
Ian Wienand | 523f488 | 2015-10-13 11:03:03 +1100 | [diff] [blame] | 22 | _XTRACE_CINDER_NFS=$(set +o | grep xtrace) |
Dean Troyer | 0971833 | 2014-07-03 10:46:57 -0500 | [diff] [blame] | 23 | set +o xtrace |
| 24 | |
| 25 | |
| 26 | # Entry Points |
| 27 | # ------------ |
| 28 | |
| 29 | # configure_cinder_backend_nfs - Set config files, create data dirs, etc |
| 30 | function configure_cinder_backend_nfs { |
| 31 | local be_name=$1 |
| 32 | iniset $CINDER_CONF $be_name volume_backend_name $be_name |
| 33 | iniset $CINDER_CONF $be_name volume_driver "cinder.volume.drivers.nfs.NfsDriver" |
| 34 | iniset $CINDER_CONF $be_name nfs_shares_config "$CINDER_CONF_DIR/nfs-shares-$be_name.conf" |
| 35 | |
| 36 | echo "$CINDER_NFS_SERVERPATH" | tee "$CINDER_CONF_DIR/nfs-shares-$be_name.conf" |
| 37 | } |
| 38 | |
| 39 | |
| 40 | # Restore xtrace |
Ian Wienand | 523f488 | 2015-10-13 11:03:03 +1100 | [diff] [blame] | 41 | $_XTRACE_CINDER_NFS |
Dean Troyer | 0971833 | 2014-07-03 10:46:57 -0500 | [diff] [blame] | 42 | |
| 43 | # Local variables: |
| 44 | # mode: shell-script |
| 45 | # End: |