From a29656b76037954b1aa0b7c2b5cb53d1f37318e0 Mon Sep 17 00:00:00 2001 From: Will Szumski Date: Fri, 23 Feb 2024 17:06:51 +0000 Subject: [PATCH] Support mode in named volumes when using podman Volumes with a mode specifier were causing the container to fail to start with the error: "Wrong format of volume". ironic-dnsmasq was one services affected by this issue, but you could also hit this issue when using the volume customisation variables. Closes-Bug: #2054834 Change-Id: I848bd2838a17756f1c71b07befe1e3d966f5b6c2 (cherry picked from commit 9b3428c5046ec5032585bd6ea9baa50da3d82a4b) --- ansible/module_utils/kolla_podman_worker.py | 8 ++++++-- ...ed-volume-issues-when-using-mode-36b9862321eb9e68.yaml | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/fixes-podman-named-volume-issues-when-using-mode-36b9862321eb9e68.yaml diff --git a/ansible/module_utils/kolla_podman_worker.py b/ansible/module_utils/kolla_podman_worker.py index 2ace52bfcf..3531cfbbcd 100644 --- a/ansible/module_utils/kolla_podman_worker.py +++ b/ansible/module_utils/kolla_podman_worker.py @@ -176,7 +176,11 @@ class PodmanWorker(ContainerWorker): mounts.append(mount_item) else: try: - src, dest = item.split(':') + mode = 'rw' + if item.count(':') == 2: + src, dest, mode = item.split(':') + else: + src, dest = item.split(':') except ValueError: self.module.fail_json( msg="Wrong format of volume: {}".format(item), @@ -191,7 +195,7 @@ class PodmanWorker(ContainerWorker): else: filtered_volumes[src] = dict( bind=dest, - mode='rw' + mode=mode ) def parse_dimensions(self, dimensions): diff --git a/releasenotes/notes/fixes-podman-named-volume-issues-when-using-mode-36b9862321eb9e68.yaml b/releasenotes/notes/fixes-podman-named-volume-issues-when-using-mode-36b9862321eb9e68.yaml new file mode 100644 index 0000000000..06821859ee --- /dev/null +++ b/releasenotes/notes/fixes-podman-named-volume-issues-when-using-mode-36b9862321eb9e68.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes an issue, when using podman, with named volumes that use a mode + specifier. See `LP#2054834 + `_ for more details.