fixed cloud hypervisor issues + updated test script (working now)

This commit is contained in:
Maxime Van Hees
2025-08-21 13:32:03 +02:00
parent d735316b7f
commit aab2b6f128
2 changed files with 100 additions and 8 deletions

View File

@@ -105,6 +105,41 @@ if !missing {
print(`⚠️ VM start failed (this can happen if kernel/cmdline are incompatible): ${err}`);
}
print("\n waiting for VM to be ready...");
// Discover API socket and PID from SAL
let info1 = cloudhv_vm_info(vm_id);
let api_sock = info1.spec.api_socket;
let pid = info1.runtime.pid;
// 1) Wait for API socket to appear (up to ~50s)
let sock_ok = false;
for x in 0..50 {
if exist(api_sock) { sock_ok = true; break; }
sleep(1);
}
print(`api_sock_exists=${sock_ok} path=${api_sock}`);
// 2) Probe ch-remote info with retries (up to ~20s)
if sock_ok {
let info_ok = false;
for x in 0..20 {
let r = run_silent(`ch-remote-static --api-socket ${api_sock} info`);
if r.success {
info_ok = true;
break;
}
sleep(1);
}
if info_ok {
print("VM API is ready (ch-remote info OK)");
} else {
print("⚠️ VM API did not become ready in time (continuing)");
}
} else {
print("⚠️ API socket not found (continuing)");
}
print("\n--- Test 5: Stop VM (graceful) ---");
try {
cloudhv_vm_stop(vm_id, false);