1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-09 03:36:48 +00:00

feat(instances): a running VM can be cloned

libvirt's backup copies the disks of a running or paused VM from one
instant into new volumes while it keeps running; the clone is defined
shut off as before. The VM is held for the copy, the copy can be
cancelled, and recovery reads the job's records and libvirt.
This commit is contained in:
catborise 2026-10-16 15:49:35 +03:00
parent 39ad472a7c
commit 46a611941e
10 changed files with 653 additions and 19 deletions

View file

@ -2088,7 +2088,7 @@ class wvmInstance(wvmConnect):
raise util.OperationError(f"Clone failed ({err}); remove these copies by hand: {', '.join(leftovers)}") from err
raise
def live_clone_targets(self, clone_data, free_percent, free_min_gib):
def live_clone_targets(self, clone_data, free_percent=10, free_min_gib=1):
"""Refuses a live clone that cannot work, before anything is
allocated; returns the new volume of each copied disk, in disk order:
in the source volume's pool, at its virtual capacity and format. Each
@ -2193,6 +2193,11 @@ class wvmInstance(wvmConnect):
return None
return bool(stats["success"]), stats.get("errmsg") or ""
def discard_backup_result(self):
"""Drops the result libvirt keeps of the VM's last completed job, so
a later backup_result() can only be of a backup started after this."""
self.instance.jobStats(VIR_DOMAIN_JOB_STATS_COMPLETED)
def abort_backup(self):
self.instance.abortJob()