Walter A. Boring IV | b107f9c | 2019-07-01 16:19:12 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # lib/cinder_backends/ceph_iscsi |
| 4 | # Configure the ceph_iscsi backend |
| 5 | |
| 6 | # Enable with: |
| 7 | # |
| 8 | # CINDER_ENABLED_BACKENDS+=,ceph_iscsi:ceph_iscsi |
| 9 | # |
| 10 | # Optional paramteters: |
| 11 | # CEPH_ISCSI_API_URL=<url to the rbd-target-api service> |
| 12 | # |
| 13 | # Dependencies: |
| 14 | # |
| 15 | # - ``functions`` file |
| 16 | # - ``cinder`` configurations |
| 17 | |
| 18 | # configure_ceph_backend_ceph_iscsi - called from configure_cinder() |
| 19 | |
| 20 | |
| 21 | # Save trace setting |
| 22 | _XTRACE_CINDER_CEPH_ISCSI=$(set +o | grep xtrace) |
| 23 | set +o xtrace |
| 24 | |
| 25 | # Entry Points |
| 26 | # ------------ |
| 27 | |
| 28 | # configure_cinder_backend_ceph_iscsi - Set config files, create data dirs, etc |
| 29 | # configure_cinder_backend_ceph_iscsi $name |
| 30 | function configure_cinder_backend_ceph_iscsi { |
| 31 | local be_name=$1 |
| 32 | |
| 33 | CEPH_ISCSI_API_URL=${CEPH_ISCSI_API_URL:-http://$CEPH_ISCSI_API_HOST:$CEPH_ISCSI_API_PORT} |
| 34 | |
| 35 | iniset $CINDER_CONF $be_name volume_backend_name $be_name |
| 36 | iniset $CINDER_CONF $be_name volume_driver "cinder.volume.drivers.ceph.rbd_iscsi.RBDISCSIDriver" |
| 37 | iniset $CINDER_CONF $be_name rbd_ceph_conf "$CEPH_CONF_FILE" |
| 38 | iniset $CINDER_CONF $be_name rbd_pool "$CINDER_CEPH_POOL" |
| 39 | iniset $CINDER_CONF $be_name rbd_user "$CINDER_CEPH_USER" |
| 40 | iniset $CINDER_CONF $be_name rbd_iscsi_api_user "$CEPH_ISCSI_API_USER" |
| 41 | iniset $CINDER_CONF $be_name rbd_iscsi_api_password "$CEPH_ISCSI_API_PASSWORD" |
| 42 | iniset $CINDER_CONF $be_name rbd_iscsi_api_url "$CEPH_ISCSI_API_URL" |
| 43 | iniset $CINDER_CONF $be_name rbd_iscsi_target_iqn "$CEPH_ISCSI_TARGET_IQN" |
| 44 | iniset $CINDER_CONF $be_name rbd_flatten_volume_from_snapshot False |
| 45 | iniset $CINDER_CONF $be_name rbd_max_clone_depth 5 |
| 46 | iniset $CINDER_CONF DEFAULT glance_api_version 2 |
| 47 | |
| 48 | pip_install rbd-iscsi-client |
| 49 | } |
| 50 | |
| 51 | # Restore xtrace |
| 52 | $_XTRACE_CINDER_CEPH_ISCSI |
| 53 | |
| 54 | # Local variables: |
| 55 | # mode: shell-script |
| 56 | # End: |