2323import com .cloud .utils .exception .CloudRuntimeException ;
2424import feign .FeignException ;
2525import org .apache .cloudstack .storage .datastore .db .StoragePoolDetailsDao ;
26- import org .apache .cloudstack .storage .feign .FeignClientFactory ;
27- import org .apache .cloudstack .storage .feign .client .SANFeignClient ;
28- import org .apache .cloudstack .engine .subsystem .api .storage .PrimaryDataStoreInfo ;
2926import org .apache .cloudstack .storage .feign .model .Igroup ;
3027import org .apache .cloudstack .storage .feign .model .Initiator ;
3128import org .apache .cloudstack .storage .feign .model .Svm ;
@@ -67,7 +64,7 @@ public CloudStackVolume createCloudStackVolume(CloudStackVolume cloudstackVolume
6764 s_logger .info ("createCloudStackVolume : Creating Lun with cloudstackVolume request {} " , cloudstackVolume );
6865 if (cloudstackVolume == null || cloudstackVolume .getLun () == null ) {
6966 s_logger .error ("createCloudStackVolume: LUN creation failed. Invalid request: {}" , cloudstackVolume );
70- throw new CloudRuntimeException ("createCloudStackVolume : Failed to create Lun, invalid request" );
67+ throw new CloudRuntimeException (" Failed to create Lun, invalid request" );
7168 }
7269 try {
7370 // Get AuthHeader
@@ -106,7 +103,7 @@ CloudStackVolume updateCloudStackVolume(CloudStackVolume cloudstackVolume) {
106103 public void deleteCloudStackVolume (CloudStackVolume cloudstackVolume ) {
107104 if (cloudstackVolume == null || cloudstackVolume .getLun () == null ) {
108105 s_logger .error ("deleteCloudStackVolume: Lun deletion failed. Invalid request: {}" , cloudstackVolume );
109- throw new CloudRuntimeException ("deleteCloudStackVolume : Failed to delete Lun, invalid request" );
106+ throw new CloudRuntimeException (" Failed to delete Lun, invalid request" );
110107 }
111108 s_logger .info ("deleteCloudStackVolume : Deleting Lun: {}" , cloudstackVolume .getLun ().getName ());
112109 try {
@@ -139,13 +136,13 @@ public CloudStackVolume getCloudStackVolume(Map<String, String> values) {
139136 s_logger .debug ("getCloudStackVolume : fetching Lun with params {} " , values );
140137 if (values == null || values .isEmpty ()) {
141138 s_logger .error ("getCloudStackVolume: get Lun failed. Invalid request: {}" , values );
142- throw new CloudRuntimeException ("getCloudStackVolume : get Lun Failed, invalid request" );
139+ throw new CloudRuntimeException (" get Lun Failed, invalid request" );
143140 }
144141 String svmName = values .get (Constants .SVM_DOT_NAME );
145142 String lunName = values .get (Constants .NAME );
146143 if (svmName == null || lunName == null || svmName .isEmpty () || lunName .isEmpty ()) {
147144 s_logger .error ("getCloudStackVolume: get Lun failed. Invalid svm:{} or Lun name: {}" , svmName , lunName );
148- throw new CloudRuntimeException ("getCloudStackVolume : Failed to get Lun, invalid request" );
145+ throw new CloudRuntimeException ("Failed to get Lun, invalid request" );
149146 }
150147 try {
151148 String authHeader = Utility .generateAuthHeader (storage .getUsername (), storage .getPassword ());
@@ -180,14 +177,14 @@ public AccessGroup createAccessGroup(AccessGroup accessGroup) {
180177 s_logger .debug ("createAccessGroup : Creating Igroup with access group request {} " , accessGroup );
181178 if (accessGroup == null ) {
182179 s_logger .error ("createAccessGroup: Igroup creation failed. Invalid request: {}" , accessGroup );
183- throw new CloudRuntimeException ("createAccessGroup : Failed to create Igroup, invalid request" );
180+ throw new CloudRuntimeException (" Failed to create Igroup, invalid request" );
184181 }
185182 // Get StoragePool details
186183 if (accessGroup .getStoragePoolId () == null ) {
187- throw new CloudRuntimeException ("createAccessGroup : Failed to create Igroup, invalid datastore details in the request" );
184+ throw new CloudRuntimeException (" Failed to create Igroup, invalid datastore details in the request" );
188185 }
189186 if (accessGroup .getHostsToConnect () == null || accessGroup .getHostsToConnect ().isEmpty ()) {
190- throw new CloudRuntimeException ("createAccessGroup : Failed to create Igroup, no hosts to connect provided in the request" );
187+ throw new CloudRuntimeException (" Failed to create Igroup, no hosts to connect provided in the request" );
191188 }
192189
193190 String igroupName = null ;
@@ -202,7 +199,7 @@ public AccessGroup createAccessGroup(AccessGroup accessGroup) {
202199
203200 // Check if all hosts support the protocol
204201 if (!validateProtocolSupport (accessGroup .getHostsToConnect (), protocol )) {
205- String errMsg = "createAccessGroup: Not all hosts " + " support the protocol: " + protocol .name ();
202+ String errMsg = " Not all hosts " + " support the protocol: " + protocol .name ();
206203 throw new CloudRuntimeException (errMsg );
207204 }
208205
@@ -268,14 +265,14 @@ public void deleteAccessGroup(AccessGroup accessGroup) {
268265
269266 if (accessGroup == null ) {
270267 s_logger .error ("deleteAccessGroup: Igroup deletion failed. Invalid request: {}" , accessGroup );
271- throw new CloudRuntimeException ("deleteAccessGroup : Failed to delete Igroup, invalid request" );
268+ throw new CloudRuntimeException (" Failed to delete Igroup, invalid request" );
272269 }
273270 // Get StoragePool details
274271 if (accessGroup .getStoragePoolId () == null ) {
275- throw new CloudRuntimeException ("deleteAccessGroup : Failed to delete Igroup, invalid datastore details in the request" );
272+ throw new CloudRuntimeException (" Failed to delete Igroup, invalid datastore details in the request" );
276273 }
277274 if (accessGroup .getHostsToConnect () == null || accessGroup .getHostsToConnect ().isEmpty ()) {
278- throw new CloudRuntimeException ("deleteAccessGroup : Failed to delete Igroup, no hosts to connect provided in the request" );
275+ throw new CloudRuntimeException (" Failed to delete Igroup, no hosts to connect provided in the request" );
279276 }
280277
281278 try {
@@ -303,7 +300,7 @@ public void deleteAccessGroup(AccessGroup accessGroup) {
303300 String igroupUuid = igroup .getUuid ();
304301
305302 if (igroupUuid == null || igroupUuid .isEmpty ()) {
306- throw new CloudRuntimeException ("deleteAccessGroup: iGroup UUID is null or empty for iGroup: " + igroupName );
303+ throw new CloudRuntimeException (" iGroup UUID is null or empty for iGroup: " + igroupName );
307304 }
308305
309306 s_logger .info ("deleteAccessGroup: Deleting iGroup '{}' with UUID '{}'" , igroupName , igroupUuid );
@@ -357,13 +354,13 @@ public AccessGroup getAccessGroup(Map<String, String> values) {
357354 s_logger .debug ("getAccessGroup : fetching Igroup with params {} " , values );
358355 if (values == null || values .isEmpty ()) {
359356 s_logger .error ("getAccessGroup: get Igroup failed. Invalid request: {}" , values );
360- throw new CloudRuntimeException ("getAccessGroup : get Igroup Failed, invalid request" );
357+ throw new CloudRuntimeException (" get Igroup Failed, invalid request" );
361358 }
362359 String svmName = values .get (Constants .SVM_DOT_NAME );
363360 String igroupName = values .get (Constants .NAME );
364361 if (svmName == null || igroupName == null || svmName .isEmpty () || igroupName .isEmpty ()) {
365362 s_logger .error ("getAccessGroup: get Igroup failed. Invalid svm:{} or igroup name: {}" , svmName , igroupName );
366- throw new CloudRuntimeException ("getAccessGroup : Failed to get Igroup, invalid request" );
363+ throw new CloudRuntimeException (" Failed to get Igroup, invalid request" );
367364 }
368365 try {
369366 String authHeader = Utility .generateAuthHeader (storage .getUsername (), storage .getPassword ());
@@ -396,14 +393,14 @@ public Map<String, String> enableLogicalAccess(Map<String, String> values) {
396393 Map <String , String > response = null ;
397394 if (values == null ) {
398395 s_logger .error ("enableLogicalAccess: LunMap creation failed. Invalid request values: null" );
399- throw new CloudRuntimeException ("enableLogicalAccess : Failed to create LunMap, invalid request" );
396+ throw new CloudRuntimeException (" Failed to create LunMap, invalid request" );
400397 }
401398 String svmName = values .get (Constants .SVM_DOT_NAME );
402399 String lunName = values .get (Constants .LUN_DOT_NAME );
403400 String igroupName = values .get (Constants .IGROUP_DOT_NAME );
404401 if (svmName == null || lunName == null || igroupName == null || svmName .isEmpty () || lunName .isEmpty () || igroupName .isEmpty ()) {
405402 s_logger .error ("enableLogicalAccess: LunMap creation failed. Invalid request values: {}" , values );
406- throw new CloudRuntimeException ("enableLogicalAccess : Failed to create LunMap, invalid request" );
403+ throw new CloudRuntimeException (" Failed to create LunMap, invalid request" );
407404 }
408405 try {
409406 // Get AuthHeader
@@ -463,13 +460,13 @@ public void disableLogicalAccess(Map<String, String> values) {
463460 s_logger .debug ("disableLogicalAccess : Deleting LunMap with values {} " , values );
464461 if (values == null ) {
465462 s_logger .error ("disableLogicalAccess: LunMap deletion failed. Invalid request values: null" );
466- throw new CloudRuntimeException ("disableLogicalAccess : Failed to delete LunMap, invalid request" );
463+ throw new CloudRuntimeException (" Failed to delete LunMap, invalid request" );
467464 }
468465 String lunUUID = values .get (Constants .LUN_DOT_UUID );
469466 String igroupUUID = values .get (Constants .IGROUP_DOT_UUID );
470467 if (lunUUID == null || igroupUUID == null || lunUUID .isEmpty () || igroupUUID .isEmpty ()) {
471468 s_logger .error ("disableLogicalAccess: LunMap deletion failed. Invalid request values: {}" , values );
472- throw new CloudRuntimeException ("disableLogicalAccess : Failed to delete LunMap, invalid request" );
469+ throw new CloudRuntimeException (" Failed to delete LunMap, invalid request" );
473470 }
474471 try {
475472 String authHeader = Utility .generateAuthHeader (storage .getUsername (), storage .getPassword ());
@@ -494,14 +491,14 @@ public Map<String, String> getLogicalAccess(Map<String, String> values) {
494491 s_logger .debug ("getLogicalAccess : Fetching LunMap with values {} " , values );
495492 if (values == null ) {
496493 s_logger .error ("getLogicalAccess: Invalid request values: null" );
497- throw new CloudRuntimeException ("getLogicalAccess : Invalid request" );
494+ throw new CloudRuntimeException (" Invalid request" );
498495 }
499496 String svmName = values .get (Constants .SVM_DOT_NAME );
500497 String lunName = values .get (Constants .LUN_DOT_NAME );
501498 String igroupName = values .get (Constants .IGROUP_DOT_NAME );
502499 if (svmName == null || lunName == null || igroupName == null || svmName .isEmpty () || lunName .isEmpty () || igroupName .isEmpty ()) {
503500 s_logger .error ("getLogicalAccess: Invalid request values: {}" , values );
504- throw new CloudRuntimeException ("getLogicalAccess : Invalid request" );
501+ throw new CloudRuntimeException (" Invalid request" );
505502 }
506503 try {
507504 String authHeader = Utility .generateAuthHeader (storage .getUsername (), storage .getPassword ());
@@ -553,7 +550,6 @@ public String ensureLunMapped(String svmName, String lunName, String accessGroup
553550 s_logger .info ("ensureLunMapped: Successfully mapped LUN [{}] to igroup [{}] with LUN number [{}]" , lunName , accessGroupName , response .get (Constants .LOGICAL_UNIT_NUMBER ));
554551 return response .get (Constants .LOGICAL_UNIT_NUMBER );
555552 }
556-
557553 /**
558554 * Reverts a LUN to a snapshot using the ONTAP CLI-based snapshot file restore API.
559555 *
0 commit comments