Skip to content

Commit 9878e2d

Browse files
Guest OS Imagescopybara-github
authored andcommitted
networkconfig: support switching config expectations on kernel version
* Add `guest_os_selector` with `min_kernel_version` and `max_kernel_version` to `SystemConfig` in `config_expectations.proto` to allow switching expectations based on the kernel version of the VM under test. * Update `expectedConfigForMachine` to compare the VM's kernel version against any specified inclusive minimum and maximum kernel version bounds. * Add an expectation for `n2-highcpu-32` with single GVNIC on kernels >= 6.17 where the GVE driver includes NUMA-locality awareness in default IRQ affinity assignment. PiperOrigin-RevId: 954709834
1 parent d6e8416 commit 9878e2d

7 files changed

Lines changed: 373 additions & 43 deletions

File tree

test_suites/networkconfig/config_expectations/config_expectations.proto

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ message ConfigExpectations {
2525
repeated SystemConfig config_expectations = 1;
2626
}
2727

28+
message GuestOsSelector {
29+
// The minimum kernel version (inclusive) required for this expectation to
30+
// apply, e.g. "6.8.0" or "6.8".
31+
string min_kernel_version = 1;
32+
33+
// The maximum kernel version (inclusive) required for this expectation to
34+
// apply, e.g. "6.8.0" or "6.8".
35+
string max_kernel_version = 2;
36+
}
37+
2838
// Configuration for a particular variant of a machine.
2939
// Keyed on machine type and NIC types.
3040
message SystemConfig {
@@ -35,6 +45,9 @@ message SystemConfig {
3545
// The GCE machine type e.g. "n2d-standard-2".
3646
string machine_type = 2;
3747

48+
// Criteria for matching properties of the VM's guest OS.
49+
GuestOsSelector guest_os_selector = 3;
50+
3851
// NICs in the VM. This includes any device expected to be created by the
3952
// GCE stack, but not any created by the user (e.g. not `lo` or `docker0`).
4053
repeated NicExpectation nics = 4;

test_suites/networkconfig/config_expectations/config_expectations.textproto

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,53 @@ config_expectations: {
630630
}
631631
}
632632
config_expectations: {
633-
description: "n2-32 with single GVNIC"
633+
description: "n2-32 with single GVNIC (with GVE NUMA locality awareness)"
634634
machine_type: "n2-highcpu-32"
635+
guest_os_selector: {
636+
min_kernel_version: "6.17"
637+
}
638+
nics: {
639+
type: "GVNIC"
640+
tx_queues: { index: 0 irq_cpulist: "0" xps_cpulist: "0" }
641+
tx_queues: { index: 1 irq_cpulist: "1" xps_cpulist: "1" }
642+
tx_queues: { index: 2 irq_cpulist: "2" xps_cpulist: "2" }
643+
tx_queues: { index: 3 irq_cpulist: "3" xps_cpulist: "3" }
644+
tx_queues: { index: 4 irq_cpulist: "4" xps_cpulist: "4" }
645+
tx_queues: { index: 5 irq_cpulist: "5" xps_cpulist: "5" }
646+
tx_queues: { index: 6 irq_cpulist: "6" xps_cpulist: "6" }
647+
tx_queues: { index: 7 irq_cpulist: "7" xps_cpulist: "7" }
648+
tx_queues: { index: 8 irq_cpulist: "16" xps_cpulist: "8" }
649+
tx_queues: { index: 9 irq_cpulist: "17" xps_cpulist: "9" }
650+
tx_queues: { index: 10 irq_cpulist: "18" xps_cpulist: "10" }
651+
tx_queues: { index: 11 irq_cpulist: "19" xps_cpulist: "11" }
652+
tx_queues: { index: 12 irq_cpulist: "20" xps_cpulist: "12" }
653+
tx_queues: { index: 13 irq_cpulist: "21" xps_cpulist: "13" }
654+
tx_queues: { index: 14 irq_cpulist: "22" xps_cpulist: "14" }
655+
tx_queues: { index: 15 irq_cpulist: "23" xps_cpulist: "15" }
656+
rx_queues: { index: 0 irq_cpulist: "0" }
657+
rx_queues: { index: 1 irq_cpulist: "1" }
658+
rx_queues: { index: 2 irq_cpulist: "2" }
659+
rx_queues: { index: 3 irq_cpulist: "3" }
660+
rx_queues: { index: 4 irq_cpulist: "4" }
661+
rx_queues: { index: 5 irq_cpulist: "5" }
662+
rx_queues: { index: 6 irq_cpulist: "6" }
663+
rx_queues: { index: 7 irq_cpulist: "7" }
664+
rx_queues: { index: 8 irq_cpulist: "16" }
665+
rx_queues: { index: 9 irq_cpulist: "17" }
666+
rx_queues: { index: 10 irq_cpulist: "18" }
667+
rx_queues: { index: 11 irq_cpulist: "19" }
668+
rx_queues: { index: 12 irq_cpulist: "20" }
669+
rx_queues: { index: 13 irq_cpulist: "21" }
670+
rx_queues: { index: 14 irq_cpulist: "22" }
671+
rx_queues: { index: 15 irq_cpulist: "23" }
672+
}
673+
}
674+
config_expectations: {
675+
description: "n2-32 with single GVNIC (without GVE NUMA locality awareness)"
676+
machine_type: "n2-highcpu-32"
677+
guest_os_selector: {
678+
max_kernel_version: "6.16.999"
679+
}
635680
nics: {
636681
type: "GVNIC"
637682
tx_queues: { index: 0 irq_cpulist: "0" xps_cpulist: "0" }

test_suites/networkconfig/config_expectations/config_expectations_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,28 @@ func TestRingSizes(t *testing.T) {
146146
})
147147
}
148148
}
149+
150+
func TestKernelVersionFormat(t *testing.T) {
151+
c := proto()
152+
for _, config := range c.GetConfigExpectations() {
153+
t.Run(config.GetDescription(), func(t *testing.T) {
154+
minVer := config.GetGuestOsSelector().GetMinKernelVersion()
155+
if minVer != "" {
156+
if len(networkutils.ParseKernelVersion(minVer)) == 0 {
157+
t.Errorf("Empty or invalid min_kernel_version string: %q", minVer)
158+
}
159+
}
160+
maxVer := config.GetGuestOsSelector().GetMaxKernelVersion()
161+
if maxVer != "" {
162+
if len(networkutils.ParseKernelVersion(maxVer)) == 0 {
163+
t.Errorf("Empty or invalid max_kernel_version string: %q", maxVer)
164+
}
165+
}
166+
if minVer != "" && maxVer != "" {
167+
if networkutils.CompareKernelVersion(minVer, maxVer) > 0 {
168+
t.Errorf("min_kernel_version (%q) is greater than max_kernel_version (%q)", minVer, maxVer)
169+
}
170+
}
171+
})
172+
}
173+
}

0 commit comments

Comments
 (0)