blob: 7ba36d2a3b02bea9c6a0bc9bc21ae1e341a7f20c [file] [log] [blame]
Sean Daguee263c822014-12-05 14:25:28 -05001#!/bin/bash
2#
Dean Troyera08ba1c2014-06-12 18:45:42 -05003# lib/cinder_backends/netapp_nfs
4# Configure the NetApp NFS driver
5
6# Enable with:
7#
8# NFS:
9# CINDER_ENABLED_BACKENDS+=,netapp_nfs:<volume-type-name>
10
11# Dependencies:
12#
13# - ``functions`` file
14# - ``cinder`` configurations
15
16# ``CINDER_CONF``
17# ``CINDER_CONF_DIR``
18# ``CINDER_ENABLED_BACKENDS``
19
20# configure_cinder_backend_netapp_nfs - configure NFS
21
22# Save trace setting
Ian Wienand523f4882015-10-13 11:03:03 +110023_XTRACE_CINDER_NETAPP=$(set +o | grep xtrace)
Dean Troyera08ba1c2014-06-12 18:45:42 -050024set +o xtrace
25
26
27# Entry Points
28# ------------
29
30# configure_cinder_backend_netapp_nfs - Set config files, create data dirs, etc
31function configure_cinder_backend_netapp_nfs {
32 # To use NetApp, set the following in local.conf:
33 # CINDER_ENABLED_BACKENDS+=,netapp_nfs:<volume-type-name>
34 # NETAPP_MODE=ontap_7mode|ontap_cluster
35 # NETAPP_IP=<mgmt-ip>
36 # NETAPP_LOGIN=<admin-account>
37 # NETAPP_PASSWORD=<admin-password>
38 # NETAPP_NFS_VOLUME_LIST=<export-volumes>
39
40 # In ontap_cluster mode, the following also needs to be defined:
41 # NETAPP_NFS_VSERVER=<vserver-name>
42
43 local be_name=$1
44 iniset $CINDER_CONF $be_name volume_backend_name $be_name
45 iniset $CINDER_CONF $be_name volume_driver "cinder.volume.drivers.netapp.common.NetAppDriver"
46 iniset $CINDER_CONF $be_name netapp_storage_family ${NETAPP_MODE:-ontap_7mode}
47 iniset $CINDER_CONF $be_name netapp_server_hostname $NETAPP_IP
48 iniset $CINDER_CONF $be_name netapp_login $NETAPP_LOGIN
49 iniset $CINDER_CONF $be_name netapp_password $NETAPP_PASSWORD
50
51 iniset $CINDER_CONF $be_name netapp_storage_protocol nfs
52 iniset $CINDER_CONF $be_name netapp_transport_type https
53 iniset $CINDER_CONF $be_name nfs_shares_config $CINDER_CONF_DIR/netapp_shares.conf
54
55 echo "$NETAPP_NFS_VOLUME_LIST" | tee "$CINDER_CONF_DIR/netapp_shares.conf"
56
57 if [[ "$NETAPP_MODE" == "ontap_cluster" ]]; then
58 iniset $CINDER_CONF $be_name netapp_vserver $NETAPP_NFS_VSERVER
59 fi
60}
61
62function cleanup_cinder_backend_netapp_nfs {
63 # Clean up remaining NFS mounts
64 # Be blunt and do them all
65 local m
66 for m in $CINDER_STATE_PATH/mnt/*; do
67 sudo umount $m
68 done
69}
70
71
72# Restore xtrace
Ian Wienand523f4882015-10-13 11:03:03 +110073$_XTRACE_CINDER_NETAPP
Dean Troyera08ba1c2014-06-12 18:45:42 -050074
75# Local variables:
76# mode: shell-script
77# End: