4545@ Component
4646public class Utility {
4747
48- private static final Logger s_logger = ( Logger ) LogManager .getLogger (Utility .class );
48+ private static final Logger s_logger = LogManager .getLogger (Utility .class );
4949 @ Inject private OntapStorage ontapStorage ;
5050 @ Inject private PrimaryDataStoreDao storagePoolDao ;
5151 @ Inject private StoragePoolDetailsDao storagePoolDetailsDao ;
@@ -109,6 +109,10 @@ public CloudStackVolume createCloudStackVolumeRequestByProtocol(StoragePoolVO st
109109 }
110110
111111 public StorageStrategy getStrategyByStoragePoolDetails (Map <String , String > details ) {
112+ if (details == null || details .isEmpty ()) {
113+ s_logger .error ("getStrategyByStoragePoolDetails: Storage pool details are null or empty" );
114+ throw new CloudRuntimeException ("getStrategyByStoragePoolDetails: Storage pool details are null or empty" );
115+ }
112116 String protocol = details .get (Constants .PROTOCOL );
113117 OntapStorage ontapStorage = new OntapStorage (details .get (Constants .USERNAME ), details .get (Constants .PASSWORD ),
114118 details .get (Constants .MANAGEMENT_LIF ), details .get (Constants .SVM_NAME ), ProtocolType .valueOf (protocol ),
@@ -119,8 +123,8 @@ public StorageStrategy getStrategyByStoragePoolDetails(Map<String, String> detai
119123 s_logger .info ("Connection to Ontap SVM [{}] successful" , details .get (Constants .SVM_NAME ));
120124 return storageStrategy ;
121125 } else {
122- s_logger .error ("createCloudStackVolumeForTypeVolume : Connection to Ontap SVM [" + details .get (Constants .SVM_NAME ) + "] failed" );
123- throw new CloudRuntimeException ("createCloudStackVolumeForTypeVolume : Connection to Ontap SVM [" + details .get (Constants .SVM_NAME ) + "] failed" );
126+ s_logger .error ("getStrategyByStoragePoolDetails : Connection to Ontap SVM [" + details .get (Constants .SVM_NAME ) + "] failed" );
127+ throw new CloudRuntimeException ("getStrategyByStoragePoolDetails : Connection to Ontap SVM [" + details .get (Constants .SVM_NAME ) + "] failed" );
124128 }
125129 }
126130}
0 commit comments