File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -204,10 +204,15 @@ public boolean isRevertable() {
204204 @ Override
205205 public long getPhysicalSize () {
206206 long physicalSize = 0 ;
207- SnapshotDataStoreVO snapshotStore = snapshotStoreDao .findByStoreSnapshot (DataStoreRole .Image , store .getId (), snapshot .getId ());
208- if (snapshotStore != null ) {
209- physicalSize = snapshotStore .getPhysicalSize ();
207+ for (DataStoreRole role : List .of (DataStoreRole .Image , DataStoreRole .Primary )) {
208+ logger .trace ("Retrieving snapshot [{}] size from {} storage." , snapshot .getUuid (), role );
209+ SnapshotDataStoreVO snapshotStore = snapshotStoreDao .findByStoreSnapshot (role , store .getId (), snapshot .getId ());
210+ if (snapshotStore != null ) {
211+ return snapshotStore .getPhysicalSize ();
212+ }
213+ logger .trace ("Snapshot [{}] size not found on {} storage." , snapshot .getUuid (), role );
210214 }
215+ logger .warn ("Snapshot [{}] reference not found in any storage. There may be an inconsistency on the database." , snapshot .getUuid ());
211216 return physicalSize ;
212217 }
213218
You can’t perform that action at this time.
0 commit comments