From 8f1e605adf22f4157a8fef15afb0637434d1a5bb Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 15 Oct 2023 12:49:08 +0900 Subject: [PATCH] Fix parsing of protocol access mapping options The protocol access mapping options should accept dictionaries whose values are lists, not strings. Closes-Bug: 2038607 Change-Id: Id75082507cee27bef03318dc3af5ae5c1b233505 --- manila/data/manager.py | 4 +++- manila/share/driver.py | 4 +++- ...fix-protocol-access-mapping-opts-e7d61db3e2a84be7.yaml | 8 ++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/bug-2038607-fix-protocol-access-mapping-opts-e7d61db3e2a84be7.yaml diff --git a/manila/data/manager.py b/manila/data/manager.py index 20312fff15..e5de6e85aa 100644 --- a/manila/data/manager.py +++ b/manila/data/manager.py @@ -20,6 +20,7 @@ import os import shutil from oslo_config import cfg +from oslo_config import types from oslo_log import log from oslo_service import periodic_task from oslo_utils import excutils @@ -67,8 +68,9 @@ backup_opts = [ default=['lost+found'], help="List of files and folders to be ignored when backing up " "shares. Items should be names (not including any path)."), - cfg.DictOpt( + cfg.Opt( 'backup_protocol_access_mapping', + type=types.Dict(types.List(types.String(), bounds=True)), default={'ip': ['nfs']}, help="Protocol access mapping for backup. Should be a " "dictionary comprised of " diff --git a/manila/share/driver.py b/manila/share/driver.py index 2ca29df652..339a15a21a 100644 --- a/manila/share/driver.py +++ b/manila/share/driver.py @@ -21,6 +21,7 @@ Drivers for shares. import time from oslo_config import cfg +from oslo_config import types from oslo_log import log from manila.common import constants @@ -109,8 +110,9 @@ share_opts = [ "specify the executable with all necessary parameters for the " "protocol supported. 'path' template element is required. It is " "advisable to separate different commands per backend."), - cfg.DictOpt( + cfg.Opt( 'protocol_access_mapping', + type=types.Dict(types.List(types.String(), bounds=True)), default={ 'ip': ['nfs'], 'user': ['cifs'], diff --git a/releasenotes/notes/bug-2038607-fix-protocol-access-mapping-opts-e7d61db3e2a84be7.yaml b/releasenotes/notes/bug-2038607-fix-protocol-access-mapping-opts-e7d61db3e2a84be7.yaml new file mode 100644 index 0000000000..37bca398c9 --- /dev/null +++ b/releasenotes/notes/bug-2038607-fix-protocol-access-mapping-opts-e7d61db3e2a84be7.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + `bug 2038607 `_: Fixed + parse of the protcol_access_mapping option and + the backup_protocol_access_mapping option. This change requires that + the values used for these options should be formatted like + `key0=[value00, value01],key1=[value10]`.