summaryrefslogtreecommitdiffstats
path: root/src/virtual
diff options
context:
space:
mode:
authorRoberto Hueso Gomez <robertohueso96@gmail.com>2020-04-08 13:35:34 +0200
committerRoberto Hueso Gomez <robertohueso96@gmail.com>2020-04-08 13:35:34 +0200
commit7f646fc468c3a23dca06be03ab3c2b8d5fb2a5f2 (patch)
treedbe533ba7f98933e98a471e6689e9a096a207f37 /src/virtual
parent4f03c31f85b6431f5be70f28b08665560f76d654 (diff)
Use 75% of disk space in virtual mode
Diffstat (limited to 'src/virtual')
-rw-r--r--src/virtual/ogOperations.py3
1 files changed, 3 insertions, 0 deletions
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,