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

Backup with error #85

Closed inode64 closed 1 year ago

inode64 commented 1 year ago

Version used 1.9.8

Describe the bug When trying to perform a backup, the checkpoint cannot be created because it says that it already exists, but it really does not exist ("virsh checkpoint-list svrServicios" does not show any and there is no file in /var/lib/libvirt/qemu/checkpoint/).

Then when generating the error it looks like a message that you need to pass an argument to the libvirtError function (defmsg)

Expected behavior A correct backup

Hypervisor information:

Logfiles:

[2022-11-29 01:03:44] INFO common - printVersion [MainThread]: Version: 1.9.8 Arguments: /usr/lib/python-exec/python3.10/virtnbdbackup -S /tmp/ -d svrServicios --noprogress -q --compress -l auto -o /srv/backup/svrServicios/2022-48
[2022-11-29 01:03:44] INFO virtnbdbackup - main [MainThread]: Backup level: [auto]
[2022-11-29 01:03:44] INFO virtnbdbackup - main [MainThread]: Compression enabled, level [2]
[2022-11-29 01:03:44] INFO virtnbdbackup - main [MainThread]: Backup mode auto, target folder is empty: executing full backup.
[2022-11-29 01:03:44] INFO virtnbdbackup - main [MainThread]: Libvirt library version: [8008000]
[2022-11-29 01:03:44] INFO client - getDomainDisks [MainThread]: Skipping attached [cdrom] device: [sda].
[2022-11-29 01:03:44] INFO virtnbdbackup - main [MainThread]: Domain has [1] disks attached which support changed block tracking.
[2022-11-29 01:03:44] INFO virtnbdbackup - main [MainThread]: Concurrent backup processes: [1]
[2022-11-29 01:03:44] INFO client - redefineCheckpoints [MainThread]: Loading checkpoint list from: [/srv/backup/svrServicios/2022-48/checkpoints]
[2022-11-29 01:03:44] INFO virtnbdbackup - handleCheckpoints [MainThread]: Checkpoint handling.
[2022-11-29 01:03:44] INFO virtnbdbackup - handleCheckpoints [MainThread]: Using checkpoint name: [virtnbdbackup.0].
[2022-11-29 01:03:44] INFO virtnbdbackup - main [MainThread]: Local NDB Endpoint socket: [/var/tmp/virtnbdbackup.1314447]
[2022-11-29 01:03:44] INFO virtnbdbackup - main [MainThread]: Temporary scratch file target directory: [/tmp/]
[2022-11-29 01:03:44] INFO virtnbdbackup - startBackupJob [MainThread]: Starting backup job.
[2022-11-29 01:03:53] INFO client - fsFreeze [MainThread]: Freezed [2] filesystems.
[2022-11-29 01:03:55] INFO client - fsThaw [MainThread]: Thawed [2] filesystems.
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/libvirtnbdbackup/virt/client.py", line 580, in startBackup
    domObj.backupBegin(backupXml, checkpointXml)
  File "/usr/lib/python3.10/site-packages/libvirt.py", line 806, in backupBegin
    raise libvirtError('virDomainBackupBegin() failed')
libvirt.libvirtError: internal error: unable to execute command QEMU 'transaction': Bitmap already exists: virtnbdbackup.0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.10/virtnbdbackup", line 1079, in 
    main()
  File "/usr/lib/python-exec/python3.10/virtnbdbackup", line 627, in main
    if not startBackupJob(args, virtClient, domObj, disks):
  File "/usr/lib/python-exec/python3.10/virtnbdbackup", line 250, in startBackupJob
    virtClient.startBackup(
  File "/usr/lib/python3.10/site-packages/libvirtnbdbackup/virt/client.py", line 583, in startBackup
    raise startBackupFailed(
TypeError: libvirtError.__init__() missing 1 required positional argument: 'defmsg'
**Workaround:**
Share possible workarounds, if any.
abbbi commented 1 year ago

hi,

this is not really a bug. The bitmap exists in the qemu image but not on libvirt side. you need to clean up your bitmap information using qemu-img, see past issues on this topic. You also need to investigate how this situation can happen in your envirionment, please check:

https://github.com/abbbi/virtnbdbackup#transient-virtual-machines-checkpoint-persistency

Problem is that the qemu image has the bitmap information (use qemu-img to find out and remove the dangling bitmap) but libvirt has not. Can happen if virtual machine is migrated between libvirt environments, for example.

inode64 commented 1 year ago

Ok I check the image with qemu-img, and the next problem with missing 1 required positional argument: 'defmsg'

abbbi commented 1 year ago

Yes, the exception raise was a bit off, this has been fixed in in dev branch and exception is now correctly raised.

inode64 commented 1 year ago

Ok, I check this commit and it runs fine now!!

thanks!