abbbi / virtnbdbackup

Backup utility for Libvirt / qemu / kvm supporting incremental and differential backups + instant recovery (agentless).
http://libvirtbackup.grinser.de/
GNU General Public License v3.0
330 stars 46 forks source link

Save vm config even if disk backup fails or all disks are excluded #93

Closed damiankaczkowski closed 1 year ago

damiankaczkowski commented 1 year ago

Currently backup fails if disk is missing and no vmconfig.xml is created. The same also happens if you exclude all disks from backup - no xml is created. Please consider changing priority of backup tasks so that vm xml is created first. Level auto backup mode should handle missing disk errors or any other errors and backup as much as possible - vm xml at minimum. Also I can imagine workflows for backing up only xml without any data. Please consider this change. Thanks in advance.

abbbi commented 1 year ago

sounds reasonable, virtual machine config is only backed up if at least one disk backup is successful:

[2023-01-05 10:14:56] INFO lib common - printVersion [MainThread]: Version: 1.9.12 Arguments: ./virtnbdbackup -d vm1 -o /tmp/tmp.3WAT2LDe4C -x sda
[2023-01-05 10:14:56] INFO root virtnbdbackup - main [MainThread]: Backup level: [copy]
[2023-01-05 10:14:56] INFO root virtnbdbackup - main [MainThread]: Libvirt library version: [7000000]
[2023-01-05 10:14:56] WARNING virt client - getDomainDisks [MainThread]: Excluding Disks sda from backup as requested
[2023-01-05 10:14:56] INFO virt client - getDomainDisks [MainThread]: Skipping attached [cdrom] device: [sdb].
[2023-01-05 10:14:56] INFO virt client - getDomainDisks [MainThread]: Skipping attached [floppy] device: [fda].
[2023-01-05 10:14:56] ERROR root virtnbdbackup - main [MainThread]: Domain has no disks attached which support changed block tracking.
# ls -alh  /tmp/tmp.3WAT2LDe4C/
total 128K
drwx------   3 root root 4.0K Jan  5 10:14 .
drwxrwxrwt 789 root root 112K Jan  5 10:14 ..
-rw-r--r--   1 root root  813 Jan  5 10:14 backup.copy.01052023101456.log
drwxr-xr-x   2 root root 4.0K Jan  5 10:14 checkpoints

Needs some rework on how the backup process behaves, because the name of the configuration file is based on the checkpoints, but the process should not start with checkpoint handling if there no disks available etc.. Some considerations to take in.. Same applies to the virtual machines additional boot config like UEFI loader and kernel image.

It also needs to take into account whats happening with the checkpoints, if a disk backup fails during incremental backup, lets say while writing the file. Incremental/Differential backup already attempts to detect past failures by checking for partial backup files. Bad situations could appear where data for a checkpoint is not backed up but the backup chain continues..