From 89224aec1c676f2a15f2af8d0e2e923ee21973a1 Mon Sep 17 00:00:00 2001 From: mkatari Date: Tue, 17 Dec 2024 21:04:08 +0530 Subject: [PATCH 1/2] support cinder netapp nfs backend adoption Add support cinder netapp nfs backend adoption --- .../files/cinder-volume-ontap-secrets.yaml | 18 +++++++++++++++++ .../files/cinder_netapp_nfs.yaml | 20 +++++++++++++++++++ .../cinder_adoption/tasks/volume_backend.yaml | 7 +++++++ 3 files changed, 45 insertions(+) create mode 100644 tests/roles/cinder_adoption/files/cinder-volume-ontap-secrets.yaml create mode 100644 tests/roles/cinder_adoption/files/cinder_netapp_nfs.yaml diff --git a/tests/roles/cinder_adoption/files/cinder-volume-ontap-secrets.yaml b/tests/roles/cinder_adoption/files/cinder-volume-ontap-secrets.yaml new file mode 100644 index 000000000..3b36b3dfb --- /dev/null +++ b/tests/roles/cinder_adoption/files/cinder-volume-ontap-secrets.yaml @@ -0,0 +1,18 @@ +# Define the "cinder-volume-ontap-secrets" Secret that contains sensitive +# information pertaining to the [ontap] backend. +apiVersion: v1 +kind: Secret +metadata: + labels: + service: cinder + component: cinder-volume + name: cinder-volume-ontap-secrets +type: Opaque +stringData: + ontap-cinder-secrets: | + [ontap] + netapp_login=admin_username + netapp_password=admin_password + netapp_vserver=svm_name + nas_host=10.63.165.215 + nas_share_path=/nfs/test diff --git a/tests/roles/cinder_adoption/files/cinder_netapp_nfs.yaml b/tests/roles/cinder_adoption/files/cinder_netapp_nfs.yaml new file mode 100644 index 000000000..6045aae39 --- /dev/null +++ b/tests/roles/cinder_adoption/files/cinder_netapp_nfs.yaml @@ -0,0 +1,20 @@ +spec: + cinder: + template: + cinderVolumes: + ontap-nfs: + networkAttachments: + - storage + customServiceConfig: | + [ontap] + volume_backend_name=ontap + volume_driver=cinder.volume.drivers.netapp.common.NetAppDriver + nfs_snapshot_support=true + nas_secure_file_operations=false + nas_secure_file_permissions=false + netapp_server_hostname=hostname + netapp_server_port=80 + netapp_storage_protocol=nfs + netapp_storage_family=ontap_cluster + customServiceConfigSecrets: + - cinder-volume-ontap-secrets diff --git a/tests/roles/cinder_adoption/tasks/volume_backend.yaml b/tests/roles/cinder_adoption/tasks/volume_backend.yaml index 937f0e0f0..60c038801 100644 --- a/tests/roles/cinder_adoption/tasks/volume_backend.yaml +++ b/tests/roles/cinder_adoption/tasks/volume_backend.yaml @@ -4,3 +4,10 @@ {{ shell_header }} {{ oc_header }} oc patch openstackcontrolplane openstack --type=merge --patch '{{ cinder_volume_backend_patch }}' + +- name: deploy podified Cinder volume + when: cinder_volume_backend == 'nfs_netapp' + ansible.builtin.shell: | + {{ shell_header }} + {{ oc_header }} + oc patch openstackcontrolplane openstack --type=merge --patch-file={{ role_path }}/files/cinder_netapp_nfs.yaml From 13135c685b2b7c19bdc7448ef01c23c6a9a5952f Mon Sep 17 00:00:00 2001 From: mkatari Date: Wed, 18 Dec 2024 17:35:58 +0530 Subject: [PATCH 2/2] testing: enable nfs backend in test_minimal playbook --- tests/playbooks/test_minimal.yaml | 3 ++ .../files/cinder_netapp_nfs.yaml | 6 ++-- .../cinder_adoption/tasks/volume_backend.yaml | 32 ++++++++++++++++--- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/tests/playbooks/test_minimal.yaml b/tests/playbooks/test_minimal.yaml index e1fc1c1b2..96e2839c5 100644 --- a/tests/playbooks/test_minimal.yaml +++ b/tests/playbooks/test_minimal.yaml @@ -4,6 +4,9 @@ - name: Adoption hosts: "{{ adoption_host | default('localhost') }}" gather_facts: false + #testing purpose, will be removed later + vars: + cinder_volume_backend: nfs_netapp force_handlers: true module_defaults: ansible.builtin.shell: diff --git a/tests/roles/cinder_adoption/files/cinder_netapp_nfs.yaml b/tests/roles/cinder_adoption/files/cinder_netapp_nfs.yaml index 6045aae39..1837374f0 100644 --- a/tests/roles/cinder_adoption/files/cinder_netapp_nfs.yaml +++ b/tests/roles/cinder_adoption/files/cinder_netapp_nfs.yaml @@ -6,8 +6,8 @@ spec: networkAttachments: - storage customServiceConfig: | - [ontap] - volume_backend_name=ontap + [nfs_netapp] + volume_backend_name=nfs_netapp volume_driver=cinder.volume.drivers.netapp.common.NetAppDriver nfs_snapshot_support=true nas_secure_file_operations=false @@ -16,5 +16,3 @@ spec: netapp_server_port=80 netapp_storage_protocol=nfs netapp_storage_family=ontap_cluster - customServiceConfigSecrets: - - cinder-volume-ontap-secrets diff --git a/tests/roles/cinder_adoption/tasks/volume_backend.yaml b/tests/roles/cinder_adoption/tasks/volume_backend.yaml index 60c038801..f0fbd7910 100644 --- a/tests/roles/cinder_adoption/tasks/volume_backend.yaml +++ b/tests/roles/cinder_adoption/tasks/volume_backend.yaml @@ -1,4 +1,4 @@ -- name: deploy podified Cinder volume +- name: deploy podified Cinder volume with ceph when: cinder_volume_backend == 'ceph' ansible.builtin.shell: | {{ shell_header }} @@ -7,7 +7,29 @@ - name: deploy podified Cinder volume when: cinder_volume_backend == 'nfs_netapp' - ansible.builtin.shell: | - {{ shell_header }} - {{ oc_header }} - oc patch openstackcontrolplane openstack --type=merge --patch-file={{ role_path }}/files/cinder_netapp_nfs.yaml + block: + - name: + ansible.builtin.shell: | + {{ shell_header }} + {{ oc_header }} + oc patch openstackcontrolplane openstack --type=merge --patch-file={{ role_path }}/files/cinder_netapp_nfs.yaml + + - name: Add ontap secret + ansible.builtin.shell: | + {{ shell_header }} + {{ oc_header }} + oc apply -f - <