@@ -328,7 +328,23 @@ def _volume_to_library(self, volume) -> Generator[NetAppMinimalLibrary]:
328
328
original_host = volume ["host" ]
329
329
# svm plus pool_name
330
330
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
+
331
336
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
+
332
348
try :
333
349
lib = self ._libraries [svm_name ]
334
350
except KeyError :
@@ -386,6 +402,9 @@ def extend_volume(self, volume, new_size):
386
402
387
403
def initialize_connection (self , volume , connector ):
388
404
"""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" ]
389
408
with self ._volume_to_library (volume ) as lib :
390
409
return lib .initialize_connection (volume , connector )
391
410
0 commit comments