Backup rules for VMs
File-system consistent backups require you to freeze IO operations before backing up the volumes and unfreeze them after creation of backups. Portworx Backup internally creates and runs pre-exec/post-exec rules (freeze/thaw rules) for all the VMs before and after creating the VM backup.
If you want to take file-system consistent backups, here are the sample values for pod selector and action field to create pre-exec and post-exec rules. Freeze/thaw rules execute virt-freezer within the virt-launcher pod.
Refer Create Backup Rules to create pre-exec and post-exec rules for the VMs.
-
For Portworx Backup to execute the freeze/unfreeze (thaw) rule, both VM and
qemu-guest-agent
should be in running state. -
Portworx Backup comes with in-built or default pre-exec and post-exec rules. If you do not enable the custome rules option during creation of VM backup in the Portworx Backup web console, in-built rules get applied to your backups.
Pod Selector field can be fetched from virt-launcher pod.
Following illustration provides sample freeze and unfreeze rules for a VM:
Here is a sample value for Pod Selector and Action fields for pre-exec and post-exec rules:
-
Pre-exec rule value for freeze:
- Pod Selector:
vm.kubevirt.io/name: “<vm-name>”
- Action:
/usr/bin/virt-freezer --freeze --name <vm-name> --namespace <namespace>
- Container:
compute
- Pod Selector:
-
Post-exec rule value for unfreeze/thaw:
- Pod Selector:
vm.kubevirt.io/name: “<vm-name>”
- Action:
/usr/bin/virt-freezer --unfreeze --name <vm-name> --namespace <namespace>
- Container:
compute
- Pod Selector:
The action for freeze/unfreeze can be fetched by describing the virt-launcher pod of the VM.
For every VM that you want to back up, make sure there exists a pod-selector, action, and container specific to the VM in the pre-exec and post-exec rules.