From 355ed640b2276b1850415c1667f6b7d098133004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 16 Sep 2014 01:18:55 +0200 Subject: [PATCH] hvm: reserve memory for stubdom Previously it was allocated from 50MB memory margin left by qmemman. Which wasn't reliable enough. --- core-modules/000QubesVm.py | 7 +++++-- core-modules/01QubesHVm.py | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index df9033bf..19a42545 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -1662,7 +1662,9 @@ class QubesVm(object): if (retcode != 0) : raise OSError ("Cannot execute qrexec-daemon!") - def start(self, debug_console = False, verbose = False, preparing_dvm = False, start_guid = True, notify_function = None): + def start(self, debug_console = False, verbose = False, + preparing_dvm = False, start_guid = True, notify_function = None, + mem_required = None): if dry_run: return @@ -1686,7 +1688,8 @@ class QubesVm(object): # refresh config file self.create_config_file() - mem_required = int(self.memory) * 1024 * 1024 + if mem_required is None: + mem_required = int(self.memory) * 1024 * 1024 qmemman_client = QMemmanClient() try: got_memory = qmemman_client.request_memory(mem_required) diff --git a/core-modules/01QubesHVm.py b/core-modules/01QubesHVm.py index 24d1be68..ae929155 100644 --- a/core-modules/01QubesHVm.py +++ b/core-modules/01QubesHVm.py @@ -421,6 +421,9 @@ class QubesHVm(QubesVm): if self.template and self.template.is_running(): raise QubesException("Cannot start the HVM while its template is running") try: + if 'mem_required' not in kwargs: + # Reserve 32MB for stubdomain + kwargs['mem_required'] = (self.memory + 32) * 1024 * 1024 return super(QubesHVm, self).start(*args, **kwargs) except QubesException as e: if xc.physinfo()['virt_caps'].count('hvm') == 0: