mirror of https://github.com/apache/cloudstack.git
fix snapshot physical size for primary storage (#11448)
This commit is contained in:
parent
9111bbd8da
commit
c6daeb4f78
|
|
@ -172,10 +172,15 @@ public class SnapshotObject implements SnapshotInfo {
|
|||
@Override
|
||||
public long getPhysicalSize() {
|
||||
long physicalSize = 0;
|
||||
SnapshotDataStoreVO snapshotStore = snapshotStoreDao.findByStoreSnapshot(DataStoreRole.Image, store.getId(), snapshot.getId());
|
||||
if (snapshotStore != null) {
|
||||
physicalSize = snapshotStore.getPhysicalSize();
|
||||
for (DataStoreRole role : List.of(DataStoreRole.Image, DataStoreRole.Primary)) {
|
||||
logger.trace("Retrieving snapshot [{}] size from {} storage.", snapshot.getUuid(), role);
|
||||
SnapshotDataStoreVO snapshotStore = snapshotStoreDao.findByStoreSnapshot(role, store.getId(), snapshot.getId());
|
||||
if (snapshotStore != null) {
|
||||
return snapshotStore.getPhysicalSize();
|
||||
}
|
||||
logger.trace("Snapshot [{}] size not found on {} storage.", snapshot.getUuid(), role);
|
||||
}
|
||||
logger.warn("Snapshot [{}] reference not found in any storage. There may be an inconsistency on the database.", snapshot.getUuid());
|
||||
return physicalSize;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue