eslam-gomaa / virt-backup

Fully backup your KVM Virtual Machines
28 stars 2 forks source link

Script fails with virt-backup.rb:200:in `backup': undefined method `vm_info' #1

Closed rbarrott closed 3 years ago

rbarrott commented 3 years ago

Script fails when attempting to back-up a VM, seems to happen with multiple VMs. Platform is RHEL 8.3 with virsh 6.0.0.

[vmbackup]$ ruby ./virt-backup/virt-backup.rb --backup --original-vm "rhel7.7" --with-snapshots --save-dir `pwd`

Traceback (most recent call last):
    1: from ./virt-backup/virt-backup.rb:346:in `<main>'
./virt-backup/virt-backup.rb:200:in `backup': undefined method `vm_info' for main:Object (NoMethodError)
eslam-gomaa commented 3 years ago

Thank you for Posting the issue, will check it today

eslam-gomaa commented 3 years ago

Hello,

I have pushed an updated code, please clone and test again

-- Please install ruby 2.4 or higher if you have less version; ruby -v

gem install rubysl-tempfile
gem install rubysl-optparse
gem install open4
gem uninstall zip # Need to be removed if installed
gem install rubyzip

waiting your feed back

Thank you

rbarrott commented 3 years ago

Thanks! We've moved past the first error, but now get:

[ vmbackup]$ ruby ./virt-backup/virt-backup.rb --backup --original-vm "rhel7.7" --with-snapshots --save-dir `pwd`

[ INFO ] Current VM State: shut off
[ INFO ] Getting checksum of the Files will be backed up - May take time based on size
Traceback (most recent call last):
    8: from ./virt-backup/virt-backup.rb:348:in `<main>'
    7: from ./virt-backup/virt-backup.rb:248:in `backup'
    6: from /mnt/ext4tb/vmbackup/virt-backup/functions.rb:207:in `disks_md5'
    5: from /mnt/ext4tb/vmbackup/virt-backup/functions.rb:207:in `each'
    4: from /mnt/ext4tb/vmbackup/virt-backup/functions.rb:208:in `block in disks_md5'
    3: from /mnt/ext4tb/vmbackup/virt-backup/functions.rb:191:in `file_md5'
    2: from /mnt/ext4tb/vmbackup/virt-backup/functions.rb:191:in `open'
    1: from /mnt/ext4tb/vmbackup/virt-backup/functions.rb:194:in `block in file_md5'
/mnt/ext4tb/vmbackup/virt-backup/functions.rb:194:in `each': negative string size (or size too big) (ArgumentError)

This VM has two disks which are both fairly large:

[vmbackup]$ ls -lh /home/user/.local/share/libvirt/images/rhel7.7*
-rw-------. 1 user user 56G Nov 10 11:58 /home/user/.local/share/libvirt/images/rhel7.7-1.qcow2
-rw-------. 1 user user 82G Nov 10 11:58 /home/user/.local/share/libvirt/images/rhel7.7.qcow2
eslam-gomaa commented 3 years ago

Hello,

Solved

Kindly clone and test again 😃

Note The only thing now is that it takes more time to restore if the disk size is big, but I can add an option to control compression level


Test Result

but it makes sense when we see how much been compressed

-rw-r--r--. 1 root root 470M Nov 12 08:24 /root/backup/haproxy.zip
rbarrott commented 3 years ago

Thanks, that seems to have fixed it.