Skip to content

create temp CG for consistent VM snapshot for the VM which is span across multiple flexvolumes#74

Open
rajiv-jain-netapp wants to merge 8 commits into
mainfrom
feature/CSTACKEX-200
Open

create temp CG for consistent VM snapshot for the VM which is span across multiple flexvolumes#74
rajiv-jain-netapp wants to merge 8 commits into
mainfrom
feature/CSTACKEX-200

Conversation

@rajiv-jain-netapp

@rajiv-jain-netapp rajiv-jain-netapp commented Jul 2, 2026

Copy link
Copy Markdown

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?

@rajiv-jain-netapp

Copy link
Copy Markdown
Author

testing results and all the executed test cases added under previous PR #67

@sandeeplocharla sandeeplocharla left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Partially reviewed. Still need to go through a good portion of OntapVMSnapshotStrategy.java and SnapshotManagerImpl.java

return isSnapshotNotFoundError(error.getCause());
}

private long resolveSnapshotPoolId(String poolIdStr, long snapshotId) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All the exceptions in this method look dubious. Please modify them according to the conditional check.


VolumeVO volumeVO = volumeDao.findById(volumeInfo.getId());
if (volumeVO == null) {
throw new CloudRuntimeException("VolumeVO not found for id: " + volumeInfo.getId());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We can rephrase this as "'volume object'/'volume' not found for id: in the database".
This might be more user friendly.

if (lunUUID == null) {
throw new CloudRuntimeException("LUN UUID not found for iSCSI volume " + volumeVO.getId());
}
lunUuid = lunUUID;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why can't we use this in ln 721 directly, instead of creating a new variable lunUUID?

logger.error("NFS protocol is not enabled on SVM " + svmName);
throw new CloudRuntimeException("NFS protocol is not enabled on SVM " + svmName);
} else if (Objects.equals(storage.getProtocol(), ProtocolType.ISCSI) && !svm.getIscsiEnabled()) {
} else if (Objects.equals(storage.getProtocol(), ProtocolType.ISCSI) && !svm.getIscsiEnabled()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please correct the spacing.

/**
* Polls an ONTAP async job when present and returns the completed job (for extracting created resource UUIDs).
*/
public Job pollJobIfPresentAndGetCompletedJob(JobResponse response, String operationName) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Couldn't find any instance of this being used. Is this needed somewhere?

JobResponse jobResponse = snapshotFeignClient.deleteSnapshot(getAuthHeader(), flexVolUuid, snapshotUuid);

if (jobResponse == null || jobResponse.getJob() == null) {
logger.debug("deleteFlexVolSnapshotForCloudStackVolume: no async job returned for snapshot [{}] "

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also, shouldn't we be treating jobResponse 'null' as HTTP failure?

/**
* Builds an ONTAP-safe name token from user-provided snapshot text.
*/
public static String getOntapCloneName(String cloudStackSnapshotName) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Aren't we doing SFSR? Shouldn't we rename 'getOntapCloneName' method appropriately?

String cgSnapshotUuid = null;
long cgFlowStart = System.nanoTime();

// All volumes in a VM snapshot belong to ONTAP-managed pools and share the same ONTAP credentials.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

// All volumes in a VM snapshot belong to ONTAP-managed pools and share the same ONTAP credentials.
If we are assuming this, we need to set this as a pre-requisite to the user. Else, the user might create storagePools from different ONTAPs with different creds.

if (flexVolGroups.size() > 1) {
logger.info("takeVMSnapshot: VM [{}] spans {} FlexVol(s); using temporary CG two-phase snapshot flow",
userVm.getInstanceName(), flexVolGroups.size());
createVmSnapshotsViaTemporaryCg(vmSnapshot, userVm, flexVolGroups, snapshotNameBase, createdSnapshots);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

My understanding from our initial discussion on this approach was that 1CG can be mapped to 1 FV. If this is the case, then why can't we always use createVmSnapshotsViaTemporaryCg? Instead of having createVmSnapshotsViaSingleFlexVol separately for 1FV usecase?

flexVolUuid, snapshotUuid, snapshotNameBase, volumePath, groupInfo.poolId, protocol));
}

logger.info("takeVMSnapshot: [FlexVol] Snapshot [{}] (uuid={}) on FlexVol [{}] completed in {} ms. Covers volumes: {}",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This could be 'debug' log.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants