mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Update error message when no snapshot strategy is found while creating snapshot (#11455)
This commit is contained in:
parent
5a90da3276
commit
f2d635683b
@ -2795,6 +2795,8 @@ public class VolumeServiceImpl implements VolumeService {
|
||||
} catch (CloudRuntimeException cre) {
|
||||
logger.error("Take snapshot: {} failed", volume, cre);
|
||||
throw cre;
|
||||
} catch (UnsupportedOperationException ex) {
|
||||
throw ex;
|
||||
} catch (Exception e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("unknown exception while taking snapshot for volume {} was caught", volume, e);
|
||||
|
||||
@ -3814,10 +3814,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_SNAPSHOT_CREATE, eventDescription = "taking snapshot", async = true)
|
||||
public Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm,
|
||||
Snapshot.LocationType locationType, boolean asyncBackup, Map<String, String> tags, List<Long> zoneIds, List<Long> poolIds, Boolean useStorageReplication)
|
||||
|
||||
throws ResourceAllocationException {
|
||||
public Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm, Snapshot.LocationType locationType, boolean asyncBackup,
|
||||
Map<String, String> tags, List<Long> zoneIds, List<Long> poolIds, Boolean useStorageReplication) throws ResourceAllocationException {
|
||||
final Snapshot snapshot = takeSnapshotInternal(volumeId, policyId, snapshotId, account, quiescevm, locationType, asyncBackup, zoneIds, poolIds, useStorageReplication);
|
||||
if (snapshot != null && MapUtils.isNotEmpty(tags)) {
|
||||
taggedResourceService.createTags(Collections.singletonList(snapshot.getUuid()), ResourceTag.ResourceObjectType.Snapshot, tags, null);
|
||||
|
||||
@ -1621,7 +1621,8 @@ public class SnapshotManagerImpl extends MutualExclusiveIdsManagerBase implement
|
||||
if (snapshotStrategy == null) {
|
||||
_snapshotDao.remove(snapshotId);
|
||||
logger.debug("No strategy found for creation of snapshot [{}], removing its record from the database.", snapshot);
|
||||
throw new CloudRuntimeException(String.format("Can't find snapshot strategy to deal with snapshot:%s", snapshot.getSnapshotVO()));
|
||||
throw new UnsupportedOperationException(String.format("Unable to find a snapshot strategy to create snapshot [%s] of volume [%s]. Please check the logs.",
|
||||
snapshot.getSnapshotVO(), volume.getUuid()));
|
||||
}
|
||||
|
||||
SnapshotInfo snapshotOnPrimary = snapshotStrategy.takeSnapshot(snapshot);
|
||||
@ -1672,7 +1673,7 @@ public class SnapshotManagerImpl extends MutualExclusiveIdsManagerBase implement
|
||||
} catch (Exception e) {
|
||||
logger.debug("post process snapshot failed", e);
|
||||
}
|
||||
} catch (CloudRuntimeException cre) {
|
||||
} catch (CloudRuntimeException | UnsupportedOperationException cre) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Failed to create snapshot" + cre.getLocalizedMessage());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user