Skip to content

Commit c70dee1

Browse files
Kukuninclaude
andcommitted
Let CloudRuntimeException propagate from copySnapshotToVolume
Remove try/catch in copySnapshotToVolume so that CloudRuntimeException from createResourceFromSnapshot propagates to the caller, ensuring CloudStack properly notices and reports the failure. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f89df71 commit c70dee1

1 file changed

Lines changed: 9 additions & 18 deletions

File tree

plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -778,24 +778,15 @@ public boolean canCopy(DataObject srcData, DataObject dstData)
778778
}
779779

780780
private CopyCommandResult copySnapshotToVolume(SnapshotInfo snapshotInfo, VolumeInfo volumeInfo) {
781-
String errMsg = null;
782-
CopyCmdAnswer answer = null;
783-
try {
784-
StoragePoolVO storagePoolVO = _storagePoolDao.findById(snapshotInfo.getDataStore().getId());
785-
String rscName = LinstorUtil.RSC_PREFIX + volumeInfo.getUuid();
786-
createResourceFromSnapshot(snapshotInfo.getId(), rscName, storagePoolVO);
787-
788-
VolumeObjectTO volumeTO = (VolumeObjectTO) volumeInfo.getTO();
789-
volumeTO.setPath(volumeInfo.getUuid());
790-
volumeTO.setSize(volumeInfo.getSize());
791-
answer = new CopyCmdAnswer(volumeTO);
792-
} catch (Exception e) {
793-
errMsg = "Failed to create volume from snapshot: " + e.getMessage();
794-
logger.error(errMsg, e);
795-
}
796-
CopyCommandResult result = new CopyCommandResult(null, answer);
797-
result.setResult(errMsg);
798-
return result;
781+
StoragePoolVO storagePoolVO = _storagePoolDao.findById(snapshotInfo.getDataStore().getId());
782+
String rscName = LinstorUtil.RSC_PREFIX + volumeInfo.getUuid();
783+
createResourceFromSnapshot(snapshotInfo.getId(), rscName, storagePoolVO);
784+
785+
VolumeObjectTO volumeTO = (VolumeObjectTO) volumeInfo.getTO();
786+
volumeTO.setPath(volumeInfo.getUuid());
787+
volumeTO.setSize(volumeInfo.getSize());
788+
789+
return new CopyCommandResult(null, new CopyCmdAnswer(volumeTO));
799790
}
800791

801792
@Override

0 commit comments

Comments
 (0)