Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean command does not work when using zstd as compression and there are pending/aborted backups #51

Closed
mikewzr opened this issue Feb 17, 2024 · 2 comments

Comments

@mikewzr
Copy link

mikewzr commented Feb 17, 2024

I recently switch to zstd as compression, which work fine until a backup did not finish. Now when starting the clean command, it fails with following error:

Traceback (most recent call last):
  File "/usr/local/bin/virt-backup", line 8, in <module>
    sys.exit(cli_run())
  File "/usr/local/lib/python3.9/dist-packages/virt_backup/__main__.py", line 27, in cli_run
    return parse_args_and_run(build_parser())
  File "/usr/local/lib/python3.9/dist-packages/virt_backup/__main__.py", line 151, in parse_args_and_run
    args.func(parsed_args=args)
  File "/usr/local/lib/python3.9/dist-packages/virt_backup/__main__.py", line 277, in clean_backups
    g.name or "Undefined", len(g.clean(**clean_params))
  File "/usr/local/lib/python3.9/dist-packages/virt_backup/groups/complete.py", line 238, in clean
    b.delete()
  File "/usr/local/lib/python3.9/dist-packages/virt_backup/backups/complete.py", line 177, in delete
    packager = self._get_write_packager()
  File "/usr/local/lib/python3.9/dist-packages/virt_backup/backups/complete.py", line 171, in _get_write_packager
    return super()._get_write_packager(self.name)
  File "/usr/local/lib/python3.9/dist-packages/virt_backup/backups/__init__.py", line 55, in _get_write_packager
    return getattr(WriteBackupPackagers, self.packager).value(**kwargs)
TypeError: __init__() got an unexpected keyword argument 'compression'

I assume that it has something to do with the JSON files (or the .pending files) as these have a the compression keyword in them, which normally isn't used with zstd.
This is a snippet from one of the JSON file, which did not finish:

    "packager": {
        "type": "zstd",
        "opts": {
            "compression": "zstd",
            "compression_lvl": 15
        }
    },

The finished ones look like this:

    "packager": {
        "type": "zstd",
        "opts": {
            "compression_lvl": 15
        }
    },
@aruhier
Copy link
Owner

aruhier commented Feb 18, 2024

Thanks for the bug report!
I tested, it is surprising as nothing outside of the tar packager sets the "compression" option. I tested on a hypervisor and I couldn't replicate this behavior.

However, I made the constructor of each packager more resilient to that, so even if a json contains some unexpected fields, they'll be ignored instead of failing.

@mikewzr
Copy link
Author

mikewzr commented Feb 18, 2024

Ya, don't know either. Especially, as the finished ones also don't have the "compression" option.

Anyway, thanks for the rapid resolution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants