Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions proxmox_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down