1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00

Merge pull request #87425 from openshift-cherrypick-robot/cherry-pick-86693-to-enterprise-4.18

[enterprise-4.18] OADP backup-restore single VM
This commit is contained in:
Jason Βoxman
2025-01-22 12:15:21 -05:00
committed by GitHub
4 changed files with 151 additions and 0 deletions

View File

@@ -44,6 +44,9 @@ include::modules/install-and-configure-oadp-kubevirt.adoc[leveloffset=+1]
include::modules/oadp-installing-dpa-1-3.adoc[leveloffset=+1]
include::snippets/oadp-windows-vm-backup-fails.adoc[]
include::modules/oadp-backup-single-vm.adoc[leveloffset=+1]
include::modules/oadp-restore-single-vm.adoc[leveloffset=+1]
include::modules/oadp-restore-single-vm-from-multiple-vm-backup.adoc[leveloffset=+1]
include::modules/oadp-configuring-client-burst-qps.adoc[leveloffset=+1]
include::modules/oadp-configuring-node-agents.adoc[leveloffset=+2]
include::modules/oadp-incremental-backup-support.adoc[leveloffset=+1]

View File

@@ -0,0 +1,51 @@
// Module included in the following assemblies:
//
// * backup_and_restore/application_backup_and_restore/installing/installing-oadp-kubevirt.adoc
:_mod-docs-content-type: PROCEDURE
[id="oadp-backup-single-vm_{context}"]
= Backing up a single VM
If you have a namespace with multiple virtual machines (VMs), and want to back up only one of them, you can use the label selector to filter the VM that needs to be included in the backup. You can filter the VM by using the `app: vmname` label.
.Prerequisites
* You have installed the {oadp-short} Operator.
* You have multiple VMs running in a namespace.
* You have added the `kubevirt` plugin in the `DataProtectionApplication` (DPA) custom resource (CR).
* You have configured the `BackupStorageLocation` CR in the `DataProtectionApplication` CR and `BackupStorageLocation` is available.
.Procedure
. Configure the `Backup` CR as shown in the following example:
+
.Example `Backup` CR
[source,yaml]
----
apiVersion: velero.io/v1
kind: Backup
metadata:
name: vmbackupsingle
namespace: openshift-adp
spec:
snapshotMoveData: true
includedNamespaces:
- <vm_namespace> # <1>
labelSelector:
matchLabels:
app: <vm_app_name> # <2>
storageLocation: <backup_storage_location_name> # <3>
----
<1> Specify the name of the namespace where you have created the VMs.
<2> Specify the VM name that needs to be backed up.
<3> Specify the name of the `BackupStorageLocation` CR.
. To create a `Backup` CR, run the following command:
+
[source, terminal]
----
$ oc apply -f <backup_cr_file_name> # <1>
----
<1> Specify the name of the `Backup` CR file.

View File

@@ -0,0 +1,56 @@
// Module included in the following assemblies:
//
// * backup_and_restore/application_backup_and_restore/installing/installing-oadp-kubevirt.adoc
:_mod-docs-content-type: PROCEDURE
[id="oadp-restore-single-vm-from-multiple-vm-backup_{context}"]
= Restoring a single VM from a backup of multiple VMs
If you have a backup containing multiple virtual machines (VMs), and you want to restore only one VM, you can use the `LabelSelectors` section in the `Restore` CR to select the VM to restore. To ensure that the persistent volume claim (PVC) attached to the VM is correctly restored, and the restored VM is not stuck in a `Provisioning` status, use both the `app: <vm_name>` and the `kubevirt.io/created-by` labels. To match the `kubevirt.io/created-by` label, use the UID of `DataVolume` of the VM.
.Prerequisites
* You have installed the {oadp-short} Operator.
* You have labeled the VMs that need to be backed up.
* You have a backup of multiple VMs.
.Procedure
. Before you take a backup of many VMs, ensure that the VMs are labeled by running the following command:
+
[source, terminal]
----
$ oc label vm <vm_name> app=<vm_name> -n openshift-adp
----
. Configure the label selectors in the `Restore` CR as shown in the following example:
+
.Example `Restore` CR
[source,yaml]
----
apiVersion: velero.io/v1
kind: Restore
metadata:
name: singlevmrestore
namespace: openshift-adp
spec:
backupName: multiplevmbackup
restorePVs: true
LabelSelectors:
- matchLabels:
kubevirt.io/created-by: <datavolume_uid> # <1>
- matchLabels:
app: <vm_name> # <2>
----
<1> Specify the UID of `DataVolume` of the VM that you want to restore. For example, `b6...53a-ddd7-4d9d-9407-a0c...e5`.
<2> Specify the name of the VM that you want to restore. For example, `test-vm`.
. To restore a VM, run the following command:
+
[source, terminal]
----
$ oc apply -f <restore_cr_file_name> # <1>
----
<1> Specify the name of the `Restore` CR file.

View File

@@ -0,0 +1,41 @@
// Module included in the following assemblies:
//
// * backup_and_restore/application_backup_and_restore/installing/installing-oadp-kubevirt.adoc
:_mod-docs-content-type: PROCEDURE
[id="oadp-restore-single-vm_{context}"]
= Restoring a single VM
After you have backed up a single virtual machine (VM) by using the label selector in the `Backup` custom resource (CR), you can create a `Restore` CR and point it to the backup. This restore operation restores a single VM.
.Prerequisites
* You have installed the {oadp-short} Operator.
* You have backed up a single VM by using the label selector.
.Procedure
. Configure the `Restore` CR as shown in the following example:
+
.Example `Restore` CR
[source,yaml]
----
apiVersion: velero.io/v1
kind: Restore
metadata:
name: vmrestoresingle
namespace: openshift-adp
spec:
backupName: vmbackupsingle # <1>
restorePVs: true
----
<1> Specifies the name of the backup of a single VM.
. To restore the single VM, run the following command:
+
[source, terminal]
----
$ oc apply -f <restore_cr_file_name> # <1>
----
<1> Specify the name of the `Restore` CR file.