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 @@ -172,10 +172,15 @@ public boolean isRevertable() {
172172 @ Override
173173 public long getPhysicalSize () {
174174 long physicalSize = 0 ;
175- SnapshotDataStoreVO snapshotStore = snapshotStoreDao .findByStoreSnapshot (DataStoreRole .Image , store .getId (), snapshot .getId ());
176- if (snapshotStore != null ) {
177- physicalSize = snapshotStore .getPhysicalSize ();
175+ for (DataStoreRole role : List .of (DataStoreRole .Image , DataStoreRole .Primary )) {
176+ logger .trace ("Retrieving snapshot [{}] size from {} storage." , snapshot .getUuid (), role );
177+ SnapshotDataStoreVO snapshotStore = snapshotStoreDao .findByStoreSnapshot (role , store .getId (), snapshot .getId ());
178+ if (snapshotStore != null ) {
179+ return snapshotStore .getPhysicalSize ();
180+ }
181+ logger .trace ("Snapshot [{}] size not found on {} storage." , snapshot .getUuid (), role );
178182 }
183+ logger .warn ("Snapshot [{}] reference not found in any storage. There may be an inconsistency on the database." , snapshot .getUuid ());
179184 return physicalSize ;
180185 }
181186
You can’t perform that action at this time.
0 commit comments