Skip to content

Commit

Permalink
Fix FileVDI.getAllocatedSize
Browse files Browse the repository at this point in the history
Signed-off-by: Damien Thenot <damien.thenot@vates.tech>
  • Loading branch information
Nambrok committed Nov 27, 2024
1 parent e207c0a commit 7c0a23a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,11 @@ def delete(self):
raise util.SMException("os.unlink(%s) failed" % self.path)
VDI.delete(self)

def getAllocatedSize(self):
if self._sizeAllocated == -1:
self._sizeAllocated = vhdutil.getAllocatedSize(self.path)
return self._sizeAllocated


class LVHDVDI(VDI):
"""Object representing a VDI in an LVHD SR"""
Expand Down
1 change: 1 addition & 0 deletions tests/test_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,7 @@ def add_vdis_for_coalesce(self, sr):
vdi = cleanup.FileVDI(sr, vdi_uuid, False)
vdi.path = '%s.vhd' % (vdi_uuid)
vdi.parent = parent
vdi._sizeAllocated = 20971520 #10 blocks of 2MB changed in the child
parent.children.append(vdi)

sr.vdis[vdi_uuid] = vdi
Expand Down

0 comments on commit 7c0a23a

Please sign in to comment.