From nobody Thu May 2 22:58:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1486467529219528.5273084187847; Tue, 7 Feb 2017 03:38:49 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v17BZAMi015358; Tue, 7 Feb 2017 06:35:10 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v17BZ856024698 for ; Tue, 7 Feb 2017 06:35:08 -0500 Received: from inaba.usersys.redhat.com ([10.34.129.229]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v17BZ6Sf005422 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 7 Feb 2017 06:35:07 -0500 From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 7 Feb 2017 12:35:03 +0100 Message-Id: <1486467303-23556-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2] qemu: Forbid without X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In order for memory locking to work, the hard limit on memory locking (and usage) has to be set appropriately by the user. The documentation mentions the requirement already: with this patch, it's going to be enforced by runtime checks as well, by forbidding a non-compliant guest from starting at all. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1316774 --- Changes from [v1] * Address review feeback: - check in BuildCommandLine rather than in PostParse, so that non-compliant guests will merely fail to start rather than disappear completely. [v1] https://www.redhat.com/archives/libvir-list/2017-February/msg00180.html src/qemu/qemu_command.c | 9 +++++++++ tests/qemuxml2argvdata/qemuxml2argv-mlock-on.xml | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 1396661..ca3bcdc 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7340,6 +7340,15 @@ qemuBuildMemCommandLine(virCommandPtr cmd, qemuBuildMemPathStr(cfg, def, qemuCaps, cmd) < 0) return -1; =20 + /* Memory locking can only work properly if the memory locking limit + * for the QEMU process has been raised appropriately: the default one + * is extrememly low, so there's no way the guest will fit in there */ + if (def->mem.locked && !virMemoryLimitIsSet(def->mem.hard_limit)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Setting requires " + " to be set as well")); + return -1; + } if (def->mem.locked && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_REALTIME_ML= OCK)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("memory locking not supported by QEMU binary")); diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mlock-on.xml b/tests/qemux= ml2argvdata/qemuxml2argv-mlock-on.xml index 20a5eaa..2046663 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-mlock-on.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-mlock-on.xml @@ -3,6 +3,9 @@ c7a5fdbd-edaf-9455-926a-d65c16db1809 219136 219136 + + 256000 + --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list