Skip to content

Commit

Permalink
core: update actual size after conversion
Browse files Browse the repository at this point in the history
The actual size of a volume is reduced when converting the disk from
COW/preallocated to COW/thin on a block storage domain is not updated,
making it seem like disk consumes more than it actually does.

This patch updates the actual size after conversion.

Bug-Url: https://bugzilla.redhat.com/2086561
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
  • Loading branch information
bennyz authored and ahadas committed Jun 28, 2022
1 parent d53cf94 commit 762fedb
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ private boolean switchImage() {
DiskImage newImage = DiskImage.copyOf(getDiskImage());
newImage.setImageId(getParameters().getNewVolGuid());
newImage.setSize(info.getSize());
newImage.setActualSize(info.getActualSize());
newImage.setActualSizeInBytes(info.getActualSizeInBytes());
if (getParameters().getVolumeFormat() != null) {
if (info.getVolumeFormat() != getParameters().getVolumeFormat()) {
log.error("Requested format '{}' doesn't match format on storage '{}'",
Expand All @@ -323,7 +325,6 @@ private boolean switchImage() {
TransactionSupport.executeInNewTransaction(() -> {
addDiskImageToDb(newImage, getCompensationContext(), true);
imageDao.update(getDiskImage().getImage());

return null;
});

Expand Down

0 comments on commit 762fedb

Please sign in to comment.