Skip to content

Commit 1daa6df

Browse files
Gupta, SuryaGupta, Surya
authored andcommitted
CSTACKEX-16 Fix Copy Issues
1 parent b7454d1 commit 1daa6df

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,7 @@ else if (HypervisorType.VMware.equals(snapshotInfo.getHypervisorType()) || Hyper
11441144
if (HypervisorType.KVM.equals(snapshotInfo.getHypervisorType()) && storagePoolVO.getPoolType() == StoragePoolType.PowerFlex) {
11451145
usingBackendSnapshot = false;
11461146
}
1147+
logger.info("handleCopyAsyncToSecondaryStorage: usingBackendSnapshot {}", usingBackendSnapshot);
11471148

11481149
if (usingBackendSnapshot) {
11491150
createVolumeFromSnapshot(snapshotInfo);
@@ -1181,7 +1182,7 @@ else if (HypervisorType.VMware.equals(snapshotInfo.getHypervisorType()) || Hyper
11811182
int primaryStorageDownloadWait = StorageManager.PRIMARY_STORAGE_DOWNLOAD_WAIT.value();
11821183
CopyCommand copyCommand = new CopyCommand(snapshotInfo.getTO(), destOnStore.getTO(), primaryStorageDownloadWait,
11831184
VirtualMachineManager.ExecuteInSequence.value());
1184-
1185+
logger.info("handleCopyAsyncToSecondaryStorage: keepGrantedAccess {}", keepGrantedAccess);
11851186
try {
11861187
if (!keepGrantedAccess) {
11871188
_volumeService.grantAccess(snapshotInfo, hostVO, srcDataStore);
@@ -1205,7 +1206,7 @@ else if (HypervisorType.VMware.equals(snapshotInfo.getHypervisorType()) || Hyper
12051206
copyCommand.setOptions(srcDetails);
12061207

12071208
copyCmdAnswer = (CopyCmdAnswer)agentManager.send(hostVO.getId(), copyCommand);
1208-
1209+
logger.info("handleCopyAsyncToSecondaryStorage: copyCmdAnswer {}", copyCmdAnswer.getResult());
12091210
if (!copyCmdAnswer.getResult()) {
12101211
errMsg = copyCmdAnswer.getDetails();
12111212

engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,6 @@ else if (volumeInfo.getFormat() == ImageFormat.OVA || volumeInfo.getFormat() ==
515515
}
516516

517517
snapshotOnPrimary = result.getSnapshot();
518-
snapshotOnPrimary.addPayload(snapshotInfo.getPayload());
519518
}
520519
finally {
521520
if (result != null && result.isSuccess()) {

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,11 +555,13 @@ private void grantAccessForSnapshot(SnapshotInfo snapshotInfo, Host host, Storag
555555

556556
// Store DiskTO.IQN in snapshot_details so StorageSystemDataMotionStrategy.getSnapshotDetails()
557557
// can build the iSCSI source details for the CopyCommand sent to the KVM agent
558-
String iqnPath = storagePool.getPath() + Constants.SLASH + lunNumber;
559-
snapshotDetailsDao.addDetail(snapshotInfo.getId(), DiskTO.IQN, iqnPath, false);
558+
559+
// Update volume path if changed (e.g., after migration or re-mapping)
560+
String iscsiPath = Constants.SLASH + storagePool.getPath() + Constants.SLASH + lunNumber;
561+
snapshotDetailsDao.addDetail(snapshotInfo.getId(), DiskTO.IQN, iscsiPath, false);
560562

561563
s_logger.info("grantAccessForSnapshot: Snapshot LUN [{}] mapped as LUN number [{}], IQN path [{}]",
562-
snapshotLunName, lunNumber, iqnPath);
564+
snapshotLunName, lunNumber, iscsiPath);
563565
}
564566
}
565567

server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3880,11 +3880,8 @@ private Snapshot takeSnapshotInternal(Long volumeId, Long policyId, Long snapsho
38803880

38813881
if (storagePoolVO.isManaged() && locationType == null) {
38823882
logger.info("takeSnapshotInternal: locationType : {}", locationType);
3883-
if (isFileBasedStoragePool(storagePoolVO)) {
3884-
locationType = Snapshot.LocationType.PRIMARY;
3885-
} else {
3886-
// For managed, non-file-based storage (e.g., iSCSI), default to SECONDARY
3887-
// so that the snapshot gets copied to secondary storage via the backup pipeline.
3883+
locationType = Snapshot.LocationType.PRIMARY;
3884+
if (!isFileBasedStoragePool(storagePoolVO)) {
38883885
locationType = Snapshot.LocationType.SECONDARY;
38893886
}
38903887
logger.info("takeSnapshotInternal: locationType after : {}", locationType);

0 commit comments

Comments
 (0)