From d2e2d58a5f74a094e996d41313ef478001a9a437 Mon Sep 17 00:00:00 2001 From: Karl Kloppenborg Date: Mon, 5 Apr 2021 14:39:40 +0000 Subject: [PATCH] Add ISCSI Multipath support when enable_iscsi true When using iscsi in both cinder and nova multipath tooling access is not currently available. This commit provides the host system access to configure and control multipath. This commit has been tested in our own production systems however this is my first commit into Openstack-Helm so please review carefully and provide me guidance on what I might be able to do better. Change-Id: I4f017f67a5d80b9c931e2ee1653062aa503a7fd9 --- cinder/Chart.yaml | 2 +- cinder/templates/bin/_multipath.tpl | 18 ++++++++++++++++++ cinder/templates/bin/_multipathd.tpl | 18 ++++++++++++++++++ cinder/templates/configmap-bin.yaml | 4 ++++ cinder/templates/deployment-volume.yaml | 22 ++++++++++++++++++++++ nova/Chart.yaml | 2 +- nova/templates/bin/_multipath.tpl | 18 ++++++++++++++++++ nova/templates/bin/_multipathd.tpl | 18 ++++++++++++++++++ nova/templates/configmap-bin.yaml | 4 ++++ nova/templates/daemonset-compute.yaml | 25 +++++++++++++++++++++++++ releasenotes/notes/cinder.yaml | 1 + releasenotes/notes/nova.yaml | 1 + 12 files changed, 131 insertions(+), 2 deletions(-) create mode 100644 cinder/templates/bin/_multipath.tpl create mode 100644 cinder/templates/bin/_multipathd.tpl create mode 100644 nova/templates/bin/_multipath.tpl create mode 100644 nova/templates/bin/_multipathd.tpl diff --git a/cinder/Chart.yaml b/cinder/Chart.yaml index 33aa5ca8..55df4145 100644 --- a/cinder/Chart.yaml +++ b/cinder/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Cinder name: cinder -version: 0.1.13 +version: 0.1.14 home: https://docs.openstack.org/cinder/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Cinder/OpenStack_Project_Cinder_vertical.png sources: diff --git a/cinder/templates/bin/_multipath.tpl b/cinder/templates/bin/_multipath.tpl new file mode 100644 index 00000000..7f84c9c8 --- /dev/null +++ b/cinder/templates/bin/_multipath.tpl @@ -0,0 +1,18 @@ +#!/bin/bash + +{{/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +chroot /mnt/host-rootfs /usr/bin/env -i PATH="/sbin:/bin:/usr/bin" \ + multipath "${@:1}" diff --git a/cinder/templates/bin/_multipathd.tpl b/cinder/templates/bin/_multipathd.tpl new file mode 100644 index 00000000..a9ff34a6 --- /dev/null +++ b/cinder/templates/bin/_multipathd.tpl @@ -0,0 +1,18 @@ +#!/bin/bash + +{{/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +chroot /mnt/host-rootfs /usr/bin/env -i PATH="/sbin:/bin:/usr/bin" \ + multipathd "${@:1}" diff --git a/cinder/templates/configmap-bin.yaml b/cinder/templates/configmap-bin.yaml index aba1cb00..40700856 100644 --- a/cinder/templates/configmap-bin.yaml +++ b/cinder/templates/configmap-bin.yaml @@ -24,6 +24,10 @@ data: {{- if .Values.conf.enable_iscsi }} iscsiadm: | {{ tuple "bin/_iscsiadm.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} + multipath: | +{{ tuple "bin/_multipath.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} + multipathd: | +{{ tuple "bin/_multipathd.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} {{- end }} {{- if .Values.images.local_registry.active }} image-repo-sync.sh: | diff --git a/cinder/templates/deployment-volume.yaml b/cinder/templates/deployment-volume.yaml index 6bf3a91d..13cc4695 100755 --- a/cinder/templates/deployment-volume.yaml +++ b/cinder/templates/deployment-volume.yaml @@ -248,6 +248,22 @@ spec: - name: cinder-bin mountPath: /usr/local/sbin/iscsiadm subPath: iscsiadm + - name: cinder-bin + mountPath: /usr/local/sbin/multipath + subPath: multipath + - name: cinder-bin + mountPath: /usr/local/sbin/multipathd + subPath: multipathd + - name: etcmultipath + mountPath: /etc/multipath + {{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "10" ) }} + mountPropagation: Bidirectional + {{- end }} + - name: sys + mountPath: /sys + {{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "10" ) }} + mountPropagation: HostToContainer + {{- end }} {{- end }} {{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.volume.api.internal "path" "/etc/cinder/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} {{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_db.auth.admin.secret.tls.internal "path" "/etc/mysql/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} @@ -304,6 +320,12 @@ spec: path: /etc/iscsi - name: usrlocalsbin emptyDir: {} + - name: etcmultipath + hostPath: + path: /etc/multipath + - name: sys + hostPath: + path: /sys {{- end }} {{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} {{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.volume.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} diff --git a/nova/Chart.yaml b/nova/Chart.yaml index d464e287..f3e023ce 100644 --- a/nova/Chart.yaml +++ b/nova/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Nova name: nova -version: 0.1.16 +version: 0.1.17 home: https://docs.openstack.org/nova/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Nova/OpenStack_Project_Nova_vertical.png sources: diff --git a/nova/templates/bin/_multipath.tpl b/nova/templates/bin/_multipath.tpl new file mode 100644 index 00000000..7f84c9c8 --- /dev/null +++ b/nova/templates/bin/_multipath.tpl @@ -0,0 +1,18 @@ +#!/bin/bash + +{{/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +chroot /mnt/host-rootfs /usr/bin/env -i PATH="/sbin:/bin:/usr/bin" \ + multipath "${@:1}" diff --git a/nova/templates/bin/_multipathd.tpl b/nova/templates/bin/_multipathd.tpl new file mode 100644 index 00000000..a9ff34a6 --- /dev/null +++ b/nova/templates/bin/_multipathd.tpl @@ -0,0 +1,18 @@ +#!/bin/bash + +{{/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +chroot /mnt/host-rootfs /usr/bin/env -i PATH="/sbin:/bin:/usr/bin" \ + multipathd "${@:1}" diff --git a/nova/templates/configmap-bin.yaml b/nova/templates/configmap-bin.yaml index 13622c5b..5b9bd854 100644 --- a/nova/templates/configmap-bin.yaml +++ b/nova/templates/configmap-bin.yaml @@ -24,6 +24,10 @@ data: {{- if .Values.conf.enable_iscsi }} iscsiadm: | {{ tuple "bin/_iscsiadm.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} + multipath: | +{{ tuple "bin/_multipath.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} + multipathd: | +{{ tuple "bin/_multipathd.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} {{- end }} {{- if .Values.images.local_registry.active }} image-repo-sync.sh: | diff --git a/nova/templates/daemonset-compute.yaml b/nova/templates/daemonset-compute.yaml index fca4e823..9d32a168 100644 --- a/nova/templates/daemonset-compute.yaml +++ b/nova/templates/daemonset-compute.yaml @@ -384,6 +384,24 @@ spec: - name: nova-bin mountPath: /usr/local/sbin/iscsiadm subPath: iscsiadm + - name: runlock + mountPath: /run/lock + - name: nova-bin + mountPath: /usr/local/sbin/multipath + subPath: multipath + - name: nova-bin + mountPath: /usr/local/sbin/multipathd + subPath: multipathd + - name: etcmultipath + mountPath: /etc/multipath + {{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "10" ) }} + mountPropagation: Bidirectional + {{- end }} + - name: sysblock + mountPath: /sys/block + {{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "10" ) }} + mountPropagation: HostToContainer + {{- end }} {{- end }} {{- if ( has "tungstenfabric" .Values.network.backend ) }} - name: tf-plugin-shared @@ -503,6 +521,13 @@ spec: path: /dev - name: usrlocalsbin emptyDir: {} + - name: etcmultipath + hostPath: + path: /etc/multipath + - name: sysblock + hostPath: + path: /sys/block + {{- end }} {{- if ( has "tungstenfabric" .Values.network.backend ) }} - name: tf-plugin-shared diff --git a/releasenotes/notes/cinder.yaml b/releasenotes/notes/cinder.yaml index 274f3069..bfcca28f 100644 --- a/releasenotes/notes/cinder.yaml +++ b/releasenotes/notes/cinder.yaml @@ -14,3 +14,4 @@ cinder: - 0.1.11 Update RBAC apiVersion from /v1beta1 to /v1 - 0.1.12 Update volume type creation bootstrap logic - 0.1.13 Add NFS cinder backup override + - 0.1.14 Add Multipathd support for ISCSI backed volumes diff --git a/releasenotes/notes/nova.yaml b/releasenotes/notes/nova.yaml index b6122bfc..252c7bf1 100644 --- a/releasenotes/notes/nova.yaml +++ b/releasenotes/notes/nova.yaml @@ -17,3 +17,4 @@ nova: - 0.1.14 BUG for deploying multiple compute nodes - 0.1.15 Mount /dev/pts in Nova compute container - 0.1.16 Use first IP address for migration + - 0.1.17 Add multipathd support for ISCSI backed volume VMs