mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 21:46:22 +01:00
Merge pull request #92987 from openshift-cherrypick-robot/cherry-pick-91883-to-enterprise-4.19
[enterprise-4.19] CNV-52859: Configuring VM interface link state
This commit is contained in:
@@ -4771,6 +4771,8 @@ Topics:
|
||||
File: virt-connecting-vm-to-ovn-secondary-network
|
||||
- Name: Hot plugging secondary network interfaces
|
||||
File: virt-hot-plugging-network-interfaces
|
||||
- Name: Setting VM interface link state
|
||||
File: virt-setting-interface-link-state
|
||||
- Name: Connecting a VM to a service mesh
|
||||
File: virt-connecting-vm-to-service-mesh
|
||||
- Name: Configuring a dedicated network for live migration
|
||||
|
||||
87
modules/virt-configuring-interface-link-state.adoc
Normal file
87
modules/virt-configuring-interface-link-state.adoc
Normal file
@@ -0,0 +1,87 @@
|
||||
// Module included in the following assemblies:
|
||||
//
|
||||
// * virt/vm_networking/virt-setting-interface-link-state.adoc
|
||||
|
||||
:_mod-docs-content-type: PROCEDURE
|
||||
[id="virt-configuring-interface-link-state_{context}"]
|
||||
= Setting the VM interface link state by using the CLI
|
||||
|
||||
You can set the link state of a primary or secondary virtual machine (VM) network interface by using the CLI.
|
||||
|
||||
.Prerequisites
|
||||
* You have installed the OpenShift CLI (`oc`).
|
||||
|
||||
|
||||
.Procedure
|
||||
. Edit the VM configuration to set the interface link state, as in the following example:
|
||||
+
|
||||
[source,yaml]
|
||||
----
|
||||
apiVersion: kubevirt.io/v1
|
||||
kind: VirtualMachine
|
||||
metadata:
|
||||
name: my-vm
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
domain:
|
||||
devices:
|
||||
interfaces:
|
||||
- name: default # <1>
|
||||
state: down # <2>
|
||||
masquerade: { }
|
||||
networks:
|
||||
- name: default
|
||||
pod: { }
|
||||
# ...
|
||||
----
|
||||
<1> The name of the interface.
|
||||
<2> The state of the interface. The possible values are:
|
||||
+
|
||||
* `up`: Represents an active network connection. This is the default if no value is specified.
|
||||
* `down`: Represents a network interface link that is switched off.
|
||||
* `absent`: Represents a network interface that is hot unplugged.
|
||||
+
|
||||
[IMPORTANT]
|
||||
====
|
||||
If you have defined readiness or liveness probes to run VM health checks, setting the primary interface's link state to `down` causes the probes to fail. If a liveness probe fails, the VM is deleted and a new VM is created to restore responsiveness.
|
||||
====
|
||||
|
||||
. Apply the `VirtualMachine` manifest:
|
||||
+
|
||||
[source,terminal]
|
||||
----
|
||||
$ oc apply -f <filename>.yaml
|
||||
----
|
||||
|
||||
.Verification
|
||||
* Verify that the desired link state is set by checking the `status.interfaces.linkState` field of the `VirtualMachineInstance` manifest.
|
||||
+
|
||||
[source,terminal]
|
||||
----
|
||||
$ oc get vmi <vmi-name>
|
||||
----
|
||||
+
|
||||
.Example output
|
||||
[source,yaml]
|
||||
----
|
||||
apiVersion: kubevirt.io/v1
|
||||
kind: VirtualMachineInstance
|
||||
metadata:
|
||||
name: my-vm
|
||||
spec:
|
||||
domain:
|
||||
devices:
|
||||
interfaces:
|
||||
- name: default
|
||||
state: down
|
||||
masquerade: { }
|
||||
networks:
|
||||
- name: default
|
||||
pod: { }
|
||||
status:
|
||||
interfaces:
|
||||
- name: default
|
||||
linkState: down
|
||||
# ...
|
||||
----
|
||||
22
virt/vm_networking/virt-setting-interface-link-state.adoc
Normal file
22
virt/vm_networking/virt-setting-interface-link-state.adoc
Normal file
@@ -0,0 +1,22 @@
|
||||
:_mod-docs-content-type: ASSEMBLY
|
||||
[id="virt-setting-interface-link-state"]
|
||||
= Managing the link state of a virtual machine interface
|
||||
include::_attributes/common-attributes.adoc[]
|
||||
:context: virt-setting-interface-link-state
|
||||
|
||||
toc::[]
|
||||
|
||||
You can manage the link state of a primary or secondary virtual machine (VM) interface by using the CLI. By specifying the link state, you can logically connect or disconnect the virtual network interface controller (vNIC) from a network.
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
{VirtProductName} does not support link state management for Single Root I/O Virtualization (SR-IOV) secondary network interfaces and their link states are not reported.
|
||||
====
|
||||
|
||||
You can specify the desired link state when you first create a VM, by editing the configuration of an existing VM that is stopped or running, or when you hot plug a new network interface to a running VM. If you edit a running VM, you do not need to restart or migrate the VM for the changes to be applied. The current link state of a VM interface is reported in the `status.interfaces.linkState` field of the `VirtualMachineInstance` manifest.
|
||||
|
||||
:FeatureName: Setting the VM interface link state
|
||||
include::snippets/technology-preview.adoc[]
|
||||
|
||||
include::modules/virt-configuring-interface-link-state.adoc[leveloffset=+1]
|
||||
|
||||
Reference in New Issue
Block a user