From 925647c7d7ef5294e973b9540397bc3c77ec93bb Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Fri, 10 Jun 2011 18:19:19 +0200 Subject: [PATCH] dom0: run xl create through sudo This finally solve problem with RLIMIT_MEMLOCK (less important) and is required to attach PCI devices (eg netvm restart) - more important. --- dom0/qvm-core/qubes.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/dom0/qvm-core/qubes.py b/dom0/qvm-core/qubes.py index 594eb27c..e49928d1 100755 --- a/dom0/qvm-core/qubes.py +++ b/dom0/qvm-core/qubes.py @@ -31,7 +31,6 @@ import re import shutil import uuid import time -import resource from datetime import datetime from qmemman_client import QMemmanClient @@ -885,21 +884,13 @@ class QubesVm(object): # refresh config file self.create_config_file() - limit_memlock = resource.getrlimit(resource.RLIMIT_MEMLOCK) - # try to increase limit if needed - if limit_memlock[0] < int(self.memory) * 1024: - # intentionally don't catch exceptions - if it fails - there is no - # memory for new VM - resource.setrlimit(resource.RLIMIT_MEMLOCK, - (int(self.memory) * 1024, limit_memlock[1])) - mem_required = int(self.memory) * 1024 * 1024 qmemman_client = QMemmanClient() if not qmemman_client.request_memory(mem_required): qmemman_client.close() raise MemoryError ("ERROR: insufficient memory to start this VM") - xl_cmdline = ['/usr/sbin/xl', 'create', self.conf_file, '-p'] + xl_cmdline = ['sudo', '/usr/sbin/xl', 'create', self.conf_file, '-p'] try: subprocess.check_call(xl_cmdline)