10.11.3. Hot unplugging a secondary network interface by using the CLI
You can remove a secondary network interface from a running virtual machine (VM).
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 OpenShift Virtualization 4.14 or later.
- The VM must have a bridge network interface attached.
-
You have permission to create and list
VirtualMachineInstanceMigrationobjects. -
You have installed the OpenShift CLI (
oc).
Procedure
Edit the VM specification to hot unplug a secondary network interface. Setting the interface state to
absentdetaches the network interface from the guest, but the interface still exists in the pod.$ oc edit vm <vm_name>Example VM configuration
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 bridge: {} networks: - name: defaultnetwork pod: {} - name: <secondary_nic> multus: networkName: <nad_name> # ...Set the interface state to
absentto detach it from the running VM. Removing the interface details from the VM specification does not hot unplug the secondary network interface.Remove the interface from the pod by migrating the VM:
$ virtctl migrate <vm_name>