cv4pve-barc icon indicating copy to clipboard operation
cv4pve-barc copied to clipboard

[Bug-0.2.5-renew] Restore fails

Open MRLOLKOPF opened this issue 4 years ago • 14 comments

Hi,

I just tested the new version (0.2.5-renew) on my test Proxmox environment, unfortunately I found some bugs. I might try to fix them myself and make a pull request, but due to the corona situation I'm quite busy now. Just want to report those bugs, so that others might be aware of it. But really nice improvements with fsfreeze, checksum check, etc.!!

I'm not able to run a restore with the new version. This backup/diff was already made with the new version. A restore with the version before (0.2.1) is working without any issue. Output:

root@pve03:/mnt/pve/bak2hetznerCeph/barc# eve4pve-barc restore --vmid=104 --label='daily' --path='/mnt/pve/bak2hetznerCeph/'
ACTION: Restore image
Start restore 2020-04-06 09:12:08 20200406023001RBD01.vm-104-disk-0.diff
Remove all snapshots
rbd: error opening image vm-114-disk-0: (2) No such file or directory
ERROR: rbd snap purge RBD01/vm-114-disk-0
Backup 20200406023001RBD01.vm-104-disk-0.diff restored in RBD01/vm-114-disk-0 with success!
Consider to manually create VM/CT and change config file from backup adapting restored image.
End restore 2020-04-06 09:12:20
0 Bytes restored in 12 Seconds. [0 Bytes/s] [Compressed Size 0 Bytes]
Issuing qm-rescan
rescan volumes...

Then I tried it with a new VM, which was never backed up by this tool. Those diffs were made manually within just several minutes in a row in comparison to the output above. With the version before, again, no problem. I got this output:

root@pve02:~# eve4pve-barc restore --vmid=114 --label='daily' --path='/mnt/pve/bak2hetznerCeph/'
ACTION: Restore image
Start restore 2020-04-06 09:54:29 20200406095123RBD01.vm-114-disk-0.diff
Remove all snapshots
rbd: error opening image vm-114-disk-1: (2) No such file or directory
ERROR: rbd snap purge RBD01/vm-114-disk-1
Backup 20200406095123RBD01.vm-114-disk-0.diff restored in RBD01/vm-114-disk-1 with success!
Consider to manually create VM/CT and change config file from backup adapting restored image.
End restore 2020-04-06 09:54:29
/usr/sbin/eve4pve-barc: line 1258: local: 0/0: division by 0 (error token is "0")

Stay healthy! Greetings from Germany, Andy

MRLOLKOPF avatar Apr 06 '20 10:04 MRLOLKOPF

@lephisto do you have any idea?

franklupo avatar Apr 07 '20 15:04 franklupo

I am wondering why VM ID's are mixed up here:

rbd: error opening image vm-114-disk-0: (2) No such file or directory
ERROR: rbd snap purge RBD01/vm-114-disk-0

Have you changed the ID for that Vm maybe?

thanks, Bastian

lephisto avatar Apr 10 '20 15:04 lephisto

Hello,

in the first case, yes, I recovered the backup from VM 104 and named it 114. In the second case, no, I restored VM 114 and named it 114.

MRLOLKOPF avatar Apr 10 '20 17:04 MRLOLKOPF

But the restore in the second case was OK, so it was just the issue that reporting was not ok?

lephisto avatar Apr 11 '20 22:04 lephisto

I double checked everything now for proper restore functionality. I can't reproduce your issue. I might write something into the docs, that if VM's have been renumbered one should start with a clean set of snapshots..

lephisto avatar Apr 11 '20 23:04 lephisto

Hi, I actually don't know if the restore in the second case was successful, I didn't checked that after the RBD and division by 0 errors.

The second case was a fresh VM, which never was backed up by this tool in the past. It was a fresh backup with the new version. No VMID renumbering. I might give it a new try in the future to further analyze this...

MRLOLKOPF avatar Apr 12 '20 09:04 MRLOLKOPF

Hello developpers ;)
Thanks for your all of your work 👍 We encountering the same issue when restoring VM with backup files named like this :

YYYYMMddHHmmssMYCEPHPOOL_1.vm-100-disk-0.diff

We identified that the regex into the the function "restore" do not match correctly the file name.

... #Create actionplan regex='^([0-9]+)([a-zA-Z-]+)\.(.*)\.(diff|img).?(.*)?' ... #Execute actionplan local backup='' for backup in "${plan[@]}"; do regex='^([0-9]+)([a-zA-Z-]+)\.(.*)\.(diff|img).?(.*)?' ...

We do not want to change CEPH pool we've decided to "fork" the code and inclue our file name specification :

... #Create actionplan regex='^([0-9]+)([a-zA-Z0-9\_]+)\.(.*)\.(diff|img).?(.*)?' ... #Execute actionplan local backup='' for backup in "${plan[@]}"; do regex='^([0-9]+)([a-zA-Z0-9\_]+)\.(.*)\.(diff|img).?(.*)?' ... Hopes it can help.

GizMoOfr avatar Jun 12 '20 13:06 GizMoOfr

Hi, @lephisto you can fix it? I can't do it now.

Thanks

franklupo avatar Jun 12 '20 13:06 franklupo

@GizMoOfr can you send a PR so I can test it.

lephisto avatar Jun 16 '20 14:06 lephisto

For full information using parameter --debug

franklupo avatar Jun 16 '20 15:06 franklupo

Hi, I fixed it using a single regex for everyone. and to be verified by downloading the code

declare -r redateex='^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$'

Best regards

franklupo avatar Jul 03 '20 15:07 franklupo

Just ran into this too - the issue seems to be ceph pools that have numbers (and/or underscore if they are valid) in them. In both plan actionplan and execute actionplan $regex, lines 1161 and 1187, need to be adjusted to ^([0-9]+)([a-zA-Z0-9_-]+)\.(.*)\.(diff|img).?(.*)?

The second definition isn't even required though and could be removed entirely (or commented out to have the regex visible, but only active once in the code)

Tatsu-Kishi avatar Jul 13 '20 12:07 Tatsu-Kishi

Hi, I modified the regexp, try to check if it works

best regards

franklupo avatar Jul 13 '20 14:07 franklupo

In my case I'm on a newly installed Proxmox 6.2-11 environment where I am testing backups for Ceph. When using 0.2.6 restores fail due to the same error. When I downgrade to 0.2.5 the backup restore is working. I'm not using any fancy pool names. So probably the fix did create a bug :)

root@pve1:~# eve4pve-barc restore --vmid=201 --label='hourly' --path=/mnt/pve/backups ACTION: Restore image Start restore 2020-08-28 14:32:01 20200828131501vmstorage.vm-201-disk-0.diff.zz Remove all snapshots rbd: error opening image vm-201-disk-0: (2) No such file or directory ERROR: rbd snap purge vmstorage/vm-201-disk-0 Backup 20200828131501vmstorage.vm-201-disk-0.diff.zz restored in vmstorage/vm-201-disk-0 with success! Consider to manually create VM/CT and change config file from backup adapting restored image. End restore 2020-08-28 14:32:01 /usr/sbin/eve4pve-barc: line 1256: local: 0/0: division by 0 (error token is "0")

Xeronzz avatar Aug 28 '20 12:08 Xeronzz