Skip to content

Commit 5e0024f

Browse files
review
1 parent 0659e8d commit 5e0024f

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public void execute() {
244244
}
245245

246246
private Snapshot.LocationType getLocationType() {
247-
if (Snapshot.LocationType.values().length == 0 || locationType == null) {
247+
if (locationType == null) {
248248
return null;
249249
}
250250

engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
8080

8181
private static final String GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT = "SELECT SUM(s.physical_size) " +
8282
"FROM cloud.snapshot_store_ref s " +
83-
"INNER JOIN cloud.snapshots ON s.snapshot_id = snapshots.id " +
83+
"LEFT JOIN cloud.snapshots ON s.snapshot_id = snapshots.id " +
8484
"WHERE snapshots.account_id = ? " +
8585
"AND snapshots.removed IS NULL " +
8686
"AND s.state = 'Ready' " +
@@ -587,6 +587,18 @@ public int expungeBySnapshotList(final List<Long> snapshotIds, final Long batchS
587587
return batchExpunge(sc, batchSize);
588588
}
589589

590+
/**
591+
* Returns the total physical size, in bytes, of all snapshots stored on primary
592+
* storage for the specified account that have not yet been backed up to
593+
* secondary storage.
594+
*
595+
* <p>If no such snapshots are found, this method returns {@code 0}.</p>
596+
*
597+
* @param accountId the ID of the account whose snapshots on primary storage
598+
* should be considered
599+
* @return the total physical size in bytes of matching snapshots on primary
600+
* storage, or {@code 0} if none are found
601+
*/
590602
@Override
591603
public long getSnapshotsPhysicalSizeOnPrimaryStorageByAccountId(long accountId) {
592604
long snapshotsPhysicalSize = 0;

0 commit comments

Comments
 (0)