|
66 | 66 | public class UnifiedNASStrategy extends NASStrategy { |
67 | 67 |
|
68 | 68 | private static final Logger s_logger = LogManager.getLogger(UnifiedNASStrategy.class); |
69 | | - private final FeignClientFactory feignClientFactory; |
70 | | - private final NASFeignClient nasFeignClient; |
71 | | - private final VolumeFeignClient volumeFeignClient; |
72 | | - private final JobFeignClient jobFeignClient; |
73 | 69 | @Inject private VolumeDao volumeDao; |
74 | 70 | @Inject private EndPointSelector epSelector; |
75 | 71 | @Inject private StoragePoolDetailsDao storagePoolDetailsDao; |
76 | 72 |
|
77 | 73 | public UnifiedNASStrategy(OntapStorage ontapStorage) { |
78 | 74 | super(ontapStorage); |
79 | | - String baseURL = Constants.HTTPS + ontapStorage.getStorageIP(); |
80 | | - this.feignClientFactory = new FeignClientFactory(); |
81 | | - this.nasFeignClient = feignClientFactory.createClient(NASFeignClient.class, baseURL); |
82 | | - this.volumeFeignClient = feignClientFactory.createClient(VolumeFeignClient.class, baseURL); |
83 | | - this.jobFeignClient = feignClientFactory.createClient(JobFeignClient.class, baseURL ); |
84 | 75 | } |
85 | 76 |
|
86 | 77 | public void setOntapStorage(OntapStorage ontapStorage) { |
@@ -152,59 +143,6 @@ public CloudStackVolume getCloudStackVolume(Map<String, String> cloudStackVolume |
152 | 143 | return cloudStackVolume; |
153 | 144 | } |
154 | 145 |
|
155 | | - @Override |
156 | | - public CloudStackVolume snapshotCloudStackVolume(CloudStackVolume cloudstackVolumeArg) { |
157 | | - s_logger.info("snapshotCloudStackVolume: Get cloudstack volume " + cloudstackVolumeArg); |
158 | | - CloudStackVolume cloudStackVolume = null; |
159 | | - String authHeader = Utility.generateAuthHeader(storage.getUsername(), storage.getPassword()); |
160 | | - JobResponse jobResponse = null; |
161 | | - |
162 | | - FileClone fileClone = new FileClone(); |
163 | | - VolumeConcise volumeConcise = new VolumeConcise(); |
164 | | - volumeConcise.setUuid(cloudstackVolumeArg.getFlexVolumeUuid()); |
165 | | - fileClone.setVolume(volumeConcise); |
166 | | - |
167 | | - fileClone.setSourcePath(cloudstackVolumeArg.getFile().getPath()); |
168 | | - fileClone.setDestinationPath(cloudstackVolumeArg.getDestinationPath()); |
169 | | - |
170 | | - try { |
171 | | - /** Clone file call to storage */ |
172 | | - jobResponse = nasFeignClient.cloneFile(authHeader, fileClone); |
173 | | - if (jobResponse == null || jobResponse.getJob() == null) { |
174 | | - throw new CloudRuntimeException("Failed to initiate file clone" + cloudstackVolumeArg.getFile().getPath()); |
175 | | - } |
176 | | - String jobUUID = jobResponse.getJob().getUuid(); |
177 | | - |
178 | | - /** Create URI for GET Job API */ |
179 | | - Boolean jobSucceeded = jobPollForSuccess(jobUUID,3,2); |
180 | | - if (!jobSucceeded) { |
181 | | - s_logger.error("snapshotCloudStackVolume: File clone failed: " + cloudstackVolumeArg.getFile().getPath()); |
182 | | - throw new CloudRuntimeException("File clone failed: " + cloudstackVolumeArg.getFile().getPath()); |
183 | | - } |
184 | | - s_logger.info("snapshotCloudStackVolume: File clone job completed successfully for file: " + cloudstackVolumeArg.getFile().getPath()); |
185 | | - |
186 | | - } catch (FeignException e) { |
187 | | - s_logger.error("snapshotCloudStackVolume: Failed to clone file response: " + cloudstackVolumeArg.getFile().getPath(), e); |
188 | | - throw new CloudRuntimeException("File not found: " + e.getMessage()); |
189 | | - } catch (Exception e) { |
190 | | - s_logger.error("snapshotCloudStackVolume: Exception to get file: {}", cloudstackVolumeArg.getFile().getPath(), e); |
191 | | - throw new CloudRuntimeException("Failed to get the file: " + e.getMessage()); |
192 | | - } |
193 | | - |
194 | | - FileInfo clonedFileInfo = null; |
195 | | - try { |
196 | | - /** Get cloned file call from storage */ |
197 | | - clonedFileInfo = getFile(cloudstackVolumeArg.getFlexVolumeUuid(), cloudstackVolumeArg.getDestinationPath()); |
198 | | - } catch (Exception e) { |
199 | | - s_logger.error("snapshotCloudStackVolume: Exception to get cloned file: {}", cloudstackVolumeArg.getDestinationPath(), e); |
200 | | - throw new CloudRuntimeException("Failed to get the cloned file: " + e.getMessage()); |
201 | | - } |
202 | | - cloudStackVolume = new CloudStackVolume(); |
203 | | - cloudStackVolume.setFlexVolumeUuid(cloudstackVolumeArg.getFlexVolumeUuid()); |
204 | | - cloudStackVolume.setFile(clonedFileInfo); |
205 | | - return cloudStackVolume; |
206 | | - } |
207 | | - |
208 | 146 | @Override |
209 | 147 | public AccessGroup createAccessGroup(AccessGroup accessGroup) { |
210 | 148 | s_logger.info("createAccessGroup: Create access group {}: " , accessGroup); |
@@ -237,13 +175,13 @@ public void deleteAccessGroup(AccessGroup accessGroup) { |
237 | 175 | s_logger.info("deleteAccessGroup: Deleting export policy"); |
238 | 176 |
|
239 | 177 | if (accessGroup == null) { |
240 | | - throw new CloudRuntimeException("deleteAccessGroup: Invalid accessGroup object - accessGroup is null"); |
| 178 | + throw new CloudRuntimeException("Invalid accessGroup object - accessGroup is null"); |
241 | 179 | } |
242 | 180 |
|
243 | 181 | // Get PrimaryDataStoreInfo from accessGroup |
244 | 182 | PrimaryDataStoreInfo primaryDataStoreInfo = accessGroup.getPrimaryDataStoreInfo(); |
245 | 183 | if (primaryDataStoreInfo == null) { |
246 | | - throw new CloudRuntimeException("deleteAccessGroup: PrimaryDataStoreInfo is null in accessGroup"); |
| 184 | + throw new CloudRuntimeException("PrimaryDataStoreInfo is null in accessGroup"); |
247 | 185 | } |
248 | 186 | s_logger.info("deleteAccessGroup: Deleting export policy for the storage pool {}", primaryDataStoreInfo.getName()); |
249 | 187 | try { |
@@ -274,48 +212,9 @@ public AccessGroup updateAccessGroup(AccessGroup accessGroup) { |
274 | 212 |
|
275 | 213 | @Override |
276 | 214 | public AccessGroup getAccessGroup(Map<String, String> values) { |
277 | | - return null; //TODO: This method need to be rewritten according to the signature in StorageStrategy interface |
| 215 | + return null; |
278 | 216 | } |
279 | 217 |
|
280 | | -// @Override |
281 | | -// public AccessGroup getAccessGroup(AccessGroup accessGroup) { |
282 | | -// s_logger.info("getAccessGroup: Get export policy"); |
283 | | -// |
284 | | -// if (accessGroup == null) { |
285 | | -// throw new CloudRuntimeException("getAccessGroup: Invalid accessGroup object - accessGroup is null"); |
286 | | -// } |
287 | | -// |
288 | | -// // Get PrimaryDataStoreInfo from accessGroup |
289 | | -// PrimaryDataStoreInfo primaryDataStoreInfo = accessGroup.getPrimaryDataStoreInfo(); |
290 | | -// if (primaryDataStoreInfo == null) { |
291 | | -// throw new CloudRuntimeException("getAccessGroup: PrimaryDataStoreInfo is null in accessGroup"); |
292 | | -// } |
293 | | -// s_logger.info("getAccessGroup: Get export policy for the storage pool {}", primaryDataStoreInfo.getName()); |
294 | | -// try { |
295 | | -// String authHeader = Utility.generateAuthHeader(storage.getUsername(), storage.getPassword()); |
296 | | -// // Determine export policy attached to the storage pool |
297 | | -// String exportPolicyName = primaryDataStoreInfo.getDetails().get(Constants.EXPORT_POLICY_NAME); |
298 | | -// String exportPolicyId = primaryDataStoreInfo.getDetails().get(Constants.EXPORT_POLICY_ID); |
299 | | -// |
300 | | -// try { |
301 | | -// ExportPolicy exportPolicy = nasFeignClient.getExportPolicyById(authHeader,exportPolicyId); |
302 | | -// if(exportPolicy==null){ |
303 | | -// s_logger.error("getAccessGroup: Failed to retrieve export policy for export policy"); |
304 | | -// throw new CloudRuntimeException("getAccessGroup: Failed to retrieve export policy for export policy"); |
305 | | -// } |
306 | | -// accessGroup.setPolicy(exportPolicy); |
307 | | -// s_logger.info("getAccessGroup: Successfully fetched export policy '{}'", exportPolicyName); |
308 | | -// } catch (Exception e) { |
309 | | -// s_logger.error("getAccessGroup: Failed to delete export policy. Exception: {}", e.getMessage(), e); |
310 | | -// throw new CloudRuntimeException("Failed to delete export policy: " + e.getMessage(), e); |
311 | | -// } |
312 | | -// } catch (Exception e) { |
313 | | -// s_logger.error("getAccessGroup: Failed to delete export policy. Exception: {}", e.getMessage(), e); |
314 | | -// throw new CloudRuntimeException("Failed to delete export policy: " + e.getMessage(), e); |
315 | | -// } |
316 | | -// return accessGroup; |
317 | | -// } |
318 | | - |
319 | 218 | @Override |
320 | 219 | public Map<String, String> enableLogicalAccess(Map<String, String> values) { |
321 | 220 | //TODO |
@@ -664,13 +563,13 @@ public JobResponse revertSnapshotForCloudStackVolume(String snapshotName, String |
664 | 563 | volumePath, snapshotName, flexVolName); |
665 | 564 |
|
666 | 565 | if (snapshotName == null || snapshotName.isEmpty()) { |
667 | | - throw new CloudRuntimeException("revertSnapshotForCloudStackVolume: Snapshot name is required for NFS snapshot revert"); |
| 566 | + throw new CloudRuntimeException("Snapshot name is required for NFS snapshot revert"); |
668 | 567 | } |
669 | 568 | if (volumePath == null || volumePath.isEmpty()) { |
670 | | - throw new CloudRuntimeException("revertSnapshotForCloudStackVolume: File path is required for NFS snapshot revert"); |
| 569 | + throw new CloudRuntimeException("File path is required for NFS snapshot revert"); |
671 | 570 | } |
672 | 571 | if (flexVolName == null || flexVolName.isEmpty()) { |
673 | | - throw new CloudRuntimeException("revertSnapshotForCloudStackVolume: FlexVolume name is required for NFS snapshot revert"); |
| 572 | + throw new CloudRuntimeException("FlexVolume name is required for NFS snapshot revert"); |
674 | 573 | } |
675 | 574 |
|
676 | 575 | String authHeader = getAuthHeader(); |
|
0 commit comments