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

Argument type error during checkpoint create XML #41

Closed SkyFalt closed 2 years ago

SkyFalt commented 2 years ago

Hi!

First of all, thanks for your work! :)

Currently I am using the v0.55. During some testing in my environment I got some errors, while I was creating a backup:

Traceback (most recent call last):
  File "./virtnbdbackup", line 895, in <module>
    main()
  File "./virtnbdbackup", line 474, in main
    handleCheckpoints(args, virtClient, domObj, lib)
  File "./virtnbdbackup", line 149, in handleCheckpoints
    if virtClient.redefineCheckpoints(domObj, args) is False:
  File "/data/virtnbdbackup_v0.55/libvirtnbdbackup/libvirthelper/libvirthelper.py", line 443, in redefineCheckpoints
    checkpointConfig, libvirt.VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE
  File "/usr/lib64/python3.6/site-packages/libvirt.py", line 1267, in checkpointCreateXML
    ret = libvirtmod.virDomainCheckpointCreateXML(self._o, xmlDesc, flags)
TypeError: virDomainCheckpointCreateXML() argument 2 must be str or None, not bytes

After some debugging I found out that in libvirthelper.py line 410 it opens the checkpoint files as binary "rb", but later at lines 442-443, when it calls the libvirt.py's checkpointCreateXML function it's secound argument 'xmlDesc' needs to be a string, or none. After I changed it to simply "r" it works just fine.

I don't know if it was only a problem for me, but I hope it helps.

Keep up the good work!

abbbi commented 2 years ago

This issue has been fixed with the latest version released, please update.