Skip to content

Commit d903823

Browse files
Gupta, SuryaGupta, Surya
authored andcommitted
CSTACKEX-16 Fix locationType and format issue
1 parent 92731ed commit d903823

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.Map;
2424
import java.util.Optional;
2525
import java.util.Random;
26+
import java.util.Set;
2627
import java.util.UUID;
2728

2829
import javax.inject.Inject;
@@ -142,7 +143,7 @@ public SnapshotInfo backupSnapshot(SnapshotInfo snapshotInfo) {
142143

143144
if (!computeClusterSupportsResign) {
144145
String msg = "Cannot archive snapshot: 'computeClusterSupportsResign' was false.";
145-
146+
logger.info("backupSnapshot: {}", msg);
146147
logger.warn(msg);
147148

148149
throw new CloudRuntimeException(msg);
@@ -276,8 +277,10 @@ private void verifySnapshotType(SnapshotInfo snapshotInfo) {
276277
private void verifyLocationType(SnapshotInfo snapshotInfo) {
277278
VolumeInfo volumeInfo = snapshotInfo.getBaseVolume();
278279

279-
if (snapshotInfo.getLocationType() == Snapshot.LocationType.SECONDARY && volumeInfo.getFormat() != ImageFormat.VHD) {
280-
throw new CloudRuntimeException("Only the '" + ImageFormat.VHD + "' image type can be used when 'LocationType' is set to 'SECONDARY'.");
280+
Set<ImageFormat> supportedFormats = Set.of(ImageFormat.VHD, ImageFormat.QCOW2, ImageFormat.RAW);
281+
282+
if (snapshotInfo.getLocationType() == Snapshot.LocationType.SECONDARY && !supportedFormats.contains(volumeInfo.getFormat())) {
283+
throw new CloudRuntimeException("Only the '" + supportedFormats + "' image types can be used when 'LocationType' is set to 'SECONDARY'.");
281284
}
282285
}
283286

0 commit comments

Comments
 (0)