Skip to content

Commit 6b6ef30

Browse files
skrobulcardoe
authored andcommitted
fix(cinder-understack): handle case when SVM name is already stripped
When we call the helper method to strip the SVM name from the volume host name, it is possible it has already been stripped by another call which is chaining into this call. So we need to handle that and load the SVM name in a different way.
1 parent d52f790 commit 6b6ef30

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

python/cinder-understack/cinder_understack/dynamic_netapp_driver.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,23 @@ def _volume_to_library(self, volume) -> Generator[NetAppMinimalLibrary]:
328328
original_host = volume["host"]
329329
# svm plus pool_name
330330
svm_pool_name = volume_utils.extract_host(original_host, level="pool")
331+
if not svm_pool_name:
332+
raise exception.InvalidInput(
333+
reason=f"pool name not found in {original_host}"
334+
)
335+
331336
svm_name = svm_pool_name.split(_SVM_NAME_DELIM)[0]
337+
# workaround when the svm_name has already been stripped from the pool
338+
prefix = self.configuration.netapp_vserver_prefix
339+
if not svm_name.startswith(prefix):
340+
LOG.debug(
341+
"Volume host already had SVM name stripped %s, "
342+
"using volume project_id %s",
343+
original_host,
344+
volume["project_id"],
345+
)
346+
svm_name = f"os-{volume['project_id']}"
347+
332348
try:
333349
lib = self._libraries[svm_name]
334350
except KeyError:

0 commit comments

Comments
 (0)