Skip to content

Commit 3065e5c

Browse files
Gupta, SuryaGupta, Surya
authored andcommitted
CSTACKEX-16 Fix Copy Issues in KVM for managed storage
1 parent d3b071f commit 3065e5c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/driver/OntapPrimaryDatastoreDriver.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ private void createTempVolume(SnapshotInfo snapshotInfo, long storagePoolId) {
234234
s_logger.info("createTempVolume: 'delete' signal — cleaning up cloned LUN and snapshot details for snapshot [{}]",
235235
snapshotInfo.getSnapshotId());
236236

237-
deleteSnapshotClone(snapshotInfo, snapshotInfo.getDataStore());
237+
//deleteSnapshotClone(snapshotInfo, snapshotInfo.getDataStore());
238238

239239
// Remove ONTAP-specific details that were stored during takeSnapshot()
240240
removeSnapshotDetailIfPresent(snapshotInfo.getSnapshotId(), Constants.SRC_CS_VOLUME_ID);
@@ -629,12 +629,13 @@ private void deleteSnapshotClone(SnapshotInfo snapshotInfo, DataStore store) {
629629
Map<String, String> details = storagePoolDetailsDao.listDetailsKeyPairs(store.getId());
630630
StorageStrategy storageStrategy = Utility.getStrategyByStoragePoolDetails(details);
631631

632-
// Get the cloned LUN name from snapshotInfo.getPath() (set during takeSnapshot)
633-
String snapshotLunName = snapshotInfo.getPath();
634-
if (snapshotLunName == null) {
635-
s_logger.warn("deleteSnapshotClone: Snapshot path is null for snapshot id: {}, nothing to delete", snapshotInfo.getId());
632+
// Build the ONTAP LUN name using the snapshot name (consistent with grantAccessForSnapshot/revokeAccessForSnapshot)
633+
// Do NOT use snapshotInfo.getPath() — that holds the iSCSI path (/<IQN>/<LUN>), not the ONTAP LUN name.
634+
if (snapshotInfo.getName() == null || snapshotInfo.getName().isEmpty()) {
635+
s_logger.warn("deleteSnapshotClone: Snapshot name is null/empty for snapshot id: {}, nothing to delete", snapshotInfo.getId());
636636
return;
637637
}
638+
String snapshotLunName = Constants.VOL + storagePool.getName() + Constants.SLASH + snapshotInfo.getName();
638639

639640
// Get the cloned LUN UUID from snapshot_details
640641
SnapshotDetailsVO snapDetail = snapshotDetailsDao.findDetail(snapshotInfo.getSnapshotId(), Constants.ONTAP_SNAP_ID);

0 commit comments

Comments
 (0)