diff options
author | Neil Williams <codehelp@debian.org> | 2015-08-18 13:11:58 +0200 |
---|---|---|
committer | Neil Williams <codehelp@debian.org> | 2015-08-31 18:00:26 +0100 |
commit | aa0972e2c62feff98273c6a1575e148817b2fe0e (patch) | |
tree | 71a4cb25a80c57438988229ee326e9baa0139196 /vmdebootstrap/base.py | |
parent | bc7ef0f9a3df88424ab594fe13a4322b408f6718 (diff) | |
download | vmdebootstrap-aa0972e2c62feff98273c6a1575e148817b2fe0e.tar.gz |
Add examples for UEFI hook.
Document task package usage in the README
Diffstat (limited to 'vmdebootstrap/base.py')
-rw-r--r-- | vmdebootstrap/base.py | 13 |
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 |