From nobody Sat Feb 7 15:29:56 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 1542226673491834.4188941590706; Wed, 14 Nov 2018 12:17:53 -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 6FC6589AF6; Wed, 14 Nov 2018 20:17:51 +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 2B24219750; Wed, 14 Nov 2018 20:17:51 +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 D1EA4181A86C; Wed, 14 Nov 2018 20:17:50 +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 wAEJrAjF002964 for ; Wed, 14 Nov 2018 14:53:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id 38568600D6; Wed, 14 Nov 2018 19:53:10 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 212BE620D4; Wed, 14 Nov 2018 19:53:05 +0000 (UTC) Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) (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 3A44E89AED; Wed, 14 Nov 2018 19:53:04 +0000 (UTC) Received: by mail-qk1-f196.google.com with SMTP id d19so28021212qkg.5; Wed, 14 Nov 2018 11:53:04 -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.53.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Nov 2018 11:53:03 -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=VDgD7kYovepeiQPoPG7JL0bE4nPBMp8E5Zi0vT/FxKs=; b=jLQAi5cF0+nZob/lKpK5Joc0ipeHOz5pHiO2XLVGtEdYGJ0JChGwzghv6iuF+/O/Xn iIkOxc3IdOqsNYPvB6sRObbQzSyZKHz75s4tQinVc3vVOnIDKlvUe38l+cJ5N664fol4 Nhgz4wKPbV4tdzUR3bDUpv9Co3A0T2N+1omwD6foQR2b8ikAep1skP5p84Wxi0X614Yg 7UfAWzCmz4vx59/IL0eGACtV4LvmRm7UGVrYUBHSqjezar7s/ad2zYfNlQPCRI6eflLu uBzck8u+d2PsaH364jHAV8qsEpO8Eky6oQ/wLYHBVoK9M5UXKoF4CykKBXG3WS1rXJqK lApw== 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=VDgD7kYovepeiQPoPG7JL0bE4nPBMp8E5Zi0vT/FxKs=; b=VjTCVZoHw5jc/FZdOIAJnv9ZzWKmDOvSKfDKXXI+IpTtFUuLxwX2LUvBsTae0j7NfN YfxvFipsDqY92PefffIsMqxrd4yOXC5PHmvwtNm6+rIhBWUo5fe5AvRt22y5rXkcnEjK hm3uXOY45U2ZEI1nN42c4hze4CFaYOijTx7N/M0/Yof9kE6k6eWkd6QAv7rghiwY5vyO sbXl/bzUJ8QSjn98mTVnXymdOZhFImkUPRYuSAN+J+zSe8Cmce/7mxO6rpQMKjHugKhf h3QVQZ1JJ7ox5NqbH2aw6w81g0HELvGlhccMrS56wtPuiVNrUGIMLItg7Jhbwh74LlmW h1Mw== X-Gm-Message-State: AGRZ1gKdBsfH9fNllE49G7krYbEYuBf07+IDmJxOnzU4JtudDE0ioLcD 78VYrrToe6oYHCfajpwdZWvX0YMcCpE= X-Google-Smtp-Source: AJdET5cpthfzpBLN+pivKXg1jZ4pWQJdJS3KrnX6HCjiXL9dfS5y3bFdYPRpcP4UrzN99gfmYGYX5w== X-Received: by 2002:a37:62d3:: with SMTP id w202mr3029381qkb.357.1542225183368; Wed, 14 Nov 2018 11:53:03 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Wed, 14 Nov 2018 17:52:06 -0200 Message-Id: <20181114195207.26863-5-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.26]); Wed, 14 Nov 2018 19:53:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 14 Nov 2018 19:53:04 +0000 (UTC) for IP:'209.85.222.196' DOMAIN:'mail-qk1-f196.google.com' HELO:'mail-qk1-f196.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.196 mail-qk1-f196.google.com 209.85.222.196 mail-qk1-f196.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v2 4/5] qemu_process.c: moving qemuValidateCpuCount to qemu_domain.c 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.26]); Wed, 14 Nov 2018 20:17:52 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Previous patch removed the call to qemuProcessValidateCpuCount from qemuProcessStartValidateXML, in qemu_process.c. The only caller left is qemuDomainDefValidate, in qemu_domain.c. Instead of having a public function declared inside qemu_process.c that isn't used in that file, this patch moves the function to qemu_domain.c, making in static and renaming it to qemuDomainValidateCpuCount to be compliant with other static functions names in the file. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_domain.c | 25 ++++++++++++++++++++++++- src/qemu/qemu_process.c | 23 ----------------------- src/qemu/qemu_process.h | 3 --- 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3b86d28216..a0d69da646 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3990,6 +3990,29 @@ qemuDomainDefValidateMemory(const virDomainDef *def) } =20 =20 +static int +qemuDomainValidateCpuCount(const virDomainDef *def, + virQEMUCapsPtr qemuCaps) +{ + unsigned int maxCpus =3D virQEMUCapsGetMachineMaxCpus(qemuCaps, def->o= s.machine); + + if (virDomainDefGetVcpus(def) =3D=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Domain requires at least 1 vCPU")); + return -1; + } + + if (maxCpus > 0 && virDomainDefGetVcpusMax(def) > maxCpus) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Maximum CPUs greater than specified machine " + "type limit %u"), maxCpus); + return -1; + } + + return 0; +} + + static int qemuDomainDefValidate(const virDomainDef *def, virCapsPtr caps ATTRIBUTE_UNUSED, @@ -4084,7 +4107,7 @@ qemuDomainDefValidate(const virDomainDef *def, } } =20 - if (qemuProcessValidateCpuCount(def, qemuCaps) < 0) { + if (qemuDomainValidateCpuCount(def, qemuCaps) < 0) { goto cleanup; } =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 2adbf375ee..0d1dc7ed35 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3887,29 +3887,6 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr drive= r, } =20 =20 -int -qemuProcessValidateCpuCount(const virDomainDef *def, - virQEMUCapsPtr qemuCaps) -{ - unsigned int maxCpus =3D virQEMUCapsGetMachineMaxCpus(qemuCaps, def->o= s.machine); - - if (virDomainDefGetVcpus(def) =3D=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Domain requires at least 1 vCPU")); - return -1; - } - - if (maxCpus > 0 && virDomainDefGetVcpusMax(def) > maxCpus) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Maximum CPUs greater than specified machine " - "type limit %u"), maxCpus); - return -1; - } - - return 0; -} - - static int qemuProcessVerifyHypervFeatures(virDomainDefPtr def, virCPUDataPtr cpu) diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index d3b2baac51..2037467c94 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -47,9 +47,6 @@ 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