From 7f646fc468c3a23dca06be03ab3c2b8d5fb2a5f2 Mon Sep 17 00:00:00 2001 From: Roberto Hueso Gomez Date: Wed, 8 Apr 2020 13:35:34 +0200 Subject: Use 75% of disk space in virtual mode --- src/virtual/ogOperations.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/virtual/ogOperations.py b/src/virtual/ogOperations.py index 63c9a66..a0f6718 100644 --- a/src/virtual/ogOperations.py +++ b/src/virtual/ogOperations.py @@ -60,6 +60,7 @@ class OgVirtualOperations: def __init__(self): self.IP = '127.0.0.1' self.VIRTUAL_PORT = 4444 + self.USABLE_DISK = 0.75 def poweroff(self): qmp = OgQMP(self.IP, self.VIRTUAL_PORT) @@ -108,6 +109,7 @@ class OgVirtualOperations: subprocess.run([f'mount /dev/nbd0p1 {temp_mount_dir}'], shell=True) total_disk, used_disk, free_disk = shutil.disk_usage(temp_mount_dir) + free_disk = int(free_disk * self.USABLE_DISK) subprocess.run([f'umount {temp_mount_dir}'], shell=True) subprocess.run(['qemu-nbd -d /dev/nbd0'], @@ -119,6 +121,7 @@ class OgVirtualOperations: f.truncate() except FileNotFoundError: total_disk, used_disk, free_disk = shutil.disk_usage("/") + free_disk = int(free_disk * self.USABLE_DISK) data = {'serial_number': '', 'disk_setup': {'disk': 1, 'partition': 0, -- cgit v1.2.3-18-g5258