syed commented on a change in pull request #2585: Add ability to archive
snapshots on primary storage
URL: https://github.com/apache/cloudstack/pull/2585#discussion_r188849336
##########
File path:
server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java
##########
@@ -381,6 +381,24 @@ public Snapshot createSnapshot(Long volumeId, Long
policyId, Long snapshotId, Ac
return snapshot;
}
+ @Override
+ public Snapshot archiveSnapshot(Long snapshotId) {
+ SnapshotInfo snapshotOnPrimary =
snapshotFactory.getSnapshot(snapshotId, DataStoreRole.Primary);
+
+ if (snapshotOnPrimary == null ||
!snapshotOnPrimary.getStatus().equals(ObjectInDataStoreStateMachine.State.Ready))
{
+ throw new CloudRuntimeException("Can only archive snapshots
present on primary storage. " +
+ "Cannot find snapshot " + snapshotId + " on primary
storage");
+ }
+
+ SnapshotInfo snapshotOnSecondary =
snapshotSrv.backupSnapshot(snapshotOnPrimary);
+ snapshotSrv.deleteSnapshot(snapshotOnPrimary);
Review comment:
@nitin-maharana That's a good point. I'll catch that here
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services