Skip to content

Commit

Permalink
Addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
slavkap committed Aug 30, 2024
1 parent 6f209d8 commit 524f382
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public class CopySnapshotCmd extends BaseAsyncCmd implements UserCmd {
entityType = StoragePoolResponse.class,
required = false,
description = "A comma-separated list of IDs of the storage pools in other zones in which the snapshot will be made available. " +
"The snapshot will always be made available in the zone in which the volume is present.")
"The snapshot will always be made available in the zone in which the volume is present. Currently supported for StorPool only")
protected List<Long> storagePoolIds;

/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public enum DataStoreCapabilities {
/**
* indicates that the driver supports copying snapshot between zones on pools of the same type
*/
CAN_COPY_SNAPSHOT_BETWEEN_ZONES,
CAN_COPY_SNAPSHOT_BETWEEN_ZONES_AND_SAME_POOL_TYPE,

Check warning on line 47 in engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreCapabilities.java

View check run for this annotation

Codecov / codecov/patch

engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreCapabilities.java#L47

Added line #L47 was not covered by tests
/**
* indicates that the storage does not need to delete the snapshot when creating a volume/template from it
* and the setting `snapshot.backup.to.secondary` is enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private SnapshotDataStoreVO getSnapshotImageStoreRef(long snapshotId, long zoneI
@Override
public Map<String, String> getCapabilities() {
Map<String, String> mapCapabilities = new HashMap<>();
mapCapabilities.put(DataStoreCapabilities.CAN_COPY_SNAPSHOT_BETWEEN_ZONES.toString(), Boolean.TRUE.toString());
mapCapabilities.put(DataStoreCapabilities.CAN_COPY_SNAPSHOT_BETWEEN_ZONES_AND_SAME_POOL_TYPE.toString(), Boolean.TRUE.toString());
mapCapabilities.put(DataStoreCapabilities.KEEP_SNAPSHOT_ON_PRIMARY_AND_BACKUP.toString(), Boolean.TRUE.toString());
return mapCapabilities;

Check warning on line 190 in plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java

View check run for this annotation

Codecov / codecov/patch

plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java#L187-L190

Added lines #L187 - L190 were not covered by tests
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3867,7 +3867,7 @@ private boolean canCopyOnPrimary(List<Long> poolIds, VolumeInfo volume, boolean
DataStore dataStore = dataStoreMgr.getDataStore(poolId, DataStoreRole.Primary);
StoragePoolVO sPool = _storagePoolDao.findById(poolId);

Check warning on line 3868 in server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java#L3867-L3868

Added lines #L3867 - L3868 were not covered by tests
if (dataStore != null
&& !dataStore.getDriver().getCapabilities().containsKey(DataStoreCapabilities.CAN_COPY_SNAPSHOT_BETWEEN_ZONES.toString())
&& !dataStore.getDriver().getCapabilities().containsKey(DataStoreCapabilities.CAN_COPY_SNAPSHOT_BETWEEN_ZONES_AND_SAME_POOL_TYPE.toString())
&& sPool.getPoolType() != volume.getStoragePoolType()
&& volume.getPoolId() == poolId) {
throw new InvalidParameterValueException("The specified pool doesn't support copying snapshots between zones" + poolId);

Check warning on line 3873 in server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L3873 was not covered by tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2137,7 +2137,7 @@ private boolean canCopyOnPrimary(List<Long> poolIds, Snapshot snapshot) {
continue;

Check warning on line 2137 in server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java#L2136-L2137

Added lines #L2136 - L2137 were not covered by tests
}
if (!dataStore.getDriver().getCapabilities()

Check warning on line 2139 in server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java#L2139

Added line #L2139 was not covered by tests
.containsKey(DataStoreCapabilities.CAN_COPY_SNAPSHOT_BETWEEN_ZONES.toString())
.containsKey(DataStoreCapabilities.CAN_COPY_SNAPSHOT_BETWEEN_ZONES_AND_SAME_POOL_TYPE.toString())
&& dataStore.getPoolType() != volume.getPoolType()) {
poolsToBeRemoved.add(poolId);
logger.debug(String.format("The %s does not support copy to %s between zones", dataStore.getPoolType(), volume.getPoolType()));

Check warning on line 2143 in server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java#L2142-L2143

Added lines #L2142 - L2143 were not covered by tests
Expand Down

0 comments on commit 524f382

Please sign in to comment.