hvm: reserve memory for stubdom

Previously it was allocated from 50MB memory margin left by qmemman.
Which wasn't reliable enough.
This commit is contained in:
Marek Marczykowski-Górecki 2014-09-16 01:18:55 +02:00
parent 7b8e6283d5
commit 355ed640b2
2 changed files with 8 additions and 2 deletions

View File

@ -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)

View File

@ -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: