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