diff --git a/gns3server/compute/qemu/qemu_vm.py b/gns3server/compute/qemu/qemu_vm.py index cc666f030..3e49d6749 100644 --- a/gns3server/compute/qemu/qemu_vm.py +++ b/gns3server/compute/qemu/qemu_vm.py @@ -1744,11 +1744,14 @@ class QemuVM(BaseNode): :param extend: new size """ + if self.is_running(): + raise QemuError(f"Cannot resize '{disk_name}' while the VM is running") + try: qemu_img_path = self._get_qemu_img() disk_path = os.path.join(self.working_dir, disk_name) if not os.path.exists(disk_path): - raise QemuError(f"Qemu disk image '{disk_name}' does not exist") + raise QemuError(f"Qemu disk image '{disk_name}' does not exist in the working directory") command = [qemu_img_path, "resize", disk_path, f"+{extend}M"] retcode = await self._qemu_img_exec(command) @@ -1770,7 +1773,7 @@ class QemuVM(BaseNode): disk_path = os.path.join(self.working_dir, disk_name) if not os.path.exists(disk_path): - raise QemuError(f"Qemu disk image '{disk_name}' does not exist") + raise QemuError(f"Qemu disk image '{disk_name}' does not exist in the working directory") try: os.remove(disk_path) @@ -2258,24 +2261,6 @@ class QemuVM(BaseNode): return options - async def resize_disk(self, drive_name, extend): - - if self.is_running(): - raise QemuError(f"Cannot resize {drive_name} while the VM is running") - - if self.linked_clone: - disk_image_path = os.path.join(self.working_dir, f"{drive_name}_disk.qcow2") - if not os.path.exists(disk_image_path): - disk_image = getattr(self, f"_{drive_name}_disk_image") - await self._create_linked_clone(drive_name, disk_image, disk_image_path) - else: - disk_image_path = getattr(self, f"{drive_name}_disk_image") - - if not os.path.exists(disk_image_path): - raise QemuError(f"Disk path '{disk_image_path}' does not exist") - qemu_img_path = self._get_qemu_img() - await self.manager.resize_disk(qemu_img_path, disk_image_path, extend) - def _cdrom_option(self): options = [] @@ -2716,13 +2701,14 @@ class QemuVM(BaseNode): continue answer[f"hd{drive}_disk_image"] = self.manager.get_relative_image_path(disk_image, self.working_dir) answer[f"hd{drive}_disk_image_md5sum"] = md5sum(disk_image, self.working_dir) - local_disk = os.path.join(self.working_dir, f"hd{drive}_disk.qcow2") if os.path.exists(local_disk): try: qcow2 = Qcow2(local_disk) if qcow2.backing_file: - answer[f"hd{drive}_disk_image_backed"] = os.path.basename(local_disk) + answer[f"hd{drive}_disk_image"] = os.path.basename(local_disk) + answer[f"hd{drive}_disk_image_md5sum"] = md5sum(local_disk, self.working_dir) + answer[f"hd{drive}_disk_image_backing_file"] = os.path.basename(qcow2.backing_file) except (Qcow2Error, OSError) as e: log.error(f"Could not read qcow2 disk image '{local_disk}': {e}") continue diff --git a/requirements.txt b/requirements.txt index ee6f4cab3..db09535b9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,8 @@ uvicorn==0.39.0; python_version == '3.9' # version 0.39.0 is the last version supporting Python 3.9 -uvicorn==0.40.0; python_version >= '3.10' +uvicorn==0.41.0; python_version >= '3.10' pydantic==2.12.5 -fastapi==0.128.7 +fastapi==0.128.8; python_version == '3.9' # version 0.128.8 is the last version supporting Python 3.9 +fastapi==0.131.0; python_version >= '3.10' python-multipart==0.0.20; python_version == '3.9' # version 0.0.20 is the last to support Python 3.9 python-multipart==0.0.22; python_version >= '3.10' websockets==15.0.1; python_version == '3.9' # version 15.0.1 is the last to support Python 3.9 @@ -9,17 +10,17 @@ websockets==16.0; python_version >= '3.10' aiohttp>=3.13.3,<3.14 aiofiles>=25.1.0,<26.0 Jinja2>=3.1.6,<3.2 -sentry-sdk>=2.52.0,<3 # optional dependency +sentry-sdk>=2.53.0,<3 # optional dependency psutil>=7.2.2 async-timeout>=5.0.1,<5.1; python_version < '3.11' # this library has effectively been upstreamed into Python 3.11+ distro>=1.9.0 py-cpuinfo>=9.0.0,<10.0 -greenlet==3.3.1; python_version >= '3.13' # necessary to run sqlalchemy on Python >= 3.13 +greenlet==3.3.2; python_version >= '3.13' # necessary to run sqlalchemy on Python >= 3.13 sqlalchemy==2.0.46 aiosqlite==0.22.1 alembic==1.15.2 bcrypt==5.0.0 -joserfc==1.6.1 +joserfc==1.6.2 email-validator==2.3.0 watchdog==6.0.0 zstandard==0.25.0