Skip to content

Commit f658823

Browse files
committed
fix(coalesce): Big vhd-blocks cause exception
When handling bitmap, the GC is trying to write it in sm-config of the VDI. In the case of QCOW2, the bitmap can be bigger with 64KiB blocksize and they can't be written in the VDI sm-config. In this case, the GC would silently fail before running again and failing again. The written information is apparently never used again but the existence of the key in sm-config is checked by the GC to know if it has work to do. By not raising, the GC would run normally but never stop. Writing a dummy value then allow the GC to run and stop if it doesn't have work to do. Since the value used is always read from the VDI, the one from sm-config is not really relevant. Signed-off-by: Damien Thenot <damien.thenot@vates.tech>
1 parent 10187da commit f658823

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

drivers/cleanup.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,15 @@ def getAllLeaves(self) -> List["VDI"]:
769769

770770
def updateBlockInfo(self) -> Optional[str]:
771771
val = base64.b64encode(self._queryCowBlocks()).decode()
772-
self.setConfig(VDI.DB_VDI_BLOCKS, val)
772+
try:
773+
self.setConfig(VDI.DB_VDI_BLOCKS, val)
774+
except Exception:
775+
if self.vdi_type != VdiType.QCOW2:
776+
raise
777+
# Sometime with QCOW2, our allocation table is too big to be stored in XAPI, in this case we do not store it
778+
# and we write `skipped` instead so that hasWork is happy (and the GC doesn't run in loop indefinitely).
779+
self.setConfig(VDI.DB_VDI_BLOCKS, "skipped")
780+
773781
return val
774782

775783
def rename(self, uuid) -> None:

0 commit comments

Comments
 (0)