mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-06 06:46:26 +01:00
99 lines
2.7 KiB
Plaintext
99 lines
2.7 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * virt/virtual_machines/vm_networking/virt-hot-plugging-network-interfaces.adoc
|
|
|
|
:_content-type: PROCEDURE
|
|
[id="virt-hot-plugging-bridge-network-interface_{context}"]
|
|
= Hot plugging a bridge network interface using the CLI
|
|
|
|
Hot plug a bridge network interface to a virtual machine (VM) while the VM is running.
|
|
|
|
.Prerequisites
|
|
|
|
* A network attachment definition is configured in the same namespace as your VM.
|
|
* You have installed the `virtctl` tool.
|
|
|
|
.Procedure
|
|
|
|
. If the VM to which you want to hot plug the network interface is not running, start it by using the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ virtctl start <vm_name>
|
|
----
|
|
|
|
. 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.
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ virtctl addinterface <vm_name> --network-attachment-definition-name <net_attach_def_name> --name <interface_name>
|
|
----
|
|
+
|
|
where:
|
|
|
|
<vm_name>:: Specifies the name of the `VirtualMachine` object.
|
|
<net_attach_def_name>:: Specifies the name of `NetworkAttachmentDefinition` object.
|
|
<interface_name>:: Specifies the name of the new network interface.
|
|
|
|
|
|
. To attach the network interface to the running VM, live migrate the VM by using the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ virtctl migrate <vm_name>
|
|
----
|
|
|
|
.Verification
|
|
|
|
. Verify that the VM live migration is successful by using the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get VirtualMachineInstanceMigration -w
|
|
----
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
NAME PHASE VMI
|
|
kubevirt-migrate-vm-lj62q Scheduling vm-fedora
|
|
kubevirt-migrate-vm-lj62q Scheduled vm-fedora
|
|
kubevirt-migrate-vm-lj62q PreparingTarget vm-fedora
|
|
kubevirt-migrate-vm-lj62q TargetReady vm-fedora
|
|
kubevirt-migrate-vm-lj62q Running vm-fedora
|
|
kubevirt-migrate-vm-lj62q Succeeded vm-fedora
|
|
----
|
|
|
|
. Verify that the new interface is added to the VM by checking the VMI status:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get vmi vm-fedora -ojsonpath="{ @.status.interfaces }"
|
|
----
|
|
+
|
|
.Example output
|
|
[source,json]
|
|
----
|
|
[
|
|
{
|
|
"infoSource": "domain, guest-agent",
|
|
"interfaceName": "eth0",
|
|
"ipAddress": "10.130.0.195",
|
|
"ipAddresses": [
|
|
"10.130.0.195",
|
|
"fd02:0:0:3::43c"
|
|
],
|
|
"mac": "52:54:00:0e:ab:25",
|
|
"name": "default",
|
|
"queueCount": 1
|
|
},
|
|
{
|
|
"infoSource": "domain, guest-agent, multus-status",
|
|
"interfaceName": "eth1",
|
|
"mac": "02:d8:b8:00:00:2a",
|
|
"name": "bridge-interface", <1>
|
|
"queueCount": 1
|
|
}
|
|
]
|
|
----
|
|
<1> The hot plugged interface appears in the VMI status. |