Skip to content

Commit 23a590c

Browse files
authored
Merge pull request #71695 from openshift-cherrypick-robot/cherry-pick-71247-to-enterprise-4.15
[enterprise-4.15] CNV#30165: Updated hot plug NIC docs
2 parents 8320a22 + 2129a59 commit 23a590c

3 files changed

+81
-18
lines changed

modules/virt-hot-plugging-bridge-network-interface-cli.adoc

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44

55
:_mod-docs-content-type: PROCEDURE
66
[id="virt-hot-plugging-bridge-network-interface_{context}"]
7-
= Hot plugging a bridge network interface using the CLI
7+
= Hot plugging a secondary network interface by using the CLI
88

9-
Hot plug a bridge network interface to a virtual machine (VM) while the VM is running.
9+
Hot plug a secondary network interface to a virtual machine (VM) while the VM is running.
1010

1111
.Prerequisites
1212

1313
* A network attachment definition is configured in the same namespace as your VM.
1414
* You have installed the `virtctl` tool.
15+
* You have installed the OpenShift CLI (`oc`).
1516
1617
.Procedure
1718

@@ -22,21 +23,45 @@ Hot plug a bridge network interface to a virtual machine (VM) while the VM is ru
2223
$ virtctl start <vm_name>
2324
----
2425

25-
. Use the following command to hot plug a new network interface to the running VM. The `virtctl addinterface` command adds the new network interface to the VM and virtual machine instance (VMI) specification but does not attach it to the running VM.
26+
. Use the following command to add the new network interface to the running VM. Editing the VM specification adds the new network interface to the VM and virtual machine instance (VMI) configuration but does not attach it to the running VM.
2627
+
2728
[source,terminal]
2829
----
29-
$ virtctl addinterface <vm_name> --network-attachment-definition-name <net_attach_def_name> --name <interface_name>
30+
$ oc edit vm <vm_name>
3031
----
3132
+
32-
where:
33-
34-
<vm_name>:: Specifies the name of the `VirtualMachine` object.
35-
<net_attach_def_name>:: Specifies the name of `NetworkAttachmentDefinition` object.
36-
<interface_name>:: Specifies the name of the new network interface.
33+
.Example VM configuration
34+
[source,yaml]
35+
----
36+
apiVersion: kubevirt.io/v1
37+
kind: VirtualMachine
38+
metadata:
39+
name: vm-fedora
40+
template:
41+
spec:
42+
domain:
43+
devices:
44+
interfaces:
45+
- name: defaultnetwork
46+
masquerade: {}
47+
# new interface
48+
- name: <secondary_nic> # <1>
49+
bridge: {}
50+
networks:
51+
- name: defaultnetwork
52+
pod: {}
53+
# new network
54+
- name: <secondary_nic> # <2>
55+
multus:
56+
networkName: <nad_name> # <3>
57+
# ...
58+
----
59+
<1> Specifies the name of the new network interface.
60+
<2> Specifies the name of the network. This must be the same as the `name` of the new network interface that you defined in the `template.spec.domain.devices.interfaces` list.
61+
<3> Specifies the name of the `NetworkAttachmentDefinition` object.
3762

3863

39-
. To attach the network interface to the running VM, live migrate the VM by using the following command:
64+
. To attach the network interface to the running VM, live migrate the VM by running the following command:
4065
+
4166
[source,terminal]
4267
----

modules/virt-hot-unplugging-bridge-network-interface-cli.adoc

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44

55
:_mod-docs-content-type: PROCEDURE
66
[id="virt-hot-unplugging-bridge-network-interface_{context}"]
7-
= Hot unplugging a bridge network interface using the CLI
7+
= Hot unplugging a secondary network interface by using the CLI
88

9-
You can remove a bridge network interface from a running virtual machine (VM).
9+
You can remove a secondary network interface from a running virtual machine (VM).
10+
11+
[NOTE]
12+
====
13+
Hot unplugging is not supported for Single Root I/O Virtualization (SR-IOV) interfaces.
14+
====
1015

1116
.Prerequisites
1217

@@ -16,12 +21,40 @@ You can remove a bridge network interface from a running virtual machine (VM).
1621
1722
.Procedure
1823

19-
. Hot unplug a bridge network interface by running the following command. The `virtctl removeinterface` command detaches the network interface from the guest, but the interface still exists in the pod.
24+
. Edit the VM specification to hot unplug a secondary network interface. Setting the interface state to `absent` detaches the network interface from the guest, but the interface still exists in the pod.
2025
+
2126
[source,terminal]
2227
----
23-
$ virtctl removeinterface <vm_name> --name <interface_name>
28+
$ oc edit vm <vm_name>
29+
----
30+
+
31+
.Example VM configuration
32+
[source,yaml]
33+
----
34+
apiVersion: kubevirt.io/v1
35+
kind: VirtualMachine
36+
metadata:
37+
name: vm-fedora
38+
template:
39+
spec:
40+
domain:
41+
devices:
42+
interfaces:
43+
- name: defaultnetwork
44+
masquerade: {}
45+
# set the interface state to absent
46+
- name: <secondary_nic>
47+
state: absent # <1>
48+
bridge: {}
49+
networks:
50+
- name: defaultnetwork
51+
pod: {}
52+
- name: <secondary_nic>
53+
multus:
54+
networkName: <nad_name>
55+
# ...
2456
----
57+
<1> Set the interface state to `absent` to detach it from the running VM. Removing the interface details from the VM specification does not hot unplug the secondary network interface.
2558

2659
. Remove the interface from the pod by migrating the VM:
2760
+

virt/vm_networking/virt-hot-plugging-network-interfaces.adoc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ include::_attributes/common-attributes.adoc[]
66

77
toc::[]
88

9-
You can add or remove secondary network interfaces without stopping your virtual machine (VM). {VirtProductName} supports hot plugging and hot unplugging for Linux bridge interfaces that use the VirtIO device driver.
9+
You can add or remove secondary network interfaces without stopping your virtual machine (VM). {VirtProductName} supports hot plugging for secondary interfaces that use the VirtIO device driver.
1010

11-
:FeatureName: Hot plugging and hot unplugging bridge network interfaces
12-
include::snippets/technology-preview.adoc[]
11+
[NOTE]
12+
====
13+
Hot unplugging is not supported for Single Root I/O Virtualization (SR-IOV) interfaces.
14+
====
1315

1416
[id="virtio-limitations_virt-hot-plugging-network-interfaces"]
1517
== VirtIO limitations
@@ -31,4 +33,7 @@ include::modules/virt-hot-unplugging-bridge-network-interface-cli.adoc[leveloffs
3133
== Additional resources
3234

3335
* xref:../../virt/getting_started/virt-using-the-cli-tools.adoc#installing-virtctl_virt-using-the-cli-tools[Installing virtctl]
34-
* xref:../../virt/vm_networking/virt-connecting-vm-to-linux-bridge.adoc#creating-linux-bridge-nad[Creating a Linux bridge network attachment definition]
36+
* xref:../../virt/vm_networking/virt-connecting-vm-to-linux-bridge.adoc#creating-linux-bridge-nad[Creating a Linux bridge network attachment definition]
37+
* xref:../../virt/vm_networking/virt-connecting-vm-to-linux-bridge.adoc#configuring-vm-network-interface[Connecting a virtual machine to a Linux bridge network]
38+
* xref:../../virt/vm_networking/virt-connecting-vm-to-sriov.adoc#nw-sriov-network-attachment_virt-connecting-vm-to-sriov[Creating an SR-IOV network attachment definition]
39+
* xref:../../virt/vm_networking/virt-connecting-vm-to-sriov.adoc#virt-attaching-vm-to-sriov-network_virt-connecting-vm-to-sriov[Connecting a virtual machine to an SR-IOV network]

0 commit comments

Comments
 (0)