Protecting OpenShift Virtualization VMs

OpenShift Virtualization is an add-on to the OpenShift Container Platform that allows the creation and execution of Virtual Machine workloads alongside container workloads. Once installed on the OpenShift Container Platform, OpenShift Virtualization introduces some custom resources that can be used to manage Virtual Machine workloads. Read the official documentation to learn more about OpenShift Virtualization.

Virtual Machines as Workloads in K10

If OpenShift Virtualization is enabled in the OpenShift cluster and there are some Virtual Machines created, K10 will automatically discover those Virtual Machines and treat them as workloads.

../_images/vm-as-workload.png

Backup the Virtual Machines

Since K10 can discover the Virtual Machines running on the cluster and treat them as workloads, they can be easily backed up like any other application. To protect a Virtual Machine present in a namespace, a policy should be created and run for that namespace.

Note

Only the Virtual Machines that are either in Running or Stopped state can be snapshotted.

If there is a need to freeze the guest filesystem of the Virtual Machine before backing up the disks, K10 can be instructed to freeze/thaw the guest filesystem before and after the disk snapshots by annotating the virtual machine with a specific annotation before running the policy.

The Virtual Machine resource can be annotated using the command below.

kubectl annotate virtualmachine -n <namespace> <virtualmachine-name> k10.kasten.io/freezeVM=true

After annotating the Virtual Machine, if the policy that protects this application is run, the Virtual Machine will be frozen before a snapshot is taken and unfrozen after the snapshot has been taken.

The Virtual Machine freeze and unfreeze operations will only be attempted if the Virtual Machine is in Running state

If it's not acceptable to have the Virtual Machine's guest filesystem frozen for the time that creating the snapshot takes, K10 can be instructed to abort the snapshot operation and unfreeze the Virtual Machine. The helm flag below can be used to specify the maximum time duration that is allowed for K10 to take snapshots of the Virtual Machine's volumes.

helm install ... --set kubeVirtVMs.snapshot.unfreezeTimeout="3m"

If this field is not specified, it defaults to 5 minutes. The format of how this value can be written is documented here.

Note

If there is more than one Virtual Machines to protect, all of them must be annotated with the same annotation mentioned above.

Restore the Virtual Machines

The process of restoring backed-up Virtual Machines is similar to restoring any other application using K10 dashboard. Restoring Applications can be followed for the detailed steps.

Note

Partial Restore of Virtual Machines is not supported in a namespace that already contains the same Virtual Machine or its related resources. To perform a partial restore in-place, remove the existing VM and its resources first.