Update VM download link
This commit is contained in:
@@ -25,7 +25,7 @@ logger.setLevel(logging.INFO)
|
|||||||
|
|
||||||
MAX_RETRY_TIMES = 10
|
MAX_RETRY_TIMES = 10
|
||||||
RETRY_INTERVAL = 5
|
RETRY_INTERVAL = 5
|
||||||
UBUNTU_X86_URL = "https://huggingface.co/datasets/xlangai/ubuntu_osworld/resolve/main/Ubuntu-x86.zip"
|
UBUNTU_X86_URL = "https://huggingface.co/datasets/xlangai/ubuntu_osworld/resolve/main/Ubuntu.qcow2"
|
||||||
|
|
||||||
# Determine the platform and CPU architecture to decide the correct VM image to download
|
# Determine the platform and CPU architecture to decide the correct VM image to download
|
||||||
# if platform.system() == 'Darwin': # macOS
|
# if platform.system() == 'Darwin': # macOS
|
||||||
@@ -117,13 +117,13 @@ def _install_vm(vm_name, vms_dir, downloaded_file_name, os_type, original_vm_nam
|
|||||||
logger.info("Download succeeds.")
|
logger.info("Download succeeds.")
|
||||||
break # Download completed successfully
|
break # Download completed successfully
|
||||||
|
|
||||||
# Unzip the downloaded file
|
vm_path = os.path.join(vms_dir, vm_name, vm_name + ".qcow2")
|
||||||
logger.info("Unzipping the downloaded file...☕️")
|
|
||||||
with zipfile.ZipFile(downloaded_file_path, 'r') as zip_ref:
|
|
||||||
zip_ref.extractall(os.path.join(vms_dir, vm_name))
|
|
||||||
logger.info("Files have been successfully extracted to the directory: " + str(os.path.join(vms_dir, vm_name)))
|
|
||||||
|
|
||||||
vm_path = os.path.join(vms_dir, vm_name, vm_name, vm_name + ".vmx")
|
# Execute the function to download and unzip the VM, and update the vm metadata
|
||||||
|
if not os.path.exists(vm_path):
|
||||||
|
__download_and_unzip_vm()
|
||||||
|
else:
|
||||||
|
logger.info(f"Virtual machine exists: {vm_path}")
|
||||||
|
|
||||||
# Start the virtual machine
|
# Start the virtual machine
|
||||||
def start_vm(vm_path, max_retries=20):
|
def start_vm(vm_path, max_retries=20):
|
||||||
@@ -272,8 +272,6 @@ class DockerVMManager(VMManager):
|
|||||||
for vm_path in vm_paths:
|
for vm_path in vm_paths:
|
||||||
if vm_name + ".qcow2" in vm_path:
|
if vm_name + ".qcow2" in vm_path:
|
||||||
flag = False
|
flag = False
|
||||||
elif vm_name + ".img" in vm_path:
|
|
||||||
flag = False
|
|
||||||
if flag:
|
if flag:
|
||||||
shutil.rmtree(os.path.join(vms_dir, vm_name))
|
shutil.rmtree(os.path.join(vms_dir, vm_name))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user