cleanup 2
This commit is contained in:
@@ -3,6 +3,21 @@
|
||||
|
||||
let vm_id = "vm-clean-test";
|
||||
|
||||
// Phase 0: Pre-clean any existing VM with the same id (best-effort)
|
||||
// This avoids TAP "Resource busy" when a previous run is still active.
|
||||
try {
|
||||
cloudhv_vm_stop(vm_id, true);
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
// brief wait to let processes exit and TAP release
|
||||
wait_for_vm_boot(1);
|
||||
try {
|
||||
cloudhv_vm_delete(vm_id, true);
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
// Phase 1: Host check
|
||||
let hc = host_check();
|
||||
if !(hc.ok == true) {
|
||||
@@ -25,10 +40,11 @@ try {
|
||||
// Phase 3: Wait for VM to boot and get network configuration
|
||||
wait_for_vm_boot(10);
|
||||
|
||||
// Phase 4: Discover VM IP addresses
|
||||
let mac_addr = "a2:26:1e:ac:96:3a"; // This should be derived from vm_id_actual
|
||||
let ipv4 = cloudhv_discover_ipv4_from_leases("/var/lib/misc/dnsmasq-hero-br-hero.leases", mac_addr, 30);
|
||||
let ipv6 = cloudhv_discover_ipv6_on_bridge("br-hero", mac_addr);
|
||||
// Phase 4: Discover VM IP addresses (robust, no hardcoded MAC/paths)
|
||||
let net = cloudhv_vm_network_info(vm_id_actual, 30);
|
||||
let ipv4 = net["ipv4"]; // Dynamic UNIT if not found yet
|
||||
let ipv6 = net["ipv6"]; // Dynamic UNIT if not found
|
||||
// Optional: you could also inspect net["mac"], net["bridge"], net["lease"]
|
||||
|
||||
// Phase 5: Display connection info
|
||||
cloudhv_display_network_info(vm_id_actual, ipv4, ipv6);
|
||||
|
Reference in New Issue
Block a user