Skip to content

Commit 45b7565

Browse files
authored
Merge pull request #1191 from rackerlabs/netapp_driver_fixes
fix(cinder-understack): handle SVM name stripped in pool name and bad values passed from nova
2 parents d52f790 + 2c31f33 commit 45b7565

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

python/cinder-understack/cinder_understack/dynamic_netapp_driver.py

Lines changed: 19 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:
@@ -386,6 +402,9 @@ def extend_volume(self, volume, new_size):
386402

387403
def initialize_connection(self, volume, connector):
388404
"""Initialize connection to volume."""
405+
# TODO: the nova ironic driver sends the field 'initiator' but the NetApp
406+
# cinder driver expects the field to be 'nqn' so copy the field over
407+
connector["nqn"] = connector["initiator"]
389408
with self._volume_to_library(volume) as lib:
390409
return lib.initialize_connection(volume, connector)
391410

0 commit comments

Comments
 (0)