summaryrefslogtreecommitdiff
path: root/vmdebootstrap/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'vmdebootstrap/base.py')
-rw-r--r--vmdebootstrap/base.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/vmdebootstrap/base.py b/vmdebootstrap/base.py
index e840855..be51ce6 100644
--- a/vmdebootstrap/base.py
+++ b/vmdebootstrap/base.py
@@ -165,3 +165,16 @@ class Base(object):
# to autologin, serial_command can contain '-a root'
with open(inittab, 'a') as ftab:
ftab.write('\nS0:23:respawn:%s\n' % serial_command)
+
+ def check_swap_size(self):
+ # swap - modifies extent
+ extent = '100%'
+ swap = 256 * 1024 * 1024
+ if self.settings['swap'] > 0:
+ if self.settings['swap'] > swap:
+ swap = self.settings['swap']
+ else:
+ # minimum 256Mb as default qemu ram is 128Mb
+ logging.debug("Setting minimum 256Mb swap space")
+ extent = "%s%%" % int(100 * (self.settings['size'] - swap) / self.settings['size'])
+ return extent