Skip to content

Commit 68384f8

Browse files
author
Audrey Spaulding
committed
delete protection assembly
1 parent 6a8ce59 commit 68384f8

File tree

4 files changed

+88
-0
lines changed

4 files changed

+88
-0
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4616,6 +4616,8 @@ Topics:
46164616
File: virt-edit-boot-order
46174617
- Name: Deleting virtual machines
46184618
File: virt-delete-vms
4619+
- Name: Enabling or disabling virtual machine delete protection
4620+
File: virt-enabling-disabling-vm-delete-protection
46194621
- Name: Exporting virtual machines
46204622
File: virt-exporting-vms
46214623
- Name: Managing virtual machine instances
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/managing-vms/virt-enabling-disabling-vm-delete-protection.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="virt-enabling-disabling-vm-delete-protection-cli_{context}"]
7+
8+
= Enabling or disabling virtual machine delete protection by using the command line
9+
10+
To prevent the inadvertent deletion of a virtual machine, you can enable virtual machine delete protection by using the command line.
11+
12+
.Prerequisites
13+
14+
* You have installed {VirtProductName} 4.19 or later.
15+
* You have installed the OpenShift CLI (`oc`).
16+
17+
.Procedure
18+
19+
* Enable delete protection for a VM by running the following command:
20+
21+
[source,terminal]
22+
----
23+
$ oc patch vm <vm-name> --type merge -p '{"metadata":{"labels":{"kubevirt.io/vm-delete-protection":"True"}}}' -n <namespace>
24+
----
25+
26+
* Disable delete protection for a VM by running the following command:
27+
[source,terminal]
28+
----
29+
$ oc patch vm <vm-name> --type json -p '[{"op": "remove", "path": "/metadata/labels/kubevirt.io~1vm-delete-protection"}]' -n <namespace>
30+
----
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/managing-vms/virt-enabling-disabling-vm-delete-protection.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="virt-enabling-disabling-vm-delete-protection-web_{context}"]
7+
8+
= Enabling or disabling virtual machine delete protection by using the web console
9+
10+
To prevent the inadvertent deletion of a virtual machine, you can enable virtual machine delete protection by using the {product-title} web console.
11+
12+
.Prerequisites
13+
14+
* You have installed {VirtProductName} 4.19 or later.
15+
* You have installed the OpenShift CLI (`oc`).
16+
17+
.Procedure
18+
19+
. From the {product-title} web console, choose your view:
20+
21+
* For a virtualization-focused view, select *Administrator* → *Virtualization* → *VirtualMachines*.
22+
23+
* For a general view, navigate to *Virtualization* → *VirtualMachines*.
24+
25+
. From the *VirtualMachines* list, select the VM whose delete protection you want to enable or disable.
26+
27+
. Click the *Configuration* tab.
28+
29+
. In the *VirtualMachines details*, choose to enable or disable the protection as follows:
30+
31+
* To enable the protection:
32+
.. Set the *Deletion protection* switch to *On*.
33+
.. Click *Enable* to confirm the protection.
34+
35+
* To disable the protection:
36+
.. Set the *Deletion protection* switch to *Off*.
37+
.. Click *Disable* to confirm the protection.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
:_mod-docs-content-type: ASSEMBLY
2+
[id="virt-enabling-disabling-vm-delete-protection"]
3+
= Enabling or disabling virtual machine delete protection
4+
include::_attributes/common-attributes.adoc[]
5+
:context: virt-enabling-disabling-vm-delete-protection
6+
7+
toc::[]
8+
9+
You can prevent the inadvertent deletion of a virtual machine (VM) by enabling delete protection. You can also disable delete protection.
10+
11+
You enable or disable delete protection from either the {product-title} web console or the command line.
12+
13+
.Prerequisites
14+
15+
* You have installed {VirtProductName} 4.19 or later.
16+
* You have installed the OpenShift CLI (`oc`).
17+
18+
include::modules/virt-enabling-disabling-vm-delete-protection-web.adoc[leveloffset=+1]
19+
include::modules/virt-enabling-disabling-vm-delete-protection-cli.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)