NetApp backend support
Change-Id: I49896aba03dbc350482f8a55937b52d0735afdfd
diff --git a/README.rst b/README.rst
index d42a2c6..3dd21a6 100644
--- a/README.rst
+++ b/README.rst
@@ -280,6 +280,36 @@
options: rw,sync
+Cinder setup with NetApp
+
+.. code-block:: yaml
+
+ cinder:
+ controller:
+ backend:
+ netapp:
+ engine: netapp
+ type_name: netapp
+ user: openstack
+ vserver: vm1
+ server_hostname: 172.18.2.3
+ password: password
+ storage_protocol: nfs
+ transport_type: https
+ lun_space_reservation: enabled
+ use_multipath_for_image_xfer: True
+ devices:
+ - 172.18.1.2:/vol_1
+ - 172.18.1.2:/vol_2
+ - 172.18.1.2:/vol_3
+ - 172.18.1.2:/vol_4
+ compute:
+ backend:
+ netapp:
+ engine: netapp
+ storage_protocol: nfs
+
+
Cinder setup with Hitachi VPS
.. code-block:: yaml
diff --git a/cinder/compute.sls b/cinder/compute.sls
new file mode 100644
index 0000000..bcede64
--- /dev/null
+++ b/cinder/compute.sls
@@ -0,0 +1,20 @@
+{%- from "cinder/map.jinja" import compute with context %}
+{%- if compute.get('enabled', False) %}
+
+include:
+- cinder.user
+
+{%- for backend_name, backend in compute.get('backend', {}).iteritems() %}
+
+{%- if backend.engine is defined and backend.engine == 'nfs' or (backend.engine == 'netapp' and backend.storage_protocol == 'nfs') %}
+
+cinder_netapp_compute_packages:
+ pkg.installed:
+ - pkgs:
+ - nfs-common
+
+{%- endif %}
+
+{%- endfor %}
+
+{%- endif %}
diff --git a/cinder/controller.sls b/cinder/controller.sls
index a00bd3f..4d8c334 100644
--- a/cinder/controller.sls
+++ b/cinder/controller.sls
@@ -119,7 +119,7 @@
{%- for backend_name, backend in controller.get('backend', {}).iteritems() %}
-{%- if backend.engine is defined and backend.engine == 'nfs' %}
+{%- if backend.engine is defined and backend.engine == 'nfs' or (backend.engine == 'netapp' and backend.storage_protocol == 'nfs') %}
/etc/cinder/nfs_shares_{{ backend_name }}:
file.managed:
- source: salt://cinder/files/{{ controller.version }}/nfs_shares
@@ -129,6 +129,20 @@
- require:
- pkg: cinder_controller_packages
+cinder_netapp_packages:
+ pkg.installed:
+ - pkgs:
+ - nfs-common
+
+{%- endif %}
+
+{%- if backend.get('use_multipath_for_image_xfer', False) %}
+
+cinder_netapp_add_packages:
+ pkg.installed:
+ - pkgs:
+ - multipath-tools
+
{%- endif %}
cinder_type_create_{{ backend_name }}:
diff --git a/cinder/files/backend/_netapp.conf b/cinder/files/backend/_netapp.conf
new file mode 100644
index 0000000..be77604
--- /dev/null
+++ b/cinder/files/backend/_netapp.conf
@@ -0,0 +1,32 @@
+
+
+[{{ backend_name }}]
+netapp_login={{ backend.user }}
+netapp_controller_ips={{ backend.get('controller_ip', '') }}
+netapp_lun_ostype={{ backend.get('lun_ostype', 'linux') }}
+netapp_vserver={{ backend.vserver }}
+netapp_server_port={{ backend.get('server_port', '443') }}
+nfs_shares_config=/etc/cinder/nfs_shares_{{ backend_name }}
+netapp_sa_password={{ backend.get('sa_password', '') }}
+thres_avl_size_perc_start={{ backend.get('avl_size_perc_start', '20') }}
+reserved_percentage={{ backend.get('reserved_percentage', '0') }}
+volume_driver=cinder.volume.drivers.netapp.common.NetAppDriver
+netapp_enable_multiattach={{ backend.get('enable_multiattach', False) }}
+netapp_storage_protocol={{ backend.storage_protocol }}
+max_oversubscription_ratio={{ backend.get('max_oversubscription_ratio', '1.0') }}
+backend_host=str:netapp
+netapp_storage_family={{ backend.get('storage_family', 'ontap_cluster') }}
+volume_backend_name={{ backend_name }}
+nfs_mount_options={{ backend.get('nfs_mount_options', '') }}
+thres_avl_size_perc_stop={{ backend.get('avl_size_perc_stop', '60') }}
+netapp_vfiler={{ backend.get('vfiler', '') }}
+netapp_server_hostname={{ backend.server_hostname }}
+netapp_host_type={{ backend.get('host_type', 'linux') }}
+expiry_thres_minutes={{ backend.get('expiry_thres_minutes', '720') }}
+netapp_pool_name_search_pattern={{ backend.get('pool_name_search_pattern', '(.+)') }}
+netapp_transport_type={{ backend.get('transport_type', 'http') }}
+netapp_password={{ backend.password }}
+netapp_webservice_path={{ backend.get('webservice_path', '/devmgr/v2') }}
+netapp_lun_space_reservation={{ backend.get('lun_space_reservation', 'disabled') }}
+use_multipath_for_image_xfer={{ backend.get('use_multipath_for_image_xfer', False) }}
+netapp_copyoffload_tool_path={{ backend.get('copyoffload_tool_path', '') }}
diff --git a/cinder/init.sls b/cinder/init.sls
index 967b134..9a15d91 100644
--- a/cinder/init.sls
+++ b/cinder/init.sls
@@ -3,6 +3,9 @@
{% if pillar.cinder.controller is defined %}
- cinder.controller
{% endif %}
+{% if pillar.cinder.compute is defined %}
+- cinder.compute
+{% endif %}
{% if pillar.cinder.volume is defined %}
- cinder.volume
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/cinder/map.jinja b/cinder/map.jinja
index 340eb9b..0755d54 100644
--- a/cinder/map.jinja
+++ b/cinder/map.jinja
@@ -64,3 +64,37 @@
}
},
}, merge=pillar.cinder.get('volume', {})) %}
+
+{% set compute = salt['grains.filter_by']({
+ 'Debian': {
+ 'pkgs': [],
+ 'services': [],
+ 'wipe_method': 'none',
+ 'notification': False,
+ 'cors': {},
+ 'audit': {
+ 'enabled': false
+ },
+ 'backup': {
+ 'pkgs': [],
+ 'services': [],
+ 'engine': None
+ }
+ },
+ 'RedHat': {
+ 'pkgs': [],
+ 'services': [],
+ 'wipe_method': 'none',
+ 'notification': False,
+ 'cors': {},
+ 'audit': {
+ 'enabled': false
+ },
+ 'backup': {
+ 'pkgs': [],
+ 'services': [],
+ 'engine': None
+ }
+
+ },
+}, merge=pillar.cinder.get('compute', {})) %}
diff --git a/metadata/service/compute/single.yml b/metadata/service/compute/single.yml
new file mode 100644
index 0000000..097e874
--- /dev/null
+++ b/metadata/service/compute/single.yml
@@ -0,0 +1,8 @@
+applications:
+- cinder
+classes:
+- service.cinder.support
+parameters:
+ cinder:
+ compute:
+ enabled: true
diff --git a/tests/pillar/netapp.sls b/tests/pillar/netapp.sls
new file mode 100644
index 0000000..7a7baa0
--- /dev/null
+++ b/tests/pillar/netapp.sls
@@ -0,0 +1,31 @@
+cinder:
+ controller:
+ enabled: true
+ version: mitaka
+ backend:
+ netapp:
+ engine: netapp
+ type_name: netapp
+ user: openstack
+ vserver: vm1
+ server_hostname: 172.18.2.3
+ password: password
+ storage_protocol: nfs
+ transport_type: https
+ netapp_lun_space_reservation: enabled
+ use_multipath_for_image_xfer: True
+ devices:
+ - 172.18.2.2:/vol_1
+ - 172.18.2.2:/vol_2
+ - 172.18.2.2:/vol_3
+ - 172.18.2.2:/vol_4
+ volume:
+ enabled: true
+ version: mitaka
+ compute:
+ enabled: true
+ version: mitaka
+ backend:
+ netapp:
+ engine: netapp
+ storage_protocol: nfs