-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
persistent checkpoint storage #10
Conversation
changed checkpoint names to virtnbdbackup.0, .1 etc to simplify file sorting
hi, thanks, i will review at given time. Currently dumping and re-defining the checkpoint information is really the preferred solution if virtual machines are transient or move between hosts. I asked in #virt for that:
As side note: /var/lib/libvirt/qemu/checkpoint/ is the place where the checkpoint xml is saved. But as the last statement suggests, it only read once upon libvirtd startup, so syncing this folder between hosts wont help :( |
Nice, thanks
With transient domains /var/lib/libvirt/qemu/checkpoint/domain directory disappears immediately after domain shutdown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I'd prefer to explicitly define directory to store checkpoint configs (on DRBD storage for .qcow images and domain configs shared by all cluster nodes)
ok, makes sense. Currently its a quite specific setup and the checkpoint dir shouldnt be mandatory at the moment to allow for easier use of the utility.
If the functionality is merged, the save function needs to make sure the specified target directory for the checkpoints matches the virtual machine, otherwise one could overwrite existing checkpoint files. Also not sure what would happen if a user accidently specifies another checkpoint directory on the second backup run, or points to an already existing directory not unique...
Things can become messy then :)
I think it would make sense to put the checkpoint xml definition to the backup target directory, maybe in a subdirectory or something, because currently the tools saves information about existing checkpoints there too.
Thanks for your input!
@@ -59,6 59,9 @@ def main(): | |||
parser.add_argument( | |||
"-o", "--output", required=True, type=str, | |||
help="Output target directory") | |||
parser.add_argument( | |||
'-C', '--checkpointdir', required=True, type=str, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If backing up multiple virtual machines you need one checkpoint directory per virtual machine, bcs the checkpoint name is quite hardcoded now. Wouldnt it make sense to store the checkpoint xml in the same directory as the backup files then? Otherwise, maybe it makes sense to have the virtual machines name included in the checkpoint name, but that would break existing backup chains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If backing up multiple virtual machines you need one checkpoint directory per virtual machine,
Yes
bcs the checkpoint name is quite hardcoded now. Wouldnt it make sense to store the checkpoint xml in the same directory as the backup files then?
Let's consider scenario:
- Have full and incremental backups in directory /backup/domain.20210502
- Domain stopped and migrated to another host
- Want to make full backup to /backup/domain.20210503
We'll need to specify "previous backup directory" to access saved checkpoint configs
It is possible but will add unnecessary complexity to backup scripts using virtnbdbackup IMHO
Otherwise, maybe it makes sense to have the virtual machines name included in the checkpoint name, but that would break existing backup chains.
Oops forgot to mention I've assumed that checkpointdir
contains only one domain checkpoints, exactly "one checkpoint directory per virtual machine"
For example:
root@d02l:/backup/virtnbdbackup# virtnbdbackup -d vm-template -l inc -o /backup/vm-template.20210503 -C /var/lib/libvirt/images.drbd0/checkpoints/vm-template
2021-05-03 15:17:54 INFO common - printVersion: Version: 0.19 Arguments: /usr/local/bin/virtnbdbackup -d vm-template -l inc -o /backup/vm-template.20210503 -C /var/lib/libvirt/images.drbd0/checkpoints/vm-template
...
2021-05-03 15:17:55 INFO virtnbdbackup - main: Finished
root@d02l:/backup/virtnbdbackup# ls -l /var/lib/libvirt/images.drbd0/checkpoints/vm-template
total 36
-rw-r--r-- 1 root root 7843 May 3 12:42 virtnbdbackup.0.xml
-rw-r--r-- 1 root root 7899 May 3 12:43 virtnbdbackup.1.xml
-rw-r--r-- 1 root root 7899 May 3 15:17 virtnbdbackup.2.xml
root@d02l:/backup/virtnbdbackup#
with VM name already present in storage path, add one more VM name to checkpoint woud be a tautology
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Have full and incremental backups in directory /backup/domain.20210502
- Domain stopped and migrated to another host
- Want to make full backup to /backup/domain.20210503
We'll need to specify "previous backup directory" to access saved checkpoint configs
yes, thats true.. it needs to redefine the checkpoints if not existant so it can remove them correctly before the next full backup execution.. to have libvirt and qcow files correctly in sync.
Agree, going to make it optional
Hopefully libvirt will complain when redefining checkpoints, going to test it
What if:
|
sounds reasonable for me. Subfolder would be great in output dir.
i would leave the .cpt file in place at the moment, it prevents users beeing able to accidently write incremental backups to a folder where already backups of another virtual machine exist (see: #11) |
accidentally tested, libvirtd refused to redefine checkpoint with incorrect uuid: |
hi, i merged this with some changes. Its not mandatory now anymore, but the rest should work as expected. Also i added some documentation for it here: https://github.com/abbbi/virtnbdbackup#transient-virtual-machines-checkpoint-persistency |
Hello, |
in this situation, you have to use the "qemu-img" tool to show existant bitmaps and remove them from the qcow image. qemu-img info to list bitmaps in the qcow image and qemu-img bitmap --remove to remove them. |
Hi
After unsuccessful attempts to redefine checkpoints using names from
qemu-img info --force-share
I came up with the idea of "persistent checkpoins storage":This approach allows to use virtnbdbackup in Pacemaker (or similar) environments where domains are transient
Could also be used when moving .qcow2 image (and existing backups) to another host
Not heavily tested yet, but looks working for basic scenarios: full and incremental backup with existing (with checkpoints) and new (without checkpoints yet) domains