-
Notifications
You must be signed in to change notification settings - Fork 0
Export Policy and File operation changes NAS Storage pool creation #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| public abstract String createExportPolicy(String svmName, String policyName); | ||
| public abstract boolean deleteExportPolicy(String svmName, String policyName); | ||
| public abstract boolean exportPolicyExists(String svmName, String policyName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can have getExportPolicy method
| } | ||
|
|
||
| public abstract String createExportPolicy(String svmName, String policyName); | ||
| public abstract boolean deleteExportPolicy(String svmName, String policyName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it void to pass back the exact error incase of failure
| super(ontapStorage); | ||
| } | ||
|
|
||
| public abstract String createExportPolicy(String svmName, String policyName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return the policy object
| public abstract boolean exportPolicyExists(String svmName, String policyName); | ||
| public abstract String addExportRule(String policyName, String clientMatch, String[] protocols, String[] roRule, String[] rwRule); | ||
| public abstract String assignExportPolicyToVolume(String volumeUuid, String policyName); | ||
| public abstract String enableNFS(String svmUuid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this method, SVM should be pre-configured with NFS enabled.
| @RequestMapping(method = RequestMethod.GET, value = "/{uuid}") | ||
| Svm getSvmByUUID(URI baseURL, @RequestHeader("Authorization") String header); | ||
|
|
||
| @RequestMapping(method = RequestMethod.PATCH) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this as not required now.
| */ | ||
| @Override | ||
| public DataStore initialize(Map<String, Object> dsInfos) { | ||
| s_logger.info("initialize {}", dsInfos); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it debug and make it meaningful.
| } else { | ||
| throw new CloudRuntimeException("ONTAP details validation failed, cannot create primary storage"); | ||
| } | ||
| String storagePath = url + ":/" + storagePoolName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the comment for assuming it is for NFS and URL value.
| s_logger.info("initialize {}", dsInfos); | ||
| if (dsInfos == null) { | ||
| throw new CloudRuntimeException("Datastore info map is null, cannot create primary storage"); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the sample URL on which below code has been written.
| exportPolicy.setSvm(svm); | ||
|
|
||
| // Create URI for export policy creation | ||
| URI url = URI.create(Constants.HTTPS + storage.getManagementLIF() + "/api/protocols/nfs/export-policies"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass this URL to constant
|
|
||
| // Get policy ID first | ||
| URI getUrl = URI.create(Constants.HTTPS + storage.getManagementLIF() + | ||
| "/api/protocols/nfs/export-policies?name=" + policyName + "&svm.name=" + svmName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, put these in reusable constants
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements comprehensive NAS support for the ONTAP storage plugin by adding export policy management and file operations. The changes migrate from Spring-based Feign clients to native Feign configuration and enhance the storage strategy pattern with complete NAS functionality.
- Removes Spring Framework dependencies and migrates to native Feign client configuration
- Implements complete NAS strategy with export policy management and file operations
- Refactors storage classes to use immutable fields and proper dependency injection
Reviewed Changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| Utility.java | Removes Spring components and unused URI generation method |
| Constants.java | Enhances ProtocolType enum with string values |
| UnifiedNASStrategy.java | Implements comprehensive NAS operations including export policies and file management |
| UnifiedSANStrategy.java | Adds default constructor and dependency initialization |
| StorageStrategy.java | Refactors to use FeignClientFactory instead of Spring injection |
| NASStrategy.java | Updates abstract methods for export policy operations |
| SANStrategy.java | Adds default constructor support |
| StorageProviderFactory.java | Removes Spring annotations and refactors strategy creation |
| OntapPrimaryDatastoreProvider.java | Updates logging imports and adds host listener |
| OntapHostListener.java | Implements HypervisorHostListener interface |
| OntapPrimaryDatastoreLifecycle.java | Adds URL parsing and hardcoded configuration for testing |
| Volume.java | Adds JSON ignore properties annotation |
| OntapStorage.java | Converts to immutable class with final fields |
| Job.java | Fixes property mappings and variable naming |
| Multiple Feign clients | Migrates from Spring to native Feign annotations |
| FeignConfiguration.java | Replaces Spring configuration with native Feign setup |
| FeignClientFactory.java | New factory class for creating Feign clients |
| OntapPrimaryDatastoreDriver.java | Updates logging import |
| pom.xml | Adds feign-jackson dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "10.196.38.171", extractedDetails.get(Constants.SVM_NAME), ProtocolType.NFS, | ||
| Boolean.parseBoolean(extractedDetails.get(Constants.IS_DISAGGREGATED))); // TODO hardcoded for testing |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded IP address should not be committed to production code. Consider using configuration or extractedDetails instead.
| "10.196.38.171", extractedDetails.get(Constants.SVM_NAME), ProtocolType.NFS, | |
| Boolean.parseBoolean(extractedDetails.get(Constants.IS_DISAGGREGATED))); // TODO hardcoded for testing | |
| mLIF, extractedDetails.get(Constants.SVM_NAME), ProtocolType.NFS, | |
| Boolean.parseBoolean(extractedDetails.get(Constants.IS_DISAGGREGATED))); |
| parameters.setName(storagePoolName); | ||
| parameters.setProviderName(providerName); | ||
| parameters.setManaged(true); | ||
| parameters.setHost("10.196.38.171"); |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another hardcoded IP address that should be replaced with proper configuration or variable.
| // .logger(feignConfiguration.createLogger()) | ||
| .retryer(feignConfiguration.createRetryer()) | ||
| .requestInterceptor(feignConfiguration.createRequestInterceptor()) | ||
| .target(clientClass, "https://10.196.38.171/"); |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded base URL in FeignClientFactory should be configurable to support different environments.
| URI updateVolumeUrl = URI.create(Constants.HTTPS + storage.getManagementLIF() + | ||
| "/api/storage/volumes/" + volumeUuid); | ||
|
|
||
| //volumeFeignClient.updateVolumeRebalancing(updateVolumeUrl, authHeader, volumeUuid, volumeUpdate); |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented out code should be removed or properly implemented before production deployment.
| //volumeFeignClient.updateVolumeRebalancing(updateVolumeUrl, authHeader, volumeUuid, volumeUpdate); | |
| volumeFeignClient.updateVolumeRebalancing(updateVolumeUrl, authHeader, volumeUuid, volumeUpdate); |
| s_logger.info(" storage object is {} ", storage.getPassword()); | ||
| s_logger.info(" storage object is {} ", storage.getUsername()); |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging sensitive information like passwords should be avoided as it can expose credentials in log files.
| s_logger.info(" storage object is {} ", storage.getPassword()); | |
| s_logger.info(" storage object is {} ", storage.getUsername()); | |
| // Do not log sensitive information such as password or username |
| utils = ComponentContext.inject(Utility.class); | ||
| // Initialize FeignClientFactory and create NAS client | ||
| feignClientFactory = new FeignClientFactory(); | ||
| sanFeignClient = feignClientFactory.createClient(SANFeignClient.class);// TODO needs to be changed |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO comment indicates incomplete implementation that should be addressed before production.
| public class UnifiedNASStrategy extends NASStrategy{ | ||
|
|
||
| private Utility utils; | ||
| // // Add missing Feign client setup for NAS operations |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented out code should be removed to improve code clarity.
| // // Add missing Feign client setup for NAS operations |
| // .logger(feignConfiguration.createLogger()) | ||
| .retryer(feignConfiguration.createRetryer()) | ||
| .requestInterceptor(feignConfiguration.createRequestInterceptor()) | ||
| .target(clientClass, "https://10.196.38.171/"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets not merge such changes, you can do this for internal testing.
|
|
||
| @RequestMapping(method=RequestMethod.GET, value="/{uuid}") | ||
| Aggregate getAggregateByUUID(URI baseURL,@RequestHeader("Authorization") String header, @PathVariable(name = "uuid", required = true) String uuid); | ||
| @RequestLine("GET /") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add url
| details.put(Constants.IS_DISAGGREGATED, "false"); | ||
|
|
||
| OntapStorage ontapStorage = new OntapStorage(extractedDetails.get(Constants.USERNAME), extractedDetails.get(Constants.PASSWORD), | ||
| "10.196.38.171", extractedDetails.get(Constants.SVM_NAME), ProtocolType.NFS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no hard code values
Description
This PR...
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?