| Sean Dague | e263c82 | 2014-12-05 14:25:28 -0500 | [diff] [blame] | 1 | #!/bin/bash | 
|  | 2 | # | 
| Alon Marx | d178cf4 | 2014-07-30 23:44:33 +0300 | [diff] [blame] | 3 | # Copyright 2014 IBM Corp. | 
|  | 4 | # Copyright (c) 2014 OpenStack Foundation | 
|  | 5 | # All Rights Reserved. | 
|  | 6 | # | 
|  | 7 | #    Licensed under the Apache License, Version 2.0 (the "License"); you may | 
|  | 8 | #    not use this file except in compliance with the License. You may obtain | 
|  | 9 | #    a copy of the License at | 
|  | 10 | # | 
|  | 11 | #         http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 12 | # | 
|  | 13 | #    Unless required by applicable law or agreed to in writing, software | 
|  | 14 | #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | 
|  | 15 | #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | 
|  | 16 | #    License for the specific language governing permissions and limitations | 
|  | 17 | #    under the License. | 
|  | 18 | # | 
|  | 19 | # Authors: | 
|  | 20 | #   Alon Marx <alonma@il.ibm.com> | 
| Dean Troyer | 3324f19 | 2014-09-18 09:26:39 -0500 | [diff] [blame] | 21 | # | 
| Alon Marx | d178cf4 | 2014-07-30 23:44:33 +0300 | [diff] [blame] | 22 |  | 
|  | 23 | # lib/cinder_plugins/xiv | 
|  | 24 | # Configure the xiv_ds8k driver for xiv testing | 
|  | 25 |  | 
|  | 26 | # Enable xiv_ds8k driver for xiv with: | 
|  | 27 | # | 
|  | 28 | #   CINDER_ENABLED_BACKENDS+=,xiv:<volume-type-name> | 
|  | 29 | #   XIV_DRIVER_VERSION=<version-string> | 
|  | 30 | #   SAN_IP=<storage-ip-or-hostname> | 
|  | 31 | #   SAN_LOGIN=<storage-admin-account> | 
|  | 32 | #   SAN_PASSWORD=<storage-admin-password> | 
|  | 33 | #   SAN_CLUSTERNAME=<cluster-name> | 
|  | 34 | #   CONNECTION_TYPE=<connection-type> iscsi|fc | 
|  | 35 | #   XIV_CHAP=<chap-type> disabled|enabled | 
|  | 36 |  | 
|  | 37 | # Dependencies: | 
|  | 38 | # | 
|  | 39 | # - ``functions`` file | 
|  | 40 | # - ``cinder`` configurations | 
|  | 41 |  | 
|  | 42 | # configure_cinder_backend_xiv - Configure Cinder for xiv backends | 
|  | 43 |  | 
|  | 44 | # Save trace setting | 
|  | 45 | XIV_XTRACE=$(set +o | grep xtrace) | 
|  | 46 | set +o xtrace | 
|  | 47 |  | 
|  | 48 | # Defaults | 
|  | 49 | # -------- | 
|  | 50 | # Set up default directories | 
|  | 51 |  | 
|  | 52 |  | 
|  | 53 | # Entry Points | 
|  | 54 | # ------------ | 
|  | 55 |  | 
|  | 56 | # configure_cinder_backend_xiv - Set config files, create data dirs, etc | 
|  | 57 | function configure_cinder_backend_xiv { | 
|  | 58 |  | 
|  | 59 | local be_name=$1 | 
|  | 60 |  | 
|  | 61 | python -c 'from xiv_ds8k_openstack.xiv_nova_proxy import XIVNovaProxy' | 
|  | 62 | if [ $? -ne 0 ]; then | 
|  | 63 | die $LINENO "XIV_DS8K driver is missing. Please install first" | 
|  | 64 | fi | 
|  | 65 |  | 
|  | 66 | # For reference: | 
| Dean Troyer | 3324f19 | 2014-09-18 09:26:39 -0500 | [diff] [blame] | 67 | # ``XIV_DS8K_BACKEND='IBM-XIV_'${SAN_IP}'_'${SAN_CLUSTERNAME}'_'${CONNECTION_TYPE}`` | 
| Alon Marx | d178cf4 | 2014-07-30 23:44:33 +0300 | [diff] [blame] | 68 | iniset $CINDER_CONF DEFAULT xiv_ds8k_driver_version $XIV_DRIVER_VERSION | 
|  | 69 |  | 
|  | 70 | iniset $CINDER_CONF $be_name san_ip $SAN_IP | 
|  | 71 | iniset $CINDER_CONF $be_name san_login $SAN_LOGIN | 
|  | 72 | iniset $CINDER_CONF $be_name san_password $SAN_PASSWORD | 
|  | 73 | iniset $CINDER_CONF $be_name san_clustername $SAN_CLUSTERNAME | 
|  | 74 | iniset $CINDER_CONF $be_name xiv_ds8k_connection_type $CONNECTION_TYPE | 
|  | 75 | iniset $CINDER_CONF $be_name volume_backend_name $be_name | 
|  | 76 | iniset $CINDER_CONF $be_name volume_driver 'cinder.volume.drivers.ibm.xiv_ds8k.XIVDS8KDriver' | 
|  | 77 | iniset $CINDER_CONF $be_name xiv_ds8k_proxy 'xiv_ds8k_openstack.xiv_nova_proxy.XIVNovaProxy' | 
|  | 78 | iniset $CINDER_CONF $be_name xiv_chap $XIV_CHAP | 
|  | 79 | } | 
|  | 80 |  | 
|  | 81 | # Restore xtrace | 
|  | 82 | $XIV_XTRACE | 
|  | 83 |  | 
|  | 84 | # Local variables: | 
|  | 85 | # mode: shell-script | 
|  | 86 | # End: |