Skip to content

Commit 16543f9

Browse files
committed
CNV-69410: Customizing VM MAC pool range
1 parent 107ff97 commit 16543f9

File tree

2 files changed

+82
-2
lines changed

2 files changed

+82
-2
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/vm_networking/virt-using-mac-address-pool-for-vms.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="virt-custom-kubemacpool-range_{context}"]
7+
= Customizing the MAC pool range
8+
9+
[role="_abstract"]
10+
KubeMacPool works by allocating MAC addresses to VMs from a range. The `rangeStart` and `rangeEnd` parameters in the `HyperConverged` custom resource (CR) define the MAC pool range.
11+
12+
As a cluster administrator, you can configure this range to ensure that MAC addresses for VMs hosted on {VirtProductName} do not conflict with other virtualization solutions on the same network.
13+
14+
.Prerequisites
15+
16+
* You have cluster administrator access on an {product-title} cluster.
17+
* You have installed the {oc-first}.
18+
19+
.Procedure
20+
21+
. Edit the `HyperConverged` CR by running the following command:
22+
+
23+
[source,terminal,subs="attributes+"]
24+
----
25+
$ oc edit hyperconverged kubevirt-hyperconverged -n {CNVNamespace}
26+
----
27+
28+
. Update the `HyperConverged` CR to configure the `rangeStart` and `rangeEnd` parameters that define your required MAC address range:
29+
+
30+
[source,yaml]
31+
----
32+
apiVersion: hco.kubevirt.io/v1beta1
33+
kind: HyperConverged
34+
metadata:
35+
name: kubevirt-hyperconverged
36+
spec:
37+
kubeMacPoolConfiguration:
38+
rangeStart: "AA:00:00:00:00:00"
39+
rangeEnd: "FD:FF:FF:FF:FF:FF"
40+
# ...
41+
----
42+
43+
.Verification
44+
45+
. Run the following command and observe the output:
46+
+
47+
[source,terminal,subs="attributes+"]
48+
----
49+
$ oc get hco kubevirt-hyperconverged -n {CNVNamespace} -o=jsonpath='{.spec.kubeMacPoolConfiguration}'
50+
----
51+
+
52+
If you have successfully applied the configuration changes, the output shows the new MAC pool range you have configured:
53+
+
54+
Example output:
55+
+
56+
[source,terminal]
57+
----
58+
{
59+
"rangeStart": "AA:00:00:00:00:00",
60+
"rangeEnd": "FD:FF:FF:FF:FF:FF"
61+
}
62+
----
63+
64+
. Optional. Create a new VM and run the following command to check the MAC address of the VM's network interface:
65+
+
66+
[source,terminal]
67+
----
68+
$ oc get vmi <vm-name> -o=jsonpath='{.status.interfaces[0].macAddress}'
69+
----
70+
+
71+
Example output:
72+
+
73+
[source,yaml]
74+
----
75+
macAddress: AA:00:00:00:00:04
76+
----
77+
+
78+
If you have successfully applied the configuration changes, the `macAddress` field in the VM interface is within the range you specified in your `kubeMacPoolConfiguration`, between the value of `rangeStart` and `rangeEnd`.

virt/vm_networking/virt-using-mac-address-pool-for-vms.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
:_mod-docs-content-type: ASSEMBLY
2+
include::_attributes/common-attributes.adoc[]
23
[id="virt-using-mac-address-pool-for-vms"]
34
= Managing MAC address pools for network interfaces
4-
include::_attributes/common-attributes.adoc[]
55
:context: virt-using-mac-address-pool-for-vms
66

77
toc::[]
88

9-
The _KubeMacPool_ component allocates MAC addresses for virtual machine (VM) network interfaces from a shared MAC address pool. This ensures that each network interface is assigned a unique MAC address.
9+
[role="_abstract"]
10+
KubeMacPool allocates MAC addresses for virtual machine (VM) network interfaces from a shared MAC address pool. This ensures that each network interface is assigned a unique MAC address.
1011

1112
A virtual machine instance created from that VM retains the assigned MAC address across reboots.
1213

@@ -17,3 +18,4 @@ KubeMacPool does not handle virtual machine instances created independently from
1718

1819
include::modules/virt-managing-kubemacpool-cli.adoc[leveloffset=+1]
1920

21+
include::modules/virt-custom-kubemacpool-range.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)