From 0c847a6aa64039abd3babd2b4732c705e5bdf806 Mon Sep 17 00:00:00 2001 From: Shaoranlaos Date: Wed, 3 Sep 2025 17:18:29 +0200 Subject: [PATCH] fix disk size parsing This fixes the parsing of disksizes in Megabyte and Kilobyte --- proxmox_export.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/proxmox_export.py b/proxmox_export.py index 6534739..369f18e 100644 --- a/proxmox_export.py +++ b/proxmox_export.py @@ -44,11 +44,16 @@ def parse_disk_size(disk_str): if not disk_str: return 0 - match = re.search(r"size=(\d+)([GM])", str(disk_str)) + match = re.search(r"size=(\d+)([GMK])", str(disk_str)) if not match: return 0 size, unit = match.groups() - return int(size) if unit == "G" else int(size) * 1024 + if unit == "G": + return int(size) + elif unit == "M": + return round(int(size) / 1024) + else: + return round(int(size) / 1024 / 1024) def extract_disk_info(config): """Extract individual disk information from QEMU VM config"""