From nobody Sat Feb 7 15:29:59 2026 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1542228352190560.3645543796044; Wed, 14 Nov 2018 12:45:52 -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 01EE8C07753C; Wed, 14 Nov 2018 20:45:50 +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 92A5519750; Wed, 14 Nov 2018 20:45:48 +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 67BE418005AD; Wed, 14 Nov 2018 20:45:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAEJr15Z002927 for ; Wed, 14 Nov 2018 14:53:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id C3BF061484; Wed, 14 Nov 2018 19:53:01 +0000 (UTC) Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 270DC61493; Wed, 14 Nov 2018 19:53:01 +0000 (UTC) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA45230024FC; Wed, 14 Nov 2018 19:52:59 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id 131so28019304qkd.4; Wed, 14 Nov 2018 11:52:59 -0800 (PST) Received: from localhost.localdomain ([2804:431:f700:6757:dabd:2c88:c24c:80fc]) by smtp.gmail.com with ESMTPSA id n3sm11048027qtc.81.2018.11.14.11.52.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Nov 2018 11:52:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eVyi4p8hYGajgGIAspHU3SPauHfl4pvSB0bDW/fbHOE=; b=nqaWOdd1O7RzMLSiUWQV/1JFAbYq/a7yKbU+B3hp8NrczqSvU0kxHgPLxbKQquBBhH uo5OnEeR55Rbk5sKFCQ2vLqcEIdrg1eKLxSMR0hQ8R0awjRK/CE1IAfSNcH6Vc3qdmFK uWnYtvmD6rsWKq7BW0YHq2wXmDDCSqTnesFRxMw7LJaKJ5oLjIGTxWfgGdHST4Go/hTE 0S5GgClmeV+0IwKvFUZNLE8LzMxkZq4JlolvC8Uiue39/vn63wVfjVww5cgTE9fjDxvt /mrGBd+1bT5i5mDWn6QNfyHIM/1mjQ6gSYiaAMCUCsr3tP2uM+SonfWEdGlMZuUxw+4P 6U2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eVyi4p8hYGajgGIAspHU3SPauHfl4pvSB0bDW/fbHOE=; b=gD62EljGJ5xseupqEDNnn8HGNo0GmXjFBOlJP04qKtDQqQb+RlXjsnn/3p6+05BbZn vaVCkZGkZ7RhLI9HA2yqMM94Pr3oROSDi5XYXaOl64j9KAnXsUAgpPmS7Iom2P9+CKRy YEyHlcZtwMzdVzL4tAEogcIpMGgxbnD6zqZdYXdbIWfvcVfRa8MQA9ORGv8Ii9KfRniA PbC+v+fmYLld7Y2HsfjdzDREvWBqjbmf1DQfKUzTvK9sWACVTeLQvmt2WVkgfx5nm0Lv CQ7mQuY3/eNu/6W9cTisCEMx6Au0gqUMBKC+4WAOEIu2ttXdvxBsYyyV1XPSEPqqMRjc uuLA== X-Gm-Message-State: AGRZ1gKK0kFVS9/2hfgLIqkYPE4GDzjtblN+mJcdduR1JxAP50pUJc5P 8dGt0nryNn4yuSglnBV35Cvl1LF6IHA= X-Google-Smtp-Source: AJdET5ewoc7guErVuU8DgGCHJubRddB5+OARW8nEURdwZQjxYjNK13IVfOtXeVY0QLLQNkiwllGXhg== X-Received: by 2002:a37:455:: with SMTP id 82mr3179108qke.60.1542225179034; Wed, 14 Nov 2018 11:52:59 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Wed, 14 Nov 2018 17:52:04 -0200 Message-Id: <20181114195207.26863-3-danielhb413@gmail.com> In-Reply-To: <20181114195207.26863-1-danielhb413@gmail.com> References: <20181114195207.26863-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 14 Nov 2018 19:53:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 14 Nov 2018 19:53:00 +0000 (UTC) for IP:'209.85.222.194' DOMAIN:'mail-qk1-f194.google.com' HELO:'mail-qk1-f194.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.139 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.222.194 mail-qk1-f194.google.com 209.85.222.194 mail-qk1-f194.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.45 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v2 2/5] qemu_process.c: make qemuValidateCpuCount public 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: , 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.32]); Wed, 14 Nov 2018 20:45:50 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" qemuValidateCpuCount validates the maxCpus value of a domain at startup time, preventing it to start if the value exceeds a maximum. This checking is also done at qemu_domain.c, qemuDomainDefValidate. However, it is done only for x86 (and even then, in a specific scenario). We want this check to be done for all archs. To accomplish this, let's first make qemuValidateCpuCount public so it can be used inside qemuDomainDefValidate. The function was renamed to qemuProcessValidateCpuCount to be compliant with the other public methods at qemu_process.h. The method signature was slightly adapted to fit the const 'def' variable used in qemuDomainDefValidate. This change has no downside in in its original usage at qemuProcessStartValidateXML. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_process.c | 8 ++++---- src/qemu/qemu_process.h | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 84a2163743..4d134bd7be 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3887,9 +3887,9 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver, } =20 =20 -static int -qemuValidateCpuCount(virDomainDefPtr def, - virQEMUCapsPtr qemuCaps) +int +qemuProcessValidateCpuCount(const virDomainDef *def, + virQEMUCapsPtr qemuCaps) { unsigned int maxCpus =3D virQEMUCapsGetMachineMaxCpus(qemuCaps, def->o= s.machine); =20 @@ -5152,7 +5152,7 @@ qemuProcessStartValidateXML(virQEMUDriverPtr driver, * If back compat isn't a concern, XML validation should probably * be done at parse time. */ - if (qemuValidateCpuCount(vm->def, qemuCaps) < 0) + if (qemuProcessValidateCpuCount(vm->def, qemuCaps) < 0) return -1; =20 /* checks below should not be executed when starting a qemu process fo= r a diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index 2037467c94..d3b2baac51 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -47,6 +47,9 @@ int qemuProcessDestroyMemoryBackingPath(virQEMUDriverPtr = driver, virDomainObjPtr vm, virDomainMemoryDefPtr mem); =20 +int qemuProcessValidateCpuCount(const virDomainDef *def, + virQEMUCapsPtr qemuCaps); + void qemuProcessReconnectAll(virQEMUDriverPtr driver); =20 typedef struct _qemuProcessIncomingDef qemuProcessIncomingDef; --=20 2.19.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list