Get VM IP again when getting screenshot fails (#215)

In rare cases, the IP of the VM changes after it launches. We can get the IP every time we retry to ensure the correct connection.
This commit is contained in:
Kaixin Li
2025-06-16 02:40:40 +08:00
committed by GitHub
parent 40354322e8
commit 347238e17e

View File

@@ -256,6 +256,8 @@ def _install_vm(vm_name, vms_dir, downloaded_file_name, os_type, original_vm_nam
# Try downloading the screenshot until successful
while not download_screenshot(vm_ip):
# Try to get the IP again in case it has changed
vm_ip = get_vm_ip(vm_path)
logger.info("Check whether the virtual machine is ready...")
logger.info("Virtual machine is ready. Start to make a snapshot on the virtual machine. It would take a while...")