mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(vmbackups): an incremental backup needs room for its changed blocks only
The target space check asked for every disk's virtual capacity even when the backup copies only the blocks changed since its parent. The checkpoint already reports those bytes per disk (VIR_DOMAIN_CHECKPOINT_XML_SIZE), so checkpoint_usable becomes checkpoint_sizes and the check runs after the parent is chosen, with the changed bytes for an incremental backup and the capacity for a full one. The margin (free_percent, free_min_gib) is kept.
This commit is contained in:
parent
132676a772
commit
8cd7aee19a
5 changed files with 49 additions and 30 deletions
|
|
@ -82,7 +82,7 @@ class LiveIncrementalTestCase(SimpleTestCase):
|
|||
self.write(dom, "0xdd", offset * MIB)
|
||||
self.backup(proxy, NAME + "-full.qcow2", checkpoint="wvc-1")
|
||||
self.write(dom, "0xbb", 2 * MIB)
|
||||
self.assertTrue(proxy.checkpoint_usable("wvc-1", ["vda"]))
|
||||
self.assertGreaterEqual(proxy.checkpoint_sizes("wvc-1", ["vda"])["vda"], MIB) # the block written since
|
||||
self.backup(proxy, NAME + "-inc1.qcow2", incremental="wvc-1", checkpoint="wvc-2", backing=NAME + "-full.qcow2")
|
||||
self.write(dom, "0xcc", 4 * MIB)
|
||||
self.backup(proxy, NAME + "-inc2.qcow2", incremental="wvc-2", checkpoint="wvc-3", backing=NAME + "-inc1.qcow2")
|
||||
|
|
@ -111,7 +111,7 @@ class LiveIncrementalTestCase(SimpleTestCase):
|
|||
|
||||
# after a migration the checkpoint's record is gone, its bitmap is not: the pruning finds it
|
||||
dom.checkpointLookupByName("wvc-3").delete(libvirt.VIR_DOMAIN_CHECKPOINT_DELETE_METADATA_ONLY)
|
||||
self.assertFalse(proxy.checkpoint_usable("wvc-3", ["vda"]))
|
||||
self.assertIsNone(proxy.checkpoint_sizes("wvc-3", ["vda"]))
|
||||
proxy.prune_checkpoints(keep=set(), known={"wvc-3": 3}, devs=["vda"])
|
||||
nodes = json.loads(libvirt_qemu.qemuMonitorCommand(
|
||||
dom, json.dumps({"execute": "query-named-block-nodes", "arguments": {"flat": True}}), 0))["return"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue