1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/virt-hot-unplugging-bridge-network-interface-cli.adoc
2025-07-31 21:22:49 +00:00

67 lines
2.0 KiB
Plaintext

// Module included in the following assemblies:
//
// * virt/virtual_machines/vm_networking/virt-hot-plugging-network-interfaces.adoc
:_mod-docs-content-type: PROCEDURE
[id="virt-hot-unplugging-bridge-network-interface_{context}"]
= Hot unplugging a secondary network interface by using the CLI
You can remove a secondary network interface from a running virtual machine (VM).
[NOTE]
====
Hot unplugging is not supported for Single Root I/O Virtualization (SR-IOV) interfaces.
====
.Prerequisites
* Your VM must be running.
* The VM must be created on a cluster running {VirtProductName} 4.14 or later.
* The VM must have a bridge network interface attached.
* You have installed the {oc-first}.
.Procedure
. Using your preferred text editor, edit the `VirtualMachine` manifest file and set the interface state to `absent`. Setting the interface state to `absent` detaches the network interface from the guest, but the interface still exists in the pod.
+
.Example VM configuration
[source,yaml]
----
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: vm-fedora
template:
spec:
domain:
devices:
interfaces:
- name: defaultnetwork
masquerade: {}
# set the interface state to absent
- name: <secondary_nic>
state: absent # <1>
bridge: {}
networks:
- name: defaultnetwork
pod: {}
- name: <secondary_nic>
multus:
networkName: <nad_name>
# ...
----
<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.
. Save your changes and exit the editor.
. For the new configuration to take effect, apply the changes by running the following command. Applying the changes triggers automatic VM live migration and removes the interface from the pod.
+
[source,terminal]
----
$ oc apply -f <filename>.yaml
----
+
where:
<filename>:: Specifies the name of your `VirtualMachine` manifest YAML file.