From nobody Mon Apr 29 18:51:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 148647368130935.66285380584816; Tue, 7 Feb 2017 05:21:21 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v17DGtBW048127; Tue, 7 Feb 2017 08:16:55 -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 v17DGslU007856 for ; Tue, 7 Feb 2017 08:16:54 -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 v17DGqDF008244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 7 Feb 2017 08:16:53 -0500 From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 7 Feb 2017 14:16:49 +0100 Message-Id: <1486473409-12106-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 v3] 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 being defined as well as edited and started. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1316774 --- Changes from [v2] * Address review feedback: - move the check from BuildCommandLine to Validate. 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 [v2] https://www.redhat.com/archives/libvir-list/2017-February/msg00214.html src/qemu/qemu_domain.c | 10 ++++++++++ tests/qemuxml2argvdata/qemuxml2argv-mlock-on.xml | 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c6ce090..ce3aa69 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2831,6 +2831,16 @@ qemuDomainDefValidate(const virDomainDef *def, } } =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")); + goto cleanup; + } + if (qemuDomainDefValidateVideo(def) < 0) goto cleanup; =20 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