From nobody Sun May 5 14:53:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1544203631268159.32590803200503; Fri, 7 Dec 2018 09:27:11 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 51332307DAA7; Fri, 7 Dec 2018 17:27:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BAF6B44F88; Fri, 7 Dec 2018 17:27:08 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EFB05181A968; Fri, 7 Dec 2018 17:27:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wB7HR6mb016221 for ; Fri, 7 Dec 2018 12:27:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 683D89CB0; Fri, 7 Dec 2018 17:27:06 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-18.phx2.redhat.com [10.3.116.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24D64600C5 for ; Fri, 7 Dec 2018 17:27:06 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 7 Dec 2018 12:27:03 -0500 Message-Id: <20181207172704.7795-2-jferlan@redhat.com> In-Reply-To: <20181207172704.7795-1-jferlan@redhat.com> References: <20181207172704.7795-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] conf: Add the size of failed max_memory in error 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-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 07 Dec 2018 17:27:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If virDomainDefCompatibleDevice fails because there is insufficient domain def->mem.max_memory, then let's also print out that value in the error message. Signed-off-by: John Ferlan --- src/conf/domain_conf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b70dca6c61..2a17214f38 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -28901,7 +28901,8 @@ virDomainDefCompatibleDevice(virDomainDefPtr def, if ((virDomainDefGetMemoryTotal(def) + sz) > def->mem.max_memory) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Attaching memory device with size '%llu' wou= ld " - "exceed domain's maxMemory config"), sz); + "exceed domain's maxMemory config size '%llu'= "), + sz, def->mem.max_memory); return -1; } } --=20 2.17.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 14:53:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1544203631445399.5277439706632; Fri, 7 Dec 2018 09:27:11 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6E5C47AE8F; Fri, 7 Dec 2018 17:27:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 115465D9CD; Fri, 7 Dec 2018 17:27:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 70DEE4EA40; Fri, 7 Dec 2018 17:27:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wB7HR7l0016231 for ; Fri, 7 Dec 2018 12:27:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id F1F76600C5; Fri, 7 Dec 2018 17:27:06 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-18.phx2.redhat.com [10.3.116.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id A7252381BA for ; Fri, 7 Dec 2018 17:27:06 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 7 Dec 2018 12:27:04 -0500 Message-Id: <20181207172704.7795-3-jferlan@redhat.com> In-Reply-To: <20181207172704.7795-1-jferlan@redhat.com> References: <20181207172704.7795-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] conf: Add check/error for domain supports cold/hotplug 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-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 07 Dec 2018 17:27:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1624336 Add a check during virDomainDefCompatibleDevice whether the domain supports cold/hotplug of a memory module even though this duplicates the qemuDomainDefValidateMemoryHotplug check. Without this check, the cold/hot plug would fail on the subsequent mem_memory check (since it's 0). Adding a check for max_memory > 0 would allow the subsequent hotplug check to fail, but would cause coldplug to fail with the somewhat opaque message "no free memory device slot available". Signed-off-by: John Ferlan --- src/conf/domain_conf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2a17214f38..b83368a43a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -28898,6 +28898,13 @@ virDomainDefCompatibleDevice(virDomainDefPtr def, if (dev->type =3D=3D VIR_DOMAIN_DEVICE_MEMORY) { unsigned long long sz =3D dev->data.memory->size; =20 + if (!virDomainDefHasMemoryHotplug(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("cannot use/hotplug a memory device when doma= in " + "'maxMemory' is not defined")); + return -1; + } + if ((virDomainDefGetMemoryTotal(def) + sz) > def->mem.max_memory) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Attaching memory device with size '%llu' wou= ld " --=20 2.17.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list