mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
test_infra: improve NVIDIA diagnostics
Avoid panicking when nvidia-smi fails during GPU checks. Run the command through a shell wrapper that preserves stdout and stderr even when nvidia-smi exits with a failure status. Keep printing guest dmesg on failure and label the nvidia-smi text as diagnostic output, since SSH-level failures are reported through the same path. Assisted-by: OpenCode:gpt-5.5 Signed-off-by: Damian Barabonkov <dbctl@pm.me>
This commit is contained in:
committed by
Rob Bradford
parent
99f5537984
commit
bbd271e85b
@@ -1607,7 +1607,9 @@ impl Guest {
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub fn check_nvidia_gpu(&self) -> bool {
|
||||
let output = self.ssh_command("nvidia-smi").unwrap();
|
||||
let output = self
|
||||
.ssh_command("nvidia-smi 2>&1; echo CH_NVIDIA_SMI_STATUS:$?")
|
||||
.unwrap_or_else(|e| format!("failed to run nvidia-smi: {e:?}"));
|
||||
|
||||
if output.contains("NVIDIA L40S") {
|
||||
return true;
|
||||
@@ -1619,10 +1621,10 @@ impl Guest {
|
||||
|
||||
eprintln!(
|
||||
"\n\n==== Guest dmesg (nvidia-smi check failed) ====\n\n\
|
||||
{dmesg}\n\
|
||||
\n==== End guest dmesg ====\n\n"
|
||||
{dmesg}\n\
|
||||
\n==== End guest dmesg ====\n\n"
|
||||
);
|
||||
eprintln!("nvidia-smi output did not contain 'NVIDIA L40S': {output}");
|
||||
eprintln!("nvidia-smi diagnostic output: {output}");
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user