Skip to content

Conversation

@piyush5netapp
Copy link

Description

This PR...

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?


public abstract String createExportPolicy(String svmName, String policyName);
public abstract boolean deleteExportPolicy(String svmName, String policyName);
public abstract boolean exportPolicyExists(String svmName, String policyName);
Copy link
Author

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);
Copy link
Author

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);
Copy link
Author

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);
Copy link
Author

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)
Copy link
Author

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);
Copy link
Author

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;
Copy link
Author

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");
}
Copy link
Author

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");

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);

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

@github-actions
Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

Copilot AI review requested due to automatic review settings November 4, 2025 04:47
@piyush5netapp piyush5netapp changed the title Export Policy and File operation changes NAS support Export Policy and File operation changes NAS Storage pool creation Nov 4, 2025
Copy link

Copilot AI left a 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.

Comment on lines +162 to +163
"10.196.38.171", extractedDetails.get(Constants.SVM_NAME), ProtocolType.NFS,
Boolean.parseBoolean(extractedDetails.get(Constants.IS_DISAGGREGATED))); // TODO hardcoded for testing
Copy link

Copilot AI Nov 4, 2025

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.

Suggested change
"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)));

Copilot uses AI. Check for mistakes.
parameters.setName(storagePoolName);
parameters.setProviderName(providerName);
parameters.setManaged(true);
parameters.setHost("10.196.38.171");
Copy link

Copilot AI Nov 4, 2025

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.

Copilot uses AI. Check for mistakes.
// .logger(feignConfiguration.createLogger())
.retryer(feignConfiguration.createRetryer())
.requestInterceptor(feignConfiguration.createRequestInterceptor())
.target(clientClass, "https://10.196.38.171/");
Copy link

Copilot AI Nov 4, 2025

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.

Copilot uses AI. Check for mistakes.
URI updateVolumeUrl = URI.create(Constants.HTTPS + storage.getManagementLIF() +
"/api/storage/volumes/" + volumeUuid);

//volumeFeignClient.updateVolumeRebalancing(updateVolumeUrl, authHeader, volumeUuid, volumeUpdate);
Copy link

Copilot AI Nov 4, 2025

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.

Suggested change
//volumeFeignClient.updateVolumeRebalancing(updateVolumeUrl, authHeader, volumeUuid, volumeUpdate);
volumeFeignClient.updateVolumeRebalancing(updateVolumeUrl, authHeader, volumeUuid, volumeUpdate);

Copilot uses AI. Check for mistakes.
Comment on lines +69 to +70
s_logger.info(" storage object is {} ", storage.getPassword());
s_logger.info(" storage object is {} ", storage.getUsername());
Copy link

Copilot AI Nov 4, 2025

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
utils = ComponentContext.inject(Utility.class);
// Initialize FeignClientFactory and create NAS client
feignClientFactory = new FeignClientFactory();
sanFeignClient = feignClientFactory.createClient(SANFeignClient.class);// TODO needs to be changed
Copy link

Copilot AI Nov 4, 2025

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.

Copilot uses AI. Check for mistakes.
public class UnifiedNASStrategy extends NASStrategy{

private Utility utils;
// // Add missing Feign client setup for NAS operations
Copy link

Copilot AI Nov 4, 2025

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.

Suggested change
// // Add missing Feign client setup for NAS operations

Copilot uses AI. Check for mistakes.
// .logger(feignConfiguration.createLogger())
.retryer(feignConfiguration.createRetryer())
.requestInterceptor(feignConfiguration.createRequestInterceptor())
.target(clientClass, "https://10.196.38.171/");

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 /")

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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no hard code values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants