From ef4044b62fe1e481dbf814dadb03e1f460c8eaef Mon Sep 17 00:00:00 2001
From: Rene Luria <rene.luria@infomaniak.com>
Date: Mon, 11 Oct 2021 11:14:40 +0200
Subject: [PATCH] csi_driver / cinder: implement rescan-on-resize variable via
 (#8057)

cinder_csi_rescan_on_resize
---
 roles/kubernetes-apps/csi_driver/cinder/defaults/main.yml | 8 ++++++++
 .../cinder/templates/cinder-csi-cloud-config.j2           | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/roles/kubernetes-apps/csi_driver/cinder/defaults/main.yml b/roles/kubernetes-apps/csi_driver/cinder/defaults/main.yml
index e52187da2..65f433594 100644
--- a/roles/kubernetes-apps/csi_driver/cinder/defaults/main.yml
+++ b/roles/kubernetes-apps/csi_driver/cinder/defaults/main.yml
@@ -18,3 +18,11 @@ cinder_cacert: "{{ lookup('env','OS_CACERT') }}"
 # For now, only Cinder v3 is supported in Cinder CSI driver
 cinder_blockstorage_version: "v3"
 cinder_csi_controller_replicas: 1
+
+# Optional. Set to true, to rescan block device and verify its size before expanding
+# the filesystem.
+# Not all hypervizors have a /sys/class/block/XXX/device/rescan location, therefore if
+# you enable this option and your hypervizor doesn't support this, you'll get a warning
+# log on resize event. It is recommended to disable this option in this case.
+# Defaults to false
+# cinder_csi_rescan_on_resize: true
diff --git a/roles/kubernetes-apps/csi_driver/cinder/templates/cinder-csi-cloud-config.j2 b/roles/kubernetes-apps/csi_driver/cinder/templates/cinder-csi-cloud-config.j2
index 1c0ef28bb..1a83f7dbd 100644
--- a/roles/kubernetes-apps/csi_driver/cinder/templates/cinder-csi-cloud-config.j2
+++ b/roles/kubernetes-apps/csi_driver/cinder/templates/cinder-csi-cloud-config.j2
@@ -39,3 +39,6 @@ ignore-volume-az={{ cinder_csi_ignore_volume_az | bool }}
 {% if node_volume_attach_limit is defined and node_volume_attach_limit != "" %}
 node-volume-attach-limit="{{ node_volume_attach_limit }}"
 {% endif %}
+{% if cinder_csi_rescan_on_resize is defined %}
+rescan-on-resize={{ cinder_csi_rescan_on_resize | bool }}
+{% endif %}
\ No newline at end of file
-- 
GitLab