From 3f5ecbd3265f727c5e76e847fce8614da079ebd1 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 7 Apr 2021 14:38:37 +0200 Subject: [PATCH] tests: Extend Windows guest CPU hotplug test and update doc Both changes aim to document the absence of the CPU hot-remove functionality on Windows. Closes #2457. Signed-off-by: Anatol Belski --- docs/windows.md | 2 +- tests/integration.rs | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/windows.md b/docs/windows.md index 85d75d4a2..0d4835ca3 100644 --- a/docs/windows.md +++ b/docs/windows.md @@ -186,7 +186,7 @@ This allows for SSH login from a remote machine, for example through the `admini ## Hotplug capability -CPU hotplug is supported. The VM operating system needs to support hotplug and be appropriately licensed. SKU limitations like constraints on the number of cores are to be taken into consideration. +CPU hotplug is supported. The VM operating system needs to support hotplug and be appropriately licensed. SKU limitations like constraints on the number of cores are to be taken into consideration. Note, that Windows doesn't support CPU hot-remove. When `ch-remote` is invoked to reduce the number of CPUs, the result will be visible after the OS reboot within the same hypervisor instance. ## Debugging diff --git a/tests/integration.rs b/tests/integration.rs index 0800cda5e..96045fbbf 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -5784,6 +5784,27 @@ mod tests { // Check the CH process has the correct number of vcpu threads assert_eq!(get_vcpu_threads_count(child.id()), vcpu_num); + let vcpu_num = 4; + // Remove some CPUs. Note that Windows doesn't support hot-remove. + resize_command(&api_socket, Some(vcpu_num), None, None); + // Wait to make sure CPUs are removed + thread::sleep(std::time::Duration::new(10, 0)); + // Reboot to let Windows catch up + ssh_command_ip_with_auth( + "shutdown /r /t 0", + &auth, + "192.168.249.2", + DEFAULT_SSH_RETRIES, + DEFAULT_SSH_TIMEOUT, + ) + .unwrap(); + // Wait to make sure Windows completely rebooted + thread::sleep(std::time::Duration::new(60, 0)); + // Check the guest sees the correct number + assert_eq!(get_cpu_count_windows(&auth), vcpu_num); + // Check the CH process has the correct number of vcpu threads + assert_eq!(get_vcpu_threads_count(child.id()), vcpu_num); + ssh_command_ip_with_auth( "shutdown /s", &auth,