From 2f30df188ded064bf253475b23184e3f24a4477b Mon Sep 17 00:00:00 2001 From: Simon Dodsley Date: Wed, 21 Feb 2024 11:38:55 -0500 Subject: [PATCH] Add Pure Cinder backend --- .kitchen.yml | 5 ++ .travis.yml | 5 ++ README.rst | 15 ++++ cinder/files/backend/_pure.conf | 20 +++++ cinder/volume.sls | 15 ++++ tests/pillar/pure_single.sls | 140 ++++++++++++++++++++++++++++++++ 6 files changed, 200 insertions(+) create mode 100644 cinder/files/backend/_pure.conf create mode 100644 tests/pillar/pure_single.sls diff --git a/.kitchen.yml b/.kitchen.yml index 1bb0668..9a0cc8a 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -103,6 +103,11 @@ suites: pillars-from-files: cinder.sls: tests/pillar/lefthand_single.sls + - name: pure_single + provisioner: + pillars-from-files: + cinder.sls: tests/pillar/pure_single.sls + - name: solidfire_single provisioner: pillars-from-files: diff --git a/.travis.yml b/.travis.yml index 9e561fc..ebad3d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,7 @@ env: - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2016.3 OS_VERSION=mitaka SUITE=gpfs-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2016.3 OS_VERSION=mitaka SUITE=hp3par-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2016.3 OS_VERSION=mitaka SUITE=lefthand-single + - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2016.3 OS_VERSION=mitaka SUITE=pure-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2016.3 OS_VERSION=mitaka SUITE=solidfire-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2016.3 OS_VERSION=mitaka SUITE=storwize-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2016.3 OS_VERSION=mitaka SUITE=volume-single @@ -37,12 +38,14 @@ env: - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 OS_VERSION=ocata SUITE=control-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 OS_VERSION=ocata SUITE=gpfs-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 OS_VERSION=ocata SUITE=lefthand-single + - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 OS_VERSION=ocata SUITE=pure-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 OS_VERSION=ocata SUITE=storwize-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 OS_VERSION=ocata SUITE=volume-single-barbican - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 OS_VERSION=pike SUITE=ceph-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 OS_VERSION=pike SUITE=control-cluster - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 OS_VERSION=pike SUITE=control-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 OS_VERSION=pike SUITE=hp3par-single + - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 OS_VERSION=pike SUITE=pure-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 OS_VERSION=pike SUITE=solidfire-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 OS_VERSION=pike SUITE=volume-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 OS_VERSION=pike SUITE=vsp-single @@ -50,6 +53,7 @@ env: - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2018.3 OS_VERSION=ocata SUITE=control-cluster - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2018.3 OS_VERSION=ocata SUITE=control-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2018.3 OS_VERSION=ocata SUITE=hp3par-single + - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2018.3 OS_VERSION=ocata SUITE=pure-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2018.3 OS_VERSION=ocata SUITE=solidfire-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2018.3 OS_VERSION=ocata SUITE=volume-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2018.3 OS_VERSION=ocata SUITE=vsp-single @@ -58,6 +62,7 @@ env: - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2018.3 OS_VERSION=pike SUITE=control-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2018.3 OS_VERSION=pike SUITE=gpfs-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2018.3 OS_VERSION=pike SUITE=lefthand-single + - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2018.3 OS_VERSION=pike SUITE=pure-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2018.3 OS_VERSION=pike SUITE=storwize-single - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2018.3 OS_VERSION=pike SUITE=volume-single-barbican # - PLATFORM=epcim/salt:saltstack-ubuntu-bionic-salt-2017.7 OS_VERSION=ocata SUITE=ceph-single diff --git a/README.rst b/README.rst index 2713758..4880544 100644 --- a/README.rst +++ b/README.rst @@ -541,6 +541,21 @@ Volume vmware related options: cinder type-key normal-storage set hplh:data_pl=r-10-2 hplh:provisioning=full +* Cinder setup with PureStorage: + + .. code-block:: yaml + + cinder: + volume: + enabled: true + backend: + pure: + type_name: normal-storage + engine: pure + protocol: ISCSI + san_ip: 10.10.10.10 + pure_api_token: 960e185a-255f-4bdb-3b03-3b9eb1e5cf1f + * Cinder setup with Solidfire: .. code-block:: yaml diff --git a/cinder/files/backend/_pure.conf b/cinder/files/backend/_pure.conf new file mode 100644 index 0000000..32cd20e --- /dev/null +++ b/cinder/files/backend/_pure.conf @@ -0,0 +1,20 @@ + +[{{ backend_name }}] +{%- if (pillar.cinder.get('volume', {}).get('version', '') == 'juno') or (pillar.cinder.get('controller', {}).get('version', '') == 'juno') %} +host={{ backend.get('host', grains.host) }} +{%- else %} +backend_host={{ backend.get('host', grains.host) }} +{%- endif %} +volume_backend_name={{ backend_name }} +san_ip={{ backend.san_ip }} +pure_api_token = {{ backend.pure_api_token' }} +{%- if backend.use_chap_auth is defined %} +use_chap_auth = {{ backend.use_chap_auth }} +{%- endif %} +{%- if backend.pure_eradicate_on_delete is defined %} +pure_eradicate_on_delete = {{ backend.get('pure_eradicate_on_delete', True) }} +{%- endif %} +{%- if backend.use_multipath_for_image_xfer is defined %} +use_multipath_for_image_xfer = {{ backend.get('use_multipath_for_image_xfer', True) }} +{%- endif %} +volume_driver=cinder.volume.drivers.pure.Pure{{ backend.get('protocol', ISCSI) }}Driver diff --git a/cinder/volume.sls b/cinder/volume.sls index 57bb23e..d461542 100644 --- a/cinder/volume.sls +++ b/cinder/volume.sls @@ -271,6 +271,21 @@ hp3parclient: {%- endif %} +{%- if backend.engine == 'pure' %} + +pureclient: + pkg.installed: + - names: + - python-pip + +purestorage: + pip.installed: + - name: purestorage + - require: + - pkg: pureclient + +{%- endif %} + {%- if backend.engine == 'fujitsu' %} cinder_driver_fujitsu_{{ loop.index }}: diff --git a/tests/pillar/pure_single.sls b/tests/pillar/pure_single.sls new file mode 100644 index 0000000..b1a3bfe --- /dev/null +++ b/tests/pillar/pure_single.sls @@ -0,0 +1,140 @@ +cinder: + controller: + enabled: true + version: liberty + backend: + pure_backend: + type_name: pure + engine: pure + backend: pure_backend + san_ip: 127.0.0.1 + pure_api_token: 960e185a-255f-4bdb-3b03-3b9eb1e5cf1f + protocol: ISCSI + identity: + engine: keystone + host: 127.0.0.1 + port: 35357 + tenant: service + user: cinder + password: pwd + region: regionOne + osapi: + host: 127.0.0.1 + osapi_max_limit: 500 + glance: + host: 127.0.0.1 + port: 9292 + logging: + log_appender: false + log_handlers: + watchedfile: + enabled: true + fluentd: + enabled: false + ossyslog: + enabled: false + default_volume_type: 7k2SaS + message_queue: + engine: rabbitmq + host: 127.0.0.1 + port: 5672 + user: openstack + password: pwd + virtual_host: '/openstack' + database: + engine: mysql + host: 127.0.0.1 + port: 3306 + name: cinder + user: cinder + password: pwd + volume: + enabled: true + version: liberty + backend: + pure_backend: + type_name: pure + engine: pure + backend: pure_backend + san_ip: 127.0.0.1 + pure_api_token: 960e185a-255f-4bdb-3b03-3b9eb1e5cf1f + protocol: ISCSI + identity: + engine: keystone + host: 127.0.0.1 + port: 35357 + tenant: service + user: cinder + password: pwd + region: regionOne + osapi: + host: 127.0.0.1 + glance: + host: 127.0.0.1 + port: 9292 + logging: + log_appender: false + log_handlers: + watchedfile: + enabled: true + fluentd: + enabled: false + ossyslog: + enabled: false + default_volume_type: 7k2SaS + message_queue: + engine: rabbitmq + host: 127.0.0.1 + port: 5672 + user: openstack + password: pwd + virtual_host: '/openstack' + database: + engine: mysql + host: 127.0.0.1 + port: 3306 + name: cinder + user: cinder + password: pwd +apache: + server: + enabled: true + default_mpm: event + mpm: + prefork: + enabled: true + servers: + start: 5 + spare: + min: 2 + max: 10 + max_requests: 0 + max_clients: 20 + limit: 20 + site: + cinder: + enabled: false + available: true + type: wsgi + name: cinder + wsgi: + daemon_process: cinder-wsgi + processes: 5 + threads: 1 + user: cinder + group: cinder + display_name: '%{GROUP}' + script_alias: '/ /usr/bin/cinder-wsgi' + application_group: '%{GLOBAL}' + authorization: 'On' + host: + address: 127.0.0.1 + name: 127.0.0.1 + port: 8776 + log: + custom: + format: >- + %v:%p %{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %D %O \"%{Referer}i\" \"%{User-Agent}i\" + error: + enabled: true + format: '%M'