Merge pull request 'clan_vm_manager: --debug enables debug mode in clan_cli too' (#840) from Qubasa-add_spinner into main

This commit is contained in:
clan-bot
2024-02-14 08:43:14 +00:00
9 changed files with 128 additions and 138 deletions

View File

@@ -40,17 +40,25 @@ def run_vm_in_thread(machine_name: str) -> None:
# wait for qmp socket to exist
def wait_vm_up(state_dir: Path) -> None:
socket_file = state_dir / "qga.sock"
timeout: float = 300
while True:
if timeout <= 0:
raise TimeoutError(f"qga socket {socket_file} not found")
if socket_file.exists():
break
sleep(0.1)
timeout -= 0.1
# wait for vm to be down by checking if qga socket is down
def wait_vm_down(state_dir: Path) -> None:
socket_file = state_dir / "qga.sock"
timeout: float = 300
while socket_file.exists():
if timeout <= 0:
raise TimeoutError(f"qga socket {socket_file} still exists")
sleep(0.1)
timeout -= 0.1
# wait for vm to be up then connect and return qmp instance