2626import com .linbit .linstor .api .model .ResourceDefinitionCloneRequest ;
2727import com .linbit .linstor .api .model .ResourceDefinitionCloneStarted ;
2828import com .linbit .linstor .api .model .ResourceDefinitionCreate ;
29- import com .linbit .linstor .api .model .ResourceDefinitionModify ;
3029import com .linbit .linstor .api .model .ResourceGroupSpawn ;
3130import com .linbit .linstor .api .model .ResourceMakeAvailable ;
3231import com .linbit .linstor .api .model .Snapshot ;
6261import com .cloud .storage .DataStoreRole ;
6362import com .cloud .storage .ResizeVolumePayload ;
6463import com .cloud .storage .SnapshotVO ;
65- import com .cloud .storage .Storage .StoragePoolType ;
6664import com .cloud .storage .Storage ;
65+ import com .cloud .storage .Storage .StoragePoolType ;
6766import com .cloud .storage .StorageManager ;
6867import com .cloud .storage .StoragePool ;
6968import com .cloud .storage .VMTemplateStoragePoolVO ;
@@ -389,27 +388,6 @@ private void applyQoSSettings(StoragePoolVO storagePool, DevelopersApi api, Stri
389388 }
390389 }
391390
392- private void applyAuxProps (DevelopersApi api , String rscName , String dispName , String vmName )
393- throws ApiException
394- {
395- ResourceDefinitionModify rdm = new ResourceDefinitionModify ();
396- Properties props = new Properties ();
397- if (dispName != null )
398- {
399- props .put ("Aux/cs-name" , dispName );
400- }
401- if (vmName != null )
402- {
403- props .put ("Aux/cs-vm-name" , vmName );
404- }
405- if (!props .isEmpty ())
406- {
407- rdm .setOverrideProps (props );
408- ApiCallRcList answers = api .resourceDefinitionModify (rscName , rdm );
409- checkLinstorAnswersThrow (answers );
410- }
411- }
412-
413391 private String getRscGrp (StoragePoolVO storagePoolVO ) {
414392 return storagePoolVO .getUserInfo () != null && !storagePoolVO .getUserInfo ().isEmpty () ?
415393 storagePoolVO .getUserInfo () : "DfltRscGrp" ;
@@ -427,7 +405,8 @@ private String createResourceBase(
427405 ApiCallRcList answers = api .resourceGroupSpawn (rscGrp , rscGrpSpawn );
428406 checkLinstorAnswersThrow (answers );
429407
430- applyAuxProps (api , rscName , volName , vmName );
408+ answers = LinstorUtil .applyAuxProps (api , rscName , volName , vmName );
409+ checkLinstorAnswersThrow (answers );
431410
432411 return LinstorUtil .getDevicePath (api , rscName );
433412 } catch (ApiException apiEx )
@@ -499,7 +478,7 @@ private String cloneResource(long csCloneId, VolumeInfo volumeInfo, StoragePoolV
499478 resizeResource (linstorApi , rscName , volumeInfo .getSize ());
500479 }
501480
502- applyAuxProps (linstorApi , rscName , volumeInfo .getName (), volumeInfo .getAttachedVmName ());
481+ LinstorUtil . applyAuxProps (linstorApi , rscName , volumeInfo .getName (), volumeInfo .getAttachedVmName ());
503482 applyQoSSettings (storagePoolVO , linstorApi , rscName , volumeInfo .getMaxIops ());
504483
505484 return LinstorUtil .getDevicePath (linstorApi , rscName );
@@ -551,7 +530,7 @@ private String createResourceFromSnapshot(long csSnapshotId, String rscName, Sto
551530 answers = linstorApi .resourceSnapshotRestore (cloneRes , snapName , snapshotRestore );
552531 checkLinstorAnswersThrow (answers );
553532
554- applyAuxProps (linstorApi , rscName , volumeVO .getName (), null );
533+ LinstorUtil . applyAuxProps (linstorApi , rscName , volumeVO .getName (), null );
555534 applyQoSSettings (storagePoolVO , linstorApi , rscName , volumeVO .getMaxIops ());
556535
557536 return LinstorUtil .getDevicePath (linstorApi , rscName );
0 commit comments