From nobody Tue Dec 16 03:20:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740065234563229.99122652095616; Thu, 20 Feb 2025 07:27:14 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id EDB962173; Thu, 20 Feb 2025 10:27:13 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id CF69F21CF; Thu, 20 Feb 2025 10:26:28 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 6ACBC1985; Thu, 20 Feb 2025 10:26:24 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E606B1985 for ; Thu, 20 Feb 2025 10:26:23 -0500 (EST) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-692-EcpL9FeIO1KFWj_AONZCoA-1; Thu, 20 Feb 2025 10:26:21 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B0C7419783B6 for ; Thu, 20 Feb 2025 15:26:20 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3C6851800877 for ; Thu, 20 Feb 2025 15:26:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740065183; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hPLslr6TivLzNqu3znU4KnhZeg073XUk5kR9ghz5dlY=; b=c0eols2uq+Erh/5oOyzr3X70fPzQQgOTMzzGv59My3+fTAf6LtKZhpyyZUAGEuVc/AJQoh YFumQTaNZHGqkArodZ0iY1Byvk4rmOttFmRu+sdgvWXzsF2uo2orXSKKOJtBSqO9gdTtEs umRxoI0ttyqtHoG09RDzEm0gtFRD12Y= X-MC-Unique: EcpL9FeIO1KFWj_AONZCoA-1 X-Mimecast-MFC-AGG-ID: EcpL9FeIO1KFWj_AONZCoA_1740065180 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 01/13] docs: Clarify documentation of virsh hypervisor-cpu-compare Date: Thu, 20 Feb 2025 16:26:03 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: vZ0HsF1h11HV8lwO12bHvf7oi9Do_stsF_Q5Avc601Y_1740065180 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: CEAXI2C47OLCYKMJ4KWKM3ZBC2G2TUKM X-Message-ID-Hash: CEAXI2C47OLCYKMJ4KWKM3ZBC2G2TUKM X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740065235487019000 Content-Type: text/plain; charset="utf-8" Using host CPU definition with hypervisor-cpu-compare is possible, but it provide incorrect results and thus it should not be documented the same way we describe the correct usage. Also using host-model CPU from domain capabilities was not described clearly enough. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- docs/manpages/virsh.rst | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 0eb1d6ea93..63ad619eab 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -954,15 +954,22 @@ provide on the host. (This is different from ``cpu-co= mpare`` which compares the CPU definition with the host CPU without considering any specific hypervis= or and its abilities.) =20 -The XML *FILE* may contain either a host or guest CPU definition. The host= CPU -definition is the element and its contents as printed by the -``capabilities`` command. The guest CPU definition is the element an= d its -contents from the domain XML definition or the CPU definition created from= the -host CPU model found in the domain capabilities XML (printed by the -``domcapabilities`` command). In addition to the element itself, this -command accepts full domain XML, capabilities XML, or domain capabilities = XML -containing the CPU definition. For more information on guest CPU definition -see: `https://libvirt.org/formatdomain.html#elementsCPU `__. +The XML *FILE* should contain a guest CPU definition: either the ```` +element and its contents from a domain XML definition or a CPU definition +created from the host CPU model found in the ```` +element in the domain capabilities XML (printed by the ``domcapabilities`` +command). The ```` element itself or even its +```` parent element found in domain capabilities XML is not accepted. +The element has to be transformed into an actual CPU definition. For more +information on guest CPU definition see: +`https://libvirt.org/formatdomain.html#elementsCPU `__. + +Alternatively this command will automatically extract the CPU definition w= hen +provided with a full domain or domain capabilities XML. + +For historical reasons the XML *FILE* may also contain a host CPU definiti= on, +but such usage is strongly discouraged as it will most likely provide inco= rrect +results. =20 The *virttype* option specifies the virtualization type (usable in the 'ty= pe' attribute of the top level element from the domain XML). *emulato= r* --=20 2.48.1 From nobody Tue Dec 16 03:20:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740065259776598.0829845335489; Thu, 20 Feb 2025 07:27:39 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id A5A571F67; Thu, 20 Feb 2025 10:27:38 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 4631D217B; Thu, 20 Feb 2025 10:26:35 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4FA712160; Thu, 20 Feb 2025 10:26:31 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 32CCA217A for ; Thu, 20 Feb 2025 10:26:25 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-142-oWgHOqFuObClBvU6d1Hd1Q-1; Thu, 20 Feb 2025 10:26:23 -0500 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BF4E81800876 for ; Thu, 20 Feb 2025 15:26:22 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4B3671956094 for ; Thu, 20 Feb 2025 15:26:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740065184; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oM1oUomDucAf1yBP0blnLzquCoMrmIs9TUcyuMag+yw=; b=D5D56PEWq1PpbC5CIYU7B2X/4bl6HjDv/Xkoi2Mb8L1ncLYFSodm/LBiI+HfZA+EyTPsQr nZRwo5W6WyMjZRFZShJyKBhK62ZtjmwU++Vje2v2naw4a+lHGuYHbjcF2FmVuRjagV6NJR rDTeyVcw0/pipZwAerAfTs8iF1pKInU= X-MC-Unique: oWgHOqFuObClBvU6d1Hd1Q-1 X-Mimecast-MFC-AGG-ID: oWgHOqFuObClBvU6d1Hd1Q_1740065182 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 02/13] docs: Clarify documentation of virsh hypervisor-cpu-baseline Date: Thu, 20 Feb 2025 16:26:04 +0100 Message-ID: <3fdc2152f64a922d29db6e6f68d274805a6cde44.1740064957.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: x-IAp-FmQZsEZ1JqstnUR6EmfMeloKqQ4DBHuPdQIP4_1740065182 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: WPQJSGYLCAZ6RGOCKDE6VYDSEQVWP3SG X-Message-ID-Hash: WPQJSGYLCAZ6RGOCKDE6VYDSEQVWP3SG X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740065262048019100 Content-Type: text/plain; charset="utf-8" Using host CPU definition with hypervisor-cpu-baseline is possible, but it provide incorrect results and thus it should not be documented the same way we describe the correct usage. Also using host-model CPU from domain capabilities was not described clearly enough. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- docs/manpages/virsh.rst | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 63ad619eab..06c2802b3f 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -1000,15 +1000,19 @@ As an alternative for *FILE* in case the XML would = only contain a CPU model with no additional features the CPU model name itself can be passed as *mo= del*. Exactly one of *FILE* and *model* must be used. =20 -The XML *FILE* may contain either host or guest CPU definitions describing= the -host CPU model. The host CPU definition is the element and its conte= nts -as printed by ``capabilities`` command. The guest CPU definition may be cr= eated -from the host CPU model found in domain capabilities XML (printed by -``domcapabilities`` command). In addition to the elements, this comm= and -accepts full capabilities XMLs, or domain capabilities XMLs containing the= CPU -definitions. It is recommended to use only the CPU definitions from domain -capabilities, as on some architectures using the host CPU definition may e= ither -fail or provide unexpected results. +The XML *FILE* should contain guest CPU definitions created from the host = CPU +model found in the ```` element domain capabilit= ies +XMLs (printed by the ``domcapabilities`` command on each host). The +```` elements themselves or even their ```` +parent elements found in domain capabilities XMLs are not accepted. The +elements have to be transformed into actual CPU definitions. + +Alternatively this command will automatically extract the CPU definitions = when +provided with domain capabilities XMLs. + +For historical reasons the XML *FILE* may also contain host CPU definition= s, +but such usage is strongly discouraged as it will most likely provide inco= rrect +results. =20 When *FILE* contains only a single CPU definition, the command will print = the same CPU with restrictions imposed by the capabilities of the hypervisor. --=20 2.48.1 From nobody Tue Dec 16 03:20:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740065282165501.16782070898023; Thu, 20 Feb 2025 07:28:02 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 12A481F58; Thu, 20 Feb 2025 10:28:01 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 4A8272181; Thu, 20 Feb 2025 10:26:43 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id ED1751F5C; Thu, 20 Feb 2025 10:26:37 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 8A18021D1 for ; Thu, 20 Feb 2025 10:26:28 -0500 (EST) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-277-PnnGdijMPamG2KkSTiMyng-1; Thu, 20 Feb 2025 10:26:26 -0500 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 969EC18EB2CE for ; Thu, 20 Feb 2025 15:26:24 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 21B2819412A4 for ; Thu, 20 Feb 2025 15:26:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740065187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XC5IUIluMa0pZKK7Px5SFEr0fBYHqgcVcrZhg98O3pk=; b=XG6G9q/YJVmsknMIuXV0R+fBwXEijO11H1RAaXbNeWApK92HAxPYjAGkGRQv/k2hDLhZGX +xR/M5qkLQHWN29uROMKizX5GhjYiPz6WbiGy2UAtIcv7aLaB7M3qQ5XFhpCcp3QxtNmvM 6wmRCxy5Nm0eCqd21Ti3Eo0IcAY2dwc= X-MC-Unique: PnnGdijMPamG2KkSTiMyng-1 X-Mimecast-MFC-AGG-ID: PnnGdijMPamG2KkSTiMyng_1740065184 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 03/13] virsh: Do not format messages twice Date: Thu, 20 Feb 2025 16:26:05 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 6Czp6-MJJ0TXhyb-lyXM8WcDobzSfS_LrWbtn6v220o_1740065184 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ODFD7KUQGF6Q5V23K5OU6OHCJVJOJBHQ X-Message-ID-Hash: ODFD7KUQGF6Q5V23K5OU6OHCJVJOJBHQ X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740065285628019100 Content-Type: text/plain; charset="utf-8" The same message was formatted both in vshOutputLogFile and in vshDebug and vshError functions. This patch refactor vshOutputLogFile and its callers to only format each message once. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- tools/vsh.c | 27 +++++++++++---------------- tools/vsh.h | 4 +--- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 5f5e2f281d..1b650bdd9b 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -1967,13 +1967,12 @@ vshDebug(vshControl *ctl, int level, const char *fo= rmat, ...) if (level < ctl->debug) return; =20 - va_start(ap, format); - vshOutputLogFile(ctl, level, format, ap); - va_end(ap); - va_start(ap, format); str =3D g_strdup_vprintf(format, ap); va_end(ap); + + vshOutputLogFile(ctl, level, str); + fputs(str, stdout); fflush(stdout); } @@ -2118,11 +2117,12 @@ vshError(vshControl *ctl, const char *format, ...) va_list ap; g_autofree char *str =3D NULL; =20 - if (ctl !=3D NULL) { - va_start(ap, format); - vshOutputLogFile(ctl, VSH_ERR_ERROR, format, ap); - va_end(ap); - } + va_start(ap, format); + str =3D g_strdup_vprintf(format, ap); + va_end(ap); + + if (ctl) + vshOutputLogFile(ctl, VSH_ERR_ERROR, str); =20 /* Most output is to stdout, but if someone ran virsh 2>&1, then * printing to stderr will not interleave correctly with stdout @@ -2130,10 +2130,6 @@ vshError(vshControl *ctl, const char *format, ...) fflush(stdout); fputs(_("error: "), stderr); =20 - va_start(ap, format); - str =3D g_strdup_vprintf(format, ap); - va_end(ap); - fprintf(stderr, "%s\n", NULLSTR(str)); fflush(stderr); } @@ -2337,8 +2333,7 @@ vshOpenLogFile(vshControl *ctl) * Outputting an error to log file. */ void -vshOutputLogFile(vshControl *ctl, int log_level, const char *msg_format, - va_list ap) +vshOutputLogFile(vshControl *ctl, int log_level, const char *msg) { g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; g_autofree char *str =3D NULL; @@ -2381,7 +2376,7 @@ vshOutputLogFile(vshControl *ctl, int log_level, cons= t char *msg_format, break; } virBufferAsprintf(&buf, "%s ", lvl); - virBufferVasprintf(&buf, msg_format, ap); + virBufferAddStr(&buf, msg); virBufferTrim(&buf, "\n"); virBufferAddChar(&buf, '\n'); =20 diff --git a/tools/vsh.h b/tools/vsh.h index 7de9fa2f09..1c7370dd4f 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -241,9 +241,7 @@ struct _vshCmdGrp { void vshError(vshControl *ctl, const char *format, ...) G_GNUC_PRINTF(2, 3); void vshOpenLogFile(vshControl *ctl); -void vshOutputLogFile(vshControl *ctl, int log_level, const char *format, - va_list ap) - G_GNUC_PRINTF(3, 0); +void vshOutputLogFile(vshControl *ctl, int log_level, const char *msg); void vshCloseLogFile(vshControl *ctl); =20 int vshCommandOptInt(vshControl *ctl, const vshCmd *cmd, --=20 2.48.1 From nobody Tue Dec 16 03:20:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740065301093240.28648336674223; Thu, 20 Feb 2025 07:28:21 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 74977224C; Thu, 20 Feb 2025 10:28:20 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 0575D2171; Thu, 20 Feb 2025 10:26:45 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 707DF1F6F; Thu, 20 Feb 2025 10:26:40 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id DE6C41F6F for ; Thu, 20 Feb 2025 10:26:28 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-418-kTtqVxTLOw684DwSh9wKXQ-1; Thu, 20 Feb 2025 10:26:27 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B03B51800982 for ; Thu, 20 Feb 2025 15:26:26 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 322EA1955BCB for ; Thu, 20 Feb 2025 15:26:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740065188; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=reLi9XzDqiyc2QlKj1WkhSnGOG7y2PjpqujEzrrvIc4=; b=QYuX/d1OVH54EasqYuC1anQtNDpIewX3C0tw9gbGPRCU8Aodup1KB+Sgs6bKCGz/xm1oA0 Hb4vT2iD52PZCdu1PW3+HUT+LmYbDpEGtx5Lhmp6qO8lMfyqMbk4DXOR+BcV4xIfcINyXf PcJCNk8hAZVm0bjYgr4rUUXalibM5DA= X-MC-Unique: kTtqVxTLOw684DwSh9wKXQ-1 X-Mimecast-MFC-AGG-ID: kTtqVxTLOw684DwSh9wKXQ_1740065186 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 04/13] virsh: Make messages printed by vshError properly translatable Date: Thu, 20 Feb 2025 16:26:06 +0100 Message-ID: <32503fc6cef3495acd564b369362e6770d17ceb8.1740064957.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 3b-px8a0IzwA9tbpcDgIjet624anDGlz4_LQfEyVh58_1740065186 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: YRULWZ33GGWIWU7DVQP5NRXV6ZAAJ5XH X-Message-ID-Hash: YRULWZ33GGWIWU7DVQP5NRXV6ZAAJ5XH X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740065301755019000 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- tools/vsh.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 1b650bdd9b..64507fe560 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -2128,9 +2128,7 @@ vshError(vshControl *ctl, const char *format, ...) * printing to stderr will not interleave correctly with stdout * unless we flush between every transition between streams. */ fflush(stdout); - fputs(_("error: "), stderr); - - fprintf(stderr, "%s\n", NULLSTR(str)); + fprintf(stderr, _("error: %1$s\n"), NULLSTR(str)); fflush(stderr); } =20 --=20 2.48.1 From nobody Tue Dec 16 03:20:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740065348122299.5368286537064; Thu, 20 Feb 2025 07:29:08 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 209302237; Thu, 20 Feb 2025 10:29:07 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 79C642206; Thu, 20 Feb 2025 10:26:53 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4A54321B4; Thu, 20 Feb 2025 10:26:48 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 2D0932214 for ; Thu, 20 Feb 2025 10:26:34 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-339-C0nH4DyCMquL8oS4sq-tGA-1; Thu, 20 Feb 2025 10:26:32 -0500 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 854081800877 for ; Thu, 20 Feb 2025 15:26:28 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 11C6A1956094 for ; Thu, 20 Feb 2025 15:26:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740065193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dMBuCUE9hH2wpHHshYpSr4mgqgchxLajFCts6GtEbQ8=; b=O35Ogn/wiSDR/Mugw6lBXSRb9ErautyB85zkvBN50ssPcSpZ3A/5KhgXoT5g2RGah73Zkp yyXWdHG+tmoE2DGMRIlZI/XPM9YnIrg5uUABDROOsKUFZAokJR2OPdrPDS7XEz03a2cay1 hPsQwLpXblOjA1CpYkvxBML38I2L8ME= X-MC-Unique: C0nH4DyCMquL8oS4sq-tGA-1 X-Mimecast-MFC-AGG-ID: C0nH4DyCMquL8oS4sq-tGA_1740065188 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 05/13] virsh: Refactor vshError Date: Thu, 20 Feb 2025 16:26:07 +0100 Message-ID: <4ab5f7c943690733574c2c499bbf18a777ce2f13.1740064957.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: k9MjU5FqHKtmeyHiv5rzR6Nbq9vL1N6wfISD6wUDjuk_1740065188 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ADABNOBPCE6EKRLQ74CID2WRWZDDGXTN X-Message-ID-Hash: ADABNOBPCE6EKRLQ74CID2WRWZDDGXTN X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740065349192019100 Content-Type: text/plain; charset="utf-8" The code is moved into a newly introduced generic vshPrintStderr and vshError changed into a tiny wrapper. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- tools/vsh.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 64507fe560..91e2ae2067 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -2111,18 +2111,18 @@ vshTTYMakeRaw(vshControl *ctl G_GNUC_UNUSED, } =20 =20 -void -vshError(vshControl *ctl, const char *format, ...) +static void G_GNUC_PRINTF(3, 0) +vshPrintStderr(vshControl *ctl, + int level, + const char *format, + va_list ap) { - va_list ap; g_autofree char *str =3D NULL; =20 - va_start(ap, format); str =3D g_strdup_vprintf(format, ap); - va_end(ap); =20 if (ctl) - vshOutputLogFile(ctl, VSH_ERR_ERROR, str); + vshOutputLogFile(ctl, level, str); =20 /* Most output is to stdout, but if someone ran virsh 2>&1, then * printing to stderr will not interleave correctly with stdout @@ -2133,6 +2133,17 @@ vshError(vshControl *ctl, const char *format, ...) } =20 =20 +void +vshError(vshControl *ctl, const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + vshPrintStderr(ctl, VSH_ERR_ERROR, format, ap); + va_end(ap); +} + + void vshEventLoop(void *opaque) { --=20 2.48.1 From nobody Tue Dec 16 03:20:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740065321305914.6983029639212; Thu, 20 Feb 2025 07:28:41 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 86274217F; Thu, 20 Feb 2025 10:28:40 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id E26732233; Thu, 20 Feb 2025 10:26:47 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 757F32195; Thu, 20 Feb 2025 10:26:42 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id C232621B9 for ; Thu, 20 Feb 2025 10:26:32 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-GTgl0CtTMVSmsLVFKC4_0A-1; Thu, 20 Feb 2025 10:26:31 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 744301800373 for ; Thu, 20 Feb 2025 15:26:30 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 01A751800947 for ; Thu, 20 Feb 2025 15:26:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740065192; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bns4GOBm3RUuB+e91ZHWHzeolgFxO/7bh5cXTUAAbjs=; b=LrB15kSItTTd9g3E8bohucM65NHFaGYhcxp3m47IxY9WmCgFn8WV3Vjtgqt899JbWf/1VF ithTFRfVTV9vwm+ud/OPWRA4gJVnpllpWW53qVw9D3iqDIe2OHtf/XGVUDEWq2mHGZDgD1 kz77F/Sfgwqy3YRv/xs3TKtgcg+H+8Y= X-MC-Unique: GTgl0CtTMVSmsLVFKC4_0A-1 X-Mimecast-MFC-AGG-ID: GTgl0CtTMVSmsLVFKC4_0A_1740065190 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 06/13] virsh: Introduce vshWarn Date: Thu, 20 Feb 2025 16:26:08 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: m7-qOGZYnor3vxLlDl67sYP-GAQ2wPB20TBUttN6otk_1740065190 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: SONJJC2AWQAK5RVJRVUV6H5G7PMDKHEB X-Message-ID-Hash: SONJJC2AWQAK5RVJRVUV6H5G7PMDKHEB X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740065321919019000 Content-Type: text/plain; charset="utf-8" This new function can be used for printing warnings about suboptimal usage. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- tools/virsh-secret.c | 2 +- tools/vsh.c | 13 ++++++++++++- tools/vsh.h | 2 ++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index d9435e4357..6655d3211e 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -235,7 +235,7 @@ cmdSecretSetValue(vshControl *ctl, const vshCmd *cmd) =20 if (base64) { /* warn users that the --base64 option passed from command line is= wrong */ - vshError(ctl, _("Passing secret value as command-line argument is = insecure!")); + vshWarn(ctl, _("Passing secret value as command-line argument is i= nsecure!")); secret_val =3D g_strdup(base64); secret_len =3D strlen(secret_val); } else if (filename) { diff --git a/tools/vsh.c b/tools/vsh.c index 91e2ae2067..812fc81bde 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -2144,6 +2144,17 @@ vshError(vshControl *ctl, const char *format, ...) } =20 =20 +void +vshWarn(vshControl *ctl, const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + vshPrintStderr(ctl, VSH_ERR_WARNING, format, ap); + va_end(ap); +} + + void vshEventLoop(void *opaque) { @@ -2501,7 +2512,7 @@ vshAskReedit(vshControl *ctl, const char *msg G_GNUC_UNUSED, bool relax_avail G_GNUC_UNUSED) { - vshDebug(ctl, VSH_ERR_WARNING, "%s", _("This function is not supported= on WIN32 platform")); + vshWarn(ctl, "%s", _("This function is not supported on WIN32 platform= ")); return 0; } #endif /* WIN32 */ diff --git a/tools/vsh.h b/tools/vsh.h index 1c7370dd4f..5970addfb6 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -240,6 +240,8 @@ struct _vshCmdGrp { =20 void vshError(vshControl *ctl, const char *format, ...) G_GNUC_PRINTF(2, 3); +void vshWarn(vshControl *ctl, const char *format, ...) + G_GNUC_PRINTF(2, 3); void vshOpenLogFile(vshControl *ctl); void vshOutputLogFile(vshControl *ctl, int log_level, const char *msg); void vshCloseLogFile(vshControl *ctl); --=20 2.48.1 From nobody Tue Dec 16 03:20:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740065368307679.379725532216; Thu, 20 Feb 2025 07:29:28 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id AE3242189; Thu, 20 Feb 2025 10:29:27 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id AD4462231; Thu, 20 Feb 2025 10:26:56 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id C2A2121AC; Thu, 20 Feb 2025 10:26:48 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id CA7B421AC for ; Thu, 20 Feb 2025 10:26:34 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-20-iptBn0w8Mr-cK1EHCTYAdw-1; Thu, 20 Feb 2025 10:26:33 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 68DE71800878 for ; Thu, 20 Feb 2025 15:26:32 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E89D619560A3 for ; Thu, 20 Feb 2025 15:26:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740065194; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=szSjZsXHlqKzody158+w4L/WUjhodfSOeSvqKLxDGTQ=; b=ApHqDJzID+WoM/BaMrVoGATrCVAv4kT19n3YThm/Hieiizu/dTWK7KGIxCHeQco3BMX/br Sz7CUqdRukyB/HKw7ncCZE7CMdzVPfXyZL4LQinyxelWsvyoY6J5xEV9hRoC2GJ4e2oogG 747/IBWI6XFNpGVplDwLdWkUluKhwGA= X-MC-Unique: iptBn0w8Mr-cK1EHCTYAdw-1 X-Mimecast-MFC-AGG-ID: iptBn0w8Mr-cK1EHCTYAdw_1740065192 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 07/13] virsh: Warn when hypervisor-cpu-* is used with host CPU Date: Thu, 20 Feb 2025 16:26:09 +0100 Message-ID: <2d0e6fb092e0f91a1e2f53cf415a0102cea59bcf.1740064957.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 03wAOVR83Goqs6C4aL2230cMRPLboJMAPUe2dqsAZck_1740065192 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 4224EP7ZEHP2IVLNRGWDPD5F7SDQDT5T X-Message-ID-Hash: 4224EP7ZEHP2IVLNRGWDPD5F7SDQDT5T X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740065370388019000 Content-Type: text/plain; charset="utf-8" While using host CPU definition from capabilities XML is allowed for historical reasons, it will likely provide incorrect results and should be avoided. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- tools/virsh-host.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tools/virsh-host.c b/tools/virsh-host.c index f4e7324f42..418bd995da 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1093,7 +1093,8 @@ cmdURI(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUS= ED) */ static char ** vshExtractCPUDefXMLs(vshControl *ctl, - const char *xmlFile) + const char *xmlFile, + bool hostCPUWarning) { g_auto(GStrv) cpus =3D NULL; g_autofree char *buffer =3D NULL; @@ -1137,6 +1138,8 @@ vshExtractCPUDefXMLs(vshControl *ctl, cpus =3D g_new0(char *, n + 1); =20 for (i =3D 0; i < n; i++) { + ctxt->node =3D nodes[i]; + /* If the user provided domain capabilities XML, we need to replace * element with . */ if (xmlStrEqual(nodes[i]->name, BAD_CAST "mode")) { @@ -1150,6 +1153,11 @@ vshExtractCPUDefXMLs(vshControl *ctl, } } =20 + if (hostCPUWarning && + virXPathBoolean("boolean(./feature[not(@policy)])", ctxt) =3D= =3D 1) { + vshWarn(ctl, "%s", _("using host CPU definition as input may p= rovide incorrect results")); + } + if (!(cpus[i] =3D virXMLNodeToString(xml, nodes[i]))) { vshSaveLibvirtError(); return NULL; @@ -1199,7 +1207,7 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptString(ctl, cmd, "file", &from) < 0) return false; =20 - if (!(cpus =3D vshExtractCPUDefXMLs(ctl, from))) + if (!(cpus =3D vshExtractCPUDefXMLs(ctl, from, false))) return false; =20 result =3D virConnectCompareCPU(priv->conn, cpus[0], flags); @@ -1268,7 +1276,7 @@ cmdCPUBaseline(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptString(ctl, cmd, "file", &from) < 0) return false; =20 - if (!(list =3D vshExtractCPUDefXMLs(ctl, from))) + if (!(list =3D vshExtractCPUDefXMLs(ctl, from, false))) return false; =20 if (!(result =3D virConnectBaselineCPU(priv->conn, (const char **)list, @@ -1612,7 +1620,7 @@ cmdHypervisorCPUCompare(vshControl *ctl, vshCommandOptString(ctl, cmd, "machine", &machine) < 0) return false; =20 - if (!(cpus =3D vshExtractCPUDefXMLs(ctl, from))) + if (!(cpus =3D vshExtractCPUDefXMLs(ctl, from, true))) return false; =20 result =3D virConnectCompareHypervisorCPU(priv->conn, emulator, arch, @@ -1736,7 +1744,7 @@ cmdHypervisorCPUBaseline(vshControl *ctl, VSH_ALTERNATIVE_OPTIONS_EXPR("file", from, "model", model); =20 if (from) { - if (!(list =3D vshExtractCPUDefXMLs(ctl, from))) + if (!(list =3D vshExtractCPUDefXMLs(ctl, from, true))) return false; } else { list =3D g_new0(char *, 2); --=20 2.48.1 From nobody Tue Dec 16 03:20:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740065422373360.64995654621885; Thu, 20 Feb 2025 07:30:22 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 3CD582256; Thu, 20 Feb 2025 10:30:21 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 37A332245; Thu, 20 Feb 2025 10:26:59 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id E17BA2206; Thu, 20 Feb 2025 10:26:52 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id CB3BC21B1 for ; Thu, 20 Feb 2025 10:26:36 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-604-1AONRk6aMC2KdWK5js7Bww-1; Thu, 20 Feb 2025 10:26:35 -0500 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 68429180087F for ; Thu, 20 Feb 2025 15:26:34 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E6B8719412A3 for ; Thu, 20 Feb 2025 15:26:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740065196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1LbB96w2HmVZ8TORmeqGUM9AIz8SyQsk8a3WJ8aX/zY=; b=O5umHqK848KO/owXbZGPPb3xCaQOiXUxt4gAr0UpLZxT/t1KuFaXZKRIrdXGOJZEYPzLOq n3uljZbzHoEak9H/bu6U7LZH6YH/DifAFc30ibbGT0vMTbjB8NT9SvCJCb+wdFnU/02az6 WWgnSc6hCbeYS70hBFv2w64zFD88LnQ= X-MC-Unique: 1AONRk6aMC2KdWK5js7Bww-1 X-Mimecast-MFC-AGG-ID: 1AONRk6aMC2KdWK5js7Bww_1740065194 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 08/13] virsh: Do not require \n in vshDebug messages Date: Thu, 20 Feb 2025 16:26:10 +0100 Message-ID: <64aeb1983143a1b506f7ece490ef3463df5a7d7c.1740064957.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: rrktRn5r6zYG6rzfUOPGuSU6P_6T98InUNZZmfqC5-Y_1740065194 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: B4VNYOHUJMSO6LVGD522TAIDOMVP2H3J X-Message-ID-Hash: B4VNYOHUJMSO6LVGD522TAIDOMVP2H3J X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740065423679019100 Content-Type: text/plain; charset="utf-8" Having to put a newline at the end of each debug message in virsh has always felt strange. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- tools/virsh-domain-monitor.c | 2 +- tools/virsh-domain.c | 32 ++++++++++++++++---------------- tools/virsh-interface.c | 6 +++--- tools/virsh-network.c | 10 +++++----- tools/virsh-nwfilter.c | 10 +++++----- tools/virsh-pool.c | 10 +++++----- tools/virsh-secret.c | 2 +- tools/virsh-util.c | 8 ++++---- tools/virsh-volume.c | 20 ++++++++++---------- tools/virsh.c | 4 ++-- tools/virt-admin.c | 2 +- tools/vsh.c | 8 ++++---- 12 files changed, 57 insertions(+), 57 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 9ee9090c11..76843005b2 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -1224,7 +1224,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd) =20 /* Check and display whether the domain is persistent or not */ persistent =3D virDomainIsPersistent(dom); - vshDebug(ctl, VSH_ERR_DEBUG, "Domain persistent flag value: %d\n", + vshDebug(ctl, VSH_ERR_DEBUG, "Domain persistent flag value: %d", persistent); if (persistent < 0) vshPrint(ctl, "%-15s %s\n", _("Persistent:"), _("unknown")); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index f3da2f903f..171bc0ce17 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4254,7 +4254,7 @@ virshWatchTimeout(gpointer opaque) struct virshWatchData *data =3D opaque; =20 /* suspend the domain when migration timeouts. */ - vshDebug(data->ctl, VSH_ERR_DEBUG, "watchJob: timeout\n"); + vshDebug(data->ctl, VSH_ERR_DEBUG, "watchJob: timeout"); if (data->timeout_func) (data->timeout_func)(data->ctl, data->dom, data->opaque); =20 @@ -4266,7 +4266,7 @@ static void virshWatchSetTimeout(struct virshWatchData *data) { vshDebug(data->ctl, VSH_ERR_DEBUG, - "watchJob: setting timeout of %d secs\n", data->timeout_secs); + "watchJob: setting timeout of %d secs", data->timeout_secs); =20 data->timeout_src =3D g_timeout_source_new_seconds(data->timeout_secs); g_source_set_callback(data->timeout_src, @@ -4291,7 +4291,7 @@ virshWatchProgress(gpointer opaque) pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask); #endif /* !WIN32 */ vshDebug(data->ctl, VSH_ERR_DEBUG, "%s", - "watchJob: progress update\n"); + "watchJob: progress update"); ret =3D virDomainGetJobInfo(data->dom, &jobinfo); #ifndef WIN32 pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL); @@ -4308,7 +4308,7 @@ virshWatchProgress(gpointer opaque) vshTTYDisableInterrupt(data->ctl); data->jobStarted =3D true; vshDebug(data->ctl, VSH_ERR_DEBUG, - "watchJob: job started\n"); + "watchJob: job started"); } =20 if (data->jobStarted) { @@ -4317,7 +4317,7 @@ virshWatchProgress(gpointer opaque) virshWatchSetTimeout(data); } else if (!data->verbose) { vshDebug(data->ctl, VSH_ERR_DEBUG, - "watchJob: disabling callback\n"); + "watchJob: disabling callback"); return G_SOURCE_REMOVE; } } @@ -4339,7 +4339,7 @@ virshWatchInterrupt(GIOChannel *source G_GNUC_UNUSED, gsize nread =3D 0; =20 vshDebug(data->ctl, VSH_ERR_DEBUG, - "watchJob: stdin data %d\n", condition); + "watchJob: stdin data %d", condition); if (condition & G_IO_IN) { g_io_channel_read_chars(data->stdin_ioc, &retchar, @@ -4348,7 +4348,7 @@ virshWatchInterrupt(GIOChannel *source G_GNUC_UNUSED, NULL); =20 vshDebug(data->ctl, VSH_ERR_DEBUG, - "watchJob: got %zu characters\n", nread); + "watchJob: got %zu characters", nread); if (nread =3D=3D 1 && vshTTYIsInterruptCharacter(data->ctl, retchar)) { virDomainAbortJob(data->dom); @@ -4407,7 +4407,7 @@ virshWatchJob(vshControl *ctl, /* don't poll on STDIN if we are not using a terminal */ if (vshTTYAvailable(ctl)) { vshDebug(ctl, VSH_ERR_DEBUG, "%s", - "watchJob: on TTY, enabling Ctrl-c processing\n"); + "watchJob: on TTY, enabling Ctrl-c processing"); #ifdef WIN32 data.stdin_ioc =3D g_io_channel_win32_new_fd(STDIN_FILENO); #else @@ -4429,7 +4429,7 @@ virshWatchJob(vshControl *ctl, g_main_loop_run(eventLoop); =20 vshDebug(ctl, VSH_ERR_DEBUG, - "watchJob: job done, status %d\n", *job_err); + "watchJob: job done, status %d", *job_err); if (*job_err =3D=3D 0 && verbose) /* print [100 %] */ virshPrintJobProgress(label, 0, 1); =20 @@ -6118,7 +6118,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) _("Optional flags or --rawstats are not supported by = the daemon")); goto cleanup; } - vshDebug(ctl, VSH_ERR_DEBUG, "detailed statistics not supported\n"= ); + vshDebug(ctl, VSH_ERR_DEBUG, "detailed statistics not supported"); vshResetLibvirtError(); rc =3D virDomainGetJobInfo(dom, &info); } @@ -11158,16 +11158,16 @@ virshMigrateTimeout(vshControl *ctl, case VIRSH_MIGRATE_TIMEOUT_DEFAULT: /* unreachable */ case VIRSH_MIGRATE_TIMEOUT_SUSPEND: vshDebug(ctl, VSH_ERR_DEBUG, - "migration timed out; suspending domain\n"); + "migration timed out; suspending domain"); if (virDomainSuspend(dom) < 0) - vshDebug(ctl, VSH_ERR_INFO, "suspending domain failed\n"); + vshDebug(ctl, VSH_ERR_INFO, "suspending domain failed"); break; =20 case VIRSH_MIGRATE_TIMEOUT_POSTCOPY: vshDebug(ctl, VSH_ERR_DEBUG, - "migration timed out; switching to post-copy\n"); + "migration timed out; switching to post-copy"); if (virDomainMigrateStartPostCopy(dom, 0) < 0) - vshDebug(ctl, VSH_ERR_INFO, "switching to post-copy failed\n"); + vshDebug(ctl, VSH_ERR_INFO, "switching to post-copy failed"); break; } } @@ -11182,10 +11182,10 @@ virshMigrateIteration(virConnectPtr conn G_GNUC_U= NUSED, =20 if (iteration =3D=3D 2) { vshDebug(ctl, VSH_ERR_DEBUG, - "iteration %d finished; switching to post-copy\n", + "iteration %d finished; switching to post-copy", iteration - 1); if (virDomainMigrateStartPostCopy(dom, 0) < 0) - vshDebug(ctl, VSH_ERR_INFO, "switching to post-copy failed\n"); + vshDebug(ctl, VSH_ERR_INFO, "switching to post-copy failed"); } } =20 diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index fda6d55158..7e3103adf1 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -61,7 +61,7 @@ virshCommandOptInterfaceBy(vshControl *ctl, const vshCmd = *cmd, if (vshCommandOptString(ctl, cmd, optname, &n) < 0) return NULL; =20 - vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n", + vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s", cmd->def->name, optname, n); =20 if (name) @@ -72,13 +72,13 @@ virshCommandOptInterfaceBy(vshControl *ctl, const vshCm= d *cmd, =20 /* try it by NAME */ if (!is_mac && (flags & VIRSH_BYNAME)) { - vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as interface NAME\n", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as interface NAME", cmd->def->name, optname); iface =3D virInterfaceLookupByName(priv->conn, n); =20 /* try it by MAC */ } else if (is_mac && (flags & VIRSH_BYMAC)) { - vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as interface MAC\n", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as interface MAC", cmd->def->name, optname); iface =3D virInterfaceLookupByMACString(priv->conn, n); } diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 6fcc7fd8ee..da396c0002 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -68,7 +68,7 @@ virshCommandOptNetworkBy(vshControl *ctl, const vshCmd *c= md, if (vshCommandOptString(ctl, cmd, optname, &n) < 0) return NULL; =20 - vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n", + vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s", cmd->def->name, optname, n); =20 if (name) @@ -76,13 +76,13 @@ virshCommandOptNetworkBy(vshControl *ctl, const vshCmd = *cmd, =20 /* try it by UUID */ if ((flags & VIRSH_BYUUID) && strlen(n) =3D=3D VIR_UUID_STRING_BUFLEN-= 1) { - vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as network UUID\n", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as network UUID", cmd->def->name, optname); network =3D virNetworkLookupByUUIDString(priv->conn, n); } /* try it by NAME */ if (!network && (flags & VIRSH_BYNAME)) { - vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as network NAME\n", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as network NAME", cmd->def->name, optname); network =3D virNetworkLookupByName(priv->conn, n); } @@ -106,13 +106,13 @@ virshCommandOptNetworkPort(vshControl *ctl, const vsh= Cmd *cmd, if (vshCommandOptString(ctl, cmd, optname, &n) < 0) return NULL; =20 - vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n", + vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s", cmd->def->name, optname, n); =20 if (name) *name =3D n; =20 - vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as network UUID\n", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as network UUID", cmd->def->name, optname); port =3D virNetworkPortLookupByUUIDString(net, n); =20 diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index 56133d6566..3745abb67e 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -41,7 +41,7 @@ virshCommandOptNWFilterBy(vshControl *ctl, const vshCmd *= cmd, if (vshCommandOptString(ctl, cmd, optname, &n) < 0) return NULL; =20 - vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n", + vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s", cmd->def->name, optname, n); =20 if (name) @@ -49,13 +49,13 @@ virshCommandOptNWFilterBy(vshControl *ctl, const vshCmd= *cmd, =20 /* try it by UUID */ if ((flags & VIRSH_BYUUID) && strlen(n) =3D=3D VIR_UUID_STRING_BUFLEN-= 1) { - vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as nwfilter UUID\n", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as nwfilter UUID", cmd->def->name, optname); nwfilter =3D virNWFilterLookupByUUIDString(priv->conn, n); } /* try it by NAME */ if (!nwfilter && (flags & VIRSH_BYNAME)) { - vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as nwfilter NAME\n", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as nwfilter NAME", cmd->def->name, optname); nwfilter =3D virNWFilterLookupByName(priv->conn, n); } @@ -450,13 +450,13 @@ virshCommandOptNWFilterBindingBy(vshControl *ctl, if (vshCommandOptString(ctl, cmd, optname, &n) < 0) return NULL; =20 - vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n", + vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s", cmd->def->name, optname, n); =20 if (name) *name =3D n; =20 - vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as nwfilter binding port= dev\n", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as nwfilter binding port= dev", cmd->def->name, optname); binding =3D virNWFilterBindingLookupByPortDev(priv->conn, n); =20 diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 4cd7b7ba0b..33b130564e 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -186,7 +186,7 @@ virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cm= d, const char *optname, if (cmd->skipChecks && !n) return NULL; =20 - vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n", + vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s", cmd->def->name, optname, n); =20 if (name) @@ -194,13 +194,13 @@ virshCommandOptPoolBy(vshControl *ctl, const vshCmd *= cmd, const char *optname, =20 /* try it by UUID */ if ((flags & VIRSH_BYUUID) && strlen(n) =3D=3D VIR_UUID_STRING_BUFLEN-= 1) { - vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as pool UUID\n", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as pool UUID", cmd->def->name, optname); pool =3D virStoragePoolLookupByUUIDString(priv->conn, n); } /* try it by NAME */ if (!pool && (flags & VIRSH_BYNAME)) { - vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as pool NAME\n", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as pool NAME", cmd->def->name, optname); pool =3D virStoragePoolLookupByName(priv->conn, n); } @@ -1211,7 +1211,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC= _UNUSED) /* Retrieve the persistence status of the pool */ if (details) { persistent =3D virStoragePoolIsPersistent(list->pools[i]); - vshDebug(ctl, VSH_ERR_DEBUG, "Persistent flag value: %d\n", + vshDebug(ctl, VSH_ERR_DEBUG, "Persistent flag value: %d", persistent); if (persistent < 0) poolInfoTexts[i].persistent =3D g_strdup(_("unknown")); @@ -1545,7 +1545,7 @@ cmdPoolInfo(vshControl *ctl, const vshCmd *cmd) =20 /* Check and display whether the pool is persistent or not */ persistent =3D virStoragePoolIsPersistent(pool); - vshDebug(ctl, VSH_ERR_DEBUG, "Pool persistent flag value: %d\n", + vshDebug(ctl, VSH_ERR_DEBUG, "Pool persistent flag value: %d", persistent); if (persistent < 0) vshPrint(ctl, "%-15s %s\n", _("Persistent:"), _("unknown")); diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index 6655d3211e..7c81c10845 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -45,7 +45,7 @@ virshCommandOptSecret(vshControl *ctl, const vshCmd *cmd,= const char **name) return NULL; =20 vshDebug(ctl, VSH_ERR_DEBUG, - "%s: found option <%s>: %s\n", cmd->def->name, optname, n); + "%s: found option <%s>: %s", cmd->def->name, optname, n); =20 if (name !=3D NULL) *name =3D n; diff --git a/tools/virsh-util.c b/tools/virsh-util.c index ab350f0326..55ab71f26a 100644 --- a/tools/virsh-util.c +++ b/tools/virsh-util.c @@ -39,7 +39,7 @@ virshLookupDomainInternal(vshControl *ctl, /* try it by ID */ if (flags & VIRSH_BYID) { if (virStrToLong_i(name, NULL, 10, &id) =3D=3D 0 && id >=3D 0) { - vshDebug(ctl, VSH_ERR_DEBUG, "%s: looks like ID\n", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: looks like ID", cmdname); dom =3D virDomainLookupByID(priv->conn, id); } @@ -48,14 +48,14 @@ virshLookupDomainInternal(vshControl *ctl, /* try it by UUID */ if (!dom && (flags & VIRSH_BYUUID) && strlen(name) =3D=3D VIR_UUID_STRING_BUFLEN-1) { - vshDebug(ctl, VSH_ERR_DEBUG, "%s: trying as domain UUID\n= ", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: trying as domain UUID", cmdname); dom =3D virDomainLookupByUUIDString(priv->conn, name); } =20 /* try it by NAME */ if (!dom && (flags & VIRSH_BYNAME)) { - vshDebug(ctl, VSH_ERR_DEBUG, "%s: trying as domain NAME\n= ", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: trying as domain NAME", cmdname); dom =3D virDomainLookupByName(priv->conn, name); } @@ -90,7 +90,7 @@ virshCommandOptDomainBy(vshControl *ctl, if (vshCommandOptString(ctl, cmd, optname, &n) < 0) return NULL; =20 - vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n", + vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s", cmd->def->name, optname, n); =20 if (name) diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 8805b8c06b..430961fef2 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -109,7 +109,7 @@ virshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd, } } =20 - vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s", cmd->def->name, optname, n); =20 if (name) @@ -117,19 +117,19 @@ virshCommandOptVolBy(vshControl *ctl, const vshCmd *c= md, =20 /* try it by name */ if (pool && (flags & VIRSH_BYNAME)) { - vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as vol name\n", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as vol name", cmd->def->name, optname); vol =3D virStorageVolLookupByName(pool, n); } /* try it by key */ if (!vol && (flags & VIRSH_BYUUID)) { - vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as vol key\n", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as vol key", cmd->def->name, optname); vol =3D virStorageVolLookupByKey(priv->conn, n); } /* try it by path */ if (!vol && (flags & VIRSH_BYUUID)) { - vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as vol path\n", + vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as vol path", cmd->def->name, optname); vol =3D virStorageVolLookupByPath(priv->conn, n); } @@ -293,36 +293,36 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd) /* Lookup snapshot backing volume. Try the backing-vol * parameter as a name */ vshDebug(ctl, VSH_ERR_DEBUG, - "%s: Look up backing store volume '%s' as name\n", + "%s: Look up backing store volume '%s' as name", cmd->def->name, snapshotStrVol); snapVol =3D virStorageVolLookupByName(pool, snapshotStrVol); if (snapVol) vshDebug(ctl, VSH_ERR_DEBUG, - "%s: Backing store volume found using '%s' as nam= e\n", + "%s: Backing store volume found using '%s' as nam= e", cmd->def->name, snapshotStrVol); =20 if (snapVol =3D=3D NULL) { /* Snapshot backing volume not found by name. Try the * backing-vol parameter as a key */ vshDebug(ctl, VSH_ERR_DEBUG, - "%s: Look up backing store volume '%s' as key\n", + "%s: Look up backing store volume '%s' as key", cmd->def->name, snapshotStrVol); snapVol =3D virStorageVolLookupByKey(priv->conn, snapshotStrVo= l); if (snapVol) vshDebug(ctl, VSH_ERR_DEBUG, - "%s: Backing store volume found using '%s' as key= \n", + "%s: Backing store volume found using '%s' as key= ", cmd->def->name, snapshotStrVol); } if (snapVol =3D=3D NULL) { /* Snapshot backing volume not found by key. Try the * backing-vol parameter as a path */ vshDebug(ctl, VSH_ERR_DEBUG, - "%s: Look up backing store volume '%s' as path\n", + "%s: Look up backing store volume '%s' as path", cmd->def->name, snapshotStrVol); snapVol =3D virStorageVolLookupByPath(priv->conn, snapshotStrV= ol); if (snapVol) vshDebug(ctl, VSH_ERR_DEBUG, - "%s: Backing store volume found using '%s' as pat= h\n", + "%s: Backing store volume found using '%s' as pat= h", cmd->def->name, snapshotStrVol); } if (snapVol =3D=3D NULL) { diff --git a/tools/virsh.c b/tools/virsh.c index a958f2b82f..6abae3dae9 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -165,7 +165,7 @@ virshConnect(vshControl *ctl, const char *uri, bool rea= donly) goto cleanup; } vshDebug(ctl, VSH_ERR_INFO, "%s", - _("Failed to setup keepalive on connection\n")); + _("Failed to setup keepalive on connection")); vshResetLibvirtError(); } =20 @@ -769,7 +769,7 @@ virshParseArgv(vshControl *ctl, int argc, char **argv) /* parse command */ ctl->imode =3D false; if (argc - optind =3D=3D 1) { - vshDebug(ctl, VSH_ERR_INFO, "commands: \"%s\"\n", argv[optind]= ); + vshDebug(ctl, VSH_ERR_INFO, "commands: \"%s\"", argv[optind]); return vshCommandStringParse(ctl, argv[optind], NULL); } else { return vshCommandArgvParse(ctl, argc - optind, argv + optind); diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 325b7aa827..16c9b2173a 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -1332,7 +1332,7 @@ vshAdmParseArgv(vshControl *ctl, int argc, char **arg= v) /* parse command */ ctl->imode =3D false; if (argc - optind =3D=3D 1) { - vshDebug(ctl, VSH_ERR_INFO, "commands: \"%s\"\n", argv[optind]= ); + vshDebug(ctl, VSH_ERR_INFO, "commands: \"%s\"", argv[optind]); return vshCommandStringParse(ctl, argv[optind], NULL); } else { return vshCommandArgvParse(ctl, argc - optind, argv + optind); diff --git a/tools/vsh.c b/tools/vsh.c index 812fc81bde..fb00cc40a6 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -542,7 +542,7 @@ vshCmdOptAssign(vshControl *ctl, case VSH_OT_BOOL: /* nothing to do */ if (report) { - vshDebug(ctl, VSH_ERR_INFO, "%s: %s(bool)\n", + vshDebug(ctl, VSH_ERR_INFO, "%s: %s(bool)", cmd->def->name, opt->def->name); } break; @@ -550,7 +550,7 @@ vshCmdOptAssign(vshControl *ctl, case VSH_OT_STRING: case VSH_OT_INT: if (report) { - vshDebug(ctl, VSH_ERR_INFO, "%s: %s(optdata): %s\n", + vshDebug(ctl, VSH_ERR_INFO, "%s: %s(optdata): %s", cmd->def->name, opt->def->name, NULLSTR(val)); } =20 @@ -559,7 +559,7 @@ vshCmdOptAssign(vshControl *ctl, =20 case VSH_OT_ARGV: if (report) { - vshDebug(ctl, VSH_ERR_INFO, "%s: %s(argv: %zu): %s\n", + vshDebug(ctl, VSH_ERR_INFO, "%s: %s(argv: %zu): %s", cmd->def->name, opt->def->name, opt->nargv, NULLSTR(v= al)); } =20 @@ -1973,7 +1973,7 @@ vshDebug(vshControl *ctl, int level, const char *form= at, ...) =20 vshOutputLogFile(ctl, level, str); =20 - fputs(str, stdout); + fprintf(stderr, "%s\n", str); fflush(stdout); } =20 --=20 2.48.1 From nobody Tue Dec 16 03:20:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740065462276706.1190579316557; Thu, 20 Feb 2025 07:31:02 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 2B48C21EC; Thu, 20 Feb 2025 10:31:01 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 95A322243; Thu, 20 Feb 2025 10:27:00 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 114122224; Thu, 20 Feb 2025 10:26:53 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id AAA6B1F66 for ; Thu, 20 Feb 2025 10:26:38 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-660-PnjgmrXGOfuYrUIKglAjag-1; Thu, 20 Feb 2025 10:26:37 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 555F91801A2E for ; Thu, 20 Feb 2025 15:26:36 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D8EE41800362 for ; Thu, 20 Feb 2025 15:26:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740065198; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rt11ByWzbL+rRoLrcaTKj9TYL3TzajXWUo0XtCe3PqU=; b=FAxi5+hN6SjMY/fefkyw2UniCnZoIowJKKTUsM+nF9So3uiJ9tnTLrfpPoneQoHgxms2Tl F9KBf54+l6+hAJ4yu2kCrEkPjcpIXgnZsnsNpwKQq0fAXxhRNeh100c+dSNdyQNMcQj0js jgLbSLc6dQdrQE2GU8mVTViI/CcNWb8= X-MC-Unique: PnjgmrXGOfuYrUIKglAjag-1 X-Mimecast-MFC-AGG-ID: PnjgmrXGOfuYrUIKglAjag_1740065196 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 09/13] virsh: Properly mark all error messages for translation Date: Thu, 20 Feb 2025 16:26:11 +0100 Message-ID: <505b7df8dc5a665abfbb81b0543a67cad538467b.1740064957.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: sN4KXjkZczYpuvbxGUy2_9S6rdYmL06qKiKKMt_h3kM_1740065196 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: HOPDJWURT73BM3KDDJFVYFNK3BGFHTV6 X-Message-ID-Hash: HOPDJWURT73BM3KDDJFVYFNK3BGFHTV6 X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740065463992019100 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- tools/virsh-domain-monitor.c | 6 ++--- tools/virsh-domain.c | 12 ++++----- tools/virsh-host.c | 2 +- tools/virsh-nodedev.c | 6 ++--- tools/virsh-secret.c | 2 +- tools/virsh.c | 4 +-- tools/virt-admin.c | 4 +-- tools/vsh.c | 50 +++++++++++++++++++----------------- 8 files changed, 45 insertions(+), 41 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 76843005b2..150e6ec806 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -452,7 +452,7 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd) =20 all =3D vshCommandOptBool(cmd, "all"); if (!all && vshCommandOptStringQuiet(ctl, cmd, "device", &device) <=3D= 0) { - vshError(ctl, "command 'domblkinfo' requires option"); + vshError(ctl, "%s", _("command 'domblkinfo' requires opti= on")); return false; } =20 @@ -604,7 +604,7 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd) =20 target =3D virXPathString("string(./target/@dev)", ctxt); if (!target) { - vshError(ctl, "unable to query block list"); + vshError(ctl, "%s", _("unable to query block list")); return false; } =20 @@ -616,7 +616,7 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd) if (!(namespace =3D virXPathString("string(./source/@namespace= )", ctxt)) || !(addrNode =3D virXPathNode("./source/address", ctxt)) || virPCIDeviceAddressParseXML(addrNode, &addr) < 0) { - vshError(ctl, "Unable to query NVMe disk address"); + vshError(ctl, "%s", _("Unable to query NVMe disk address")= ); return false; } =20 diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 171bc0ce17..e20888f2c2 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -7915,7 +7915,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd) goto failed_stats; =20 if (cpu >=3D max_id) { - vshError(ctl, "Start CPU %d is out of range (min: 0, max: %d)", + vshError(ctl, _("Start CPU %1$d is out of range (min: 0, max: %2$d= )"), cpu, max_id - 1); goto cleanup; } @@ -9787,7 +9787,7 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd *= cmd) resultjson =3D virJSONValueFromString(result); =20 if (returnval && !resultjson) { - vshError(ctl, "failed to parse JSON returned by qemu"); + vshError(ctl, "%s", _("failed to parse JSON returned by qemu")= ); return false; } } @@ -9800,7 +9800,7 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd *= cmd) =20 if (returnval) { if (!(formatjson =3D virJSONValueObjectGet(resultjson, "return")))= { - vshError(ctl, "'return' member missing"); + vshError(ctl, "%s", _("'return' member missing")); return false; } } else { @@ -10859,7 +10859,7 @@ doMigrate(void *opaque) =20 if (flags & VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES && !(flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_IN= C))) { - vshError(ctl, "'--copy-storage-synchronous-writes' requires one of= '--copy-storage-all', '--copy-storage-inc'"); + vshError(ctl, "%s", _("'--copy-storage-synchronous-writes' require= s one of '--copy-storage-all', '--copy-storage-inc'")); goto out; } =20 @@ -10918,7 +10918,7 @@ doMigrate(void *opaque) g_autofree char **val =3D NULL; =20 if (!(flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARE= D_INC))) { - vshError(ctl, "'--migrate-disks' requires one of '--copy-stora= ge-all', '--copy-storage-inc'"); + vshError(ctl, "%s", _("'--migrate-disks' requires one of '--co= py-storage-all', '--copy-storage-inc'")); goto out; } =20 @@ -10939,7 +10939,7 @@ doMigrate(void *opaque) g_autofree char **val =3D NULL; =20 if (!(flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARE= D_INC))) { - vshError(ctl, "'--migrate-disks-detect-zeroes' requires one of= '--copy-storage-all', '--copy-storage-inc'"); + vshError(ctl, "%s", _("'--migrate-disks-detect-zeroes' require= s one of '--copy-storage-all', '--copy-storage-inc'")); goto out; } =20 diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 418bd995da..1b992e70f6 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -455,7 +455,7 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd) =20 if (rv =3D=3D 0) { vshError(ctl, - "Could not get count of free %uKiB pages, no data ret= urned", + _("Could not get count of free %1$uKiB pages, no data= returned"), *pagesize); goto cleanup; } diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index e759b9f629..7ae6127513 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -129,7 +129,7 @@ vshFindNodeDevice(vshControl *ctl, const char *value) } =20 if (!dev) { - vshError(ctl, "%s '%s'", _("Could not find matching device"), valu= e); + vshError(ctl, _("Could not find matching device '%1$s'"), value); return NULL; } =20 @@ -969,8 +969,8 @@ cmdNodeDeviceEvent(vshControl *ctl, const vshCmd *cmd) =20 if (device_value) { if (!(dev =3D virNodeDeviceLookupByName(priv->conn, device_value))= ) { - vshError(ctl, "%s '%s'", - _("Could not find matching device"), device_value); + vshError(ctl, _("Could not find matching device '%1$s'"), + device_value); goto cleanup; } } diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index 7c81c10845..3a4160107b 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -320,7 +320,7 @@ cmdSecretGetValue(vshControl *ctl, const vshCmd *cmd) if (plain) { if (fwrite(value, 1, value_size, stdout) !=3D value_size) { virSecureErase(value, value_size); - vshError(ctl, "failed to write secret"); + vshError(ctl, "%s", _("failed to write secret")); return false; } } else { diff --git a/tools/virsh.c b/tools/virsh.c index 6abae3dae9..090fdb2017 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -657,8 +657,8 @@ virshParseArgv(vshControl *ctl, int argc, char **argv) break; case 'd': if (virStrToLong_i(optarg, NULL, 10, &debug) < 0) { - vshError(ctl, _("option %1$s takes a numeric argument"), - longindex =3D=3D -1 ? "-d" : "--debug"); + const char *optStr =3D longindex =3D=3D -1 ? "-d" : "--deb= ug"; + vshError(ctl, _("option %1$s takes a numeric argument"), o= ptStr); exit(EXIT_FAILURE); } if (debug < VSH_ERR_DEBUG || debug > VSH_ERR_ERROR) diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 16c9b2173a..fe2868d379 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -1271,8 +1271,8 @@ vshAdmParseArgv(vshControl *ctl, int argc, char **arg= v) break; case 'd': if (virStrToLong_i(optarg, NULL, 10, &debug) < 0) { - vshError(ctl, _("option %1$s takes a numeric argument"), - longindex =3D=3D -1 ? "-d" : "--debug"); + const char *optStr =3D longindex =3D=3D -1 ? "-d" : "--deb= ug"; + vshError(ctl, _("option %1$s takes a numeric argument"), o= ptStr); exit(EXIT_FAILURE); } if (debug < VSH_ERR_DEBUG || debug > VSH_ERR_ERROR) diff --git a/tools/vsh.c b/tools/vsh.c index fb00cc40a6..fd6156ea76 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -280,34 +280,34 @@ vshCmddefCheckInternals(vshControl *ctl, const vshCmdDef *alias; =20 if (!(alias =3D vshCmddefSearch(cmd->alias))) { - vshError(ctl, "command alias '%s' is pointing to a non-existen= t command '%s'", + vshError(ctl, _("command alias '%1$s' is pointing to a non-exi= stent command '%2$s'"), cmd->name, cmd->alias); return -1; } =20 if (alias->alias) { - vshError(ctl, "command alias '%s' is pointing to another comma= nd alias '%s'", + vshError(ctl, _("command alias '%1$s' is pointing to another c= ommand alias '%2$s'"), cmd->name, cmd->alias); return -1; } =20 if (cmd->handler) { - vshError(ctl, "command '%s' has handler set", cmd->name); + vshError(ctl, _("command '%1$s' has handler set"), cmd->name); return -1; } =20 if (cmd->opts) { - vshError(ctl, "command '%s' has options set", cmd->name); + vshError(ctl, _("command '%1$s' has options set"), cmd->name); return -1; } =20 if (cmd->info) { - vshError(ctl, "command '%s' has info set", cmd->name); + vshError(ctl, _("command '%1$s' has info set"), cmd->name); return -1; } =20 if (cmd->flags !=3D 0) { - vshError(ctl, "command '%s' has multiple flags set", cmd->name= ); + vshError(ctl, _("command '%1$s' has multiple flags set"), cmd-= >name); return -1; } =20 @@ -317,7 +317,7 @@ vshCmddefCheckInternals(vshControl *ctl, =20 /* Each command has to provide a non-empty help string. */ if (!cmd->info || !cmd->info->help || !*cmd->info->help) { - vshError(ctl, "command '%s' lacks help", cmd->name); + vshError(ctl, _("command '%1$s' lacks help"), cmd->name); return -1; } =20 @@ -348,7 +348,7 @@ vshCmddefCheckInternals(vshControl *ctl, /* allow at most one optional positional option */ if (opt->positional && !opt->required) { if (seenOptionalPositionalOption) { - vshError(ctl, "multiple optional positional arguments (%s,= %s) of command '%s' are not allowed", + vshError(ctl, _("multiple optional positional arguments (%= 1$s, %2$s) of command '%3$s' are not allowed"), seenOptionalPositionalOption, opt->name, cmd->nam= e); return -1; } @@ -358,45 +358,45 @@ vshCmddefCheckInternals(vshControl *ctl, =20 /* all optional positional arguments must be defined after the req= uired ones */ if (seenOptionalPositionalOption && opt->positional && opt->requir= ed) { - vshError(ctl, "required positional argument '%s' declared afte= r an optional positional argument '%s' of command '%s'", + vshError(ctl, _("required positional argument '%1$s' declared = after an optional positional argument '%2$s' of command '%3$s'"), opt->name, seenOptionalPositionalOption, cmd->name); return -1; } =20 /* Mandate no completer flags if no completer is specified */ if (opt->completer_flags !=3D 0 && !opt->completer) { - vshError(ctl, "completer_flags of argument '%s' of command '%s= ' must be 0 if no completer is used", + vshError(ctl, _("completer_flags of argument '%1$s' of command= '%2$s' must be 0 if no completer is used"), opt->name, cmd->name); return -1; } =20 if (opt->unwanted_positional && opt->positional) { - vshError(ctl, "unwanted_positional flag of argument '%s' of co= mmand '%s' must not be used together with positional", + vshError(ctl, _("unwanted_positional flag of argument '%1$s' o= f command '%2$s' must not be used together with positional"), opt->name, cmd->name); return -1; } =20 switch (opt->type) { case VSH_OT_NONE: - vshError(ctl, "invalid type 'NONE' of option '%s' of command '= %s'", + vshError(ctl, _("invalid type 'NONE' of option '%1$s' of comma= nd '%2$s'"), opt->name, cmd->name); return -1; =20 case VSH_OT_BOOL: if (opt->completer) { - vshError(ctl, "bool parameter '%s' of command '%s' has com= pleter set", + vshError(ctl, _("bool parameter '%1$s' of command '%2$s' h= as completer set"), opt->name, cmd->name); return -1; } =20 if (opt->positional || opt->unwanted_positional) { - vshError(ctl, "boolean parameter '%s' of command '%s' must= not be positional", + vshError(ctl, _("boolean parameter '%1$s' of command '%2$s= ' must not be positional"), opt->name, cmd->name); return -1; } =20 if (opt->required) { - vshError(ctl, "parameter '%s' of command '%s' misused 'req= uired' flag", + vshError(ctl, _("parameter '%1$s' of command '%2$s' misuse= d 'required' flag"), opt->name, cmd->name); return -1; /* bool can't be mandatory */ } @@ -413,7 +413,7 @@ vshCmddefCheckInternals(vshControl *ctl, opt->unwanted_positional || opt->completer || !opt->help) { - vshError(ctl, "parameter '%s' of command '%s' has incorrec= t alias option", + vshError(ctl, _("parameter '%1$s' of command '%2$s' has in= correct alias option"), opt->name, cmd->name); return -1; } @@ -429,13 +429,13 @@ vshCmddefCheckInternals(vshControl *ctl, if (p) { /* If alias comes with value, replacement must not be bool= */ if (cmd->opts[j].type =3D=3D VSH_OT_BOOL) { - vshError(ctl, "alias '%s' of command '%s' has mismatch= ed alias type", + vshError(ctl, _("alias '%1$s' of command '%2$s' has mi= smatched alias type"), opt->name, cmd->name); return -1; } } if (!cmd->opts[j].name) { - vshError(ctl, "alias '%s' of command '%s' has missing alia= s option", + vshError(ctl, _("alias '%1$s' of command '%2$s' has missin= g alias option"), opt->name, cmd->name); return -1; } @@ -444,7 +444,7 @@ vshCmddefCheckInternals(vshControl *ctl, =20 case VSH_OT_ARGV: if (cmd->opts[i + 1].name) { - vshError(ctl, "parameter '%s' of command '%s' must be list= ed last", + vshError(ctl, _("parameter '%1$s' of command '%2$s' must b= e listed last"), opt->name, cmd->name); return -1; } @@ -453,7 +453,7 @@ vshCmddefCheckInternals(vshControl *ctl, case VSH_OT_INT: case VSH_OT_STRING: if (opt->positional && seenOptionalOption) { - vshError(ctl, "parameter '%s' of command '%s' must be list= ed before optional parameters", + vshError(ctl, _("parameter '%1$s' of command '%2$s' must b= e listed before optional parameters"), opt->name, cmd->name); return -1; } @@ -2424,9 +2424,13 @@ vshCloseLogFile(vshControl *ctl) { /* log file close */ if (VIR_CLOSE(ctl->log_fd) < 0) { - vshError(ctl, _("%1$s: failed to write log file: %2$s"), - ctl->logfile ? ctl->logfile : "?", - g_strerror(errno)); + if (ctl->logfile) { + vshError(ctl, _("%1$s: failed to write log file: %2$s"), + ctl->logfile, g_strerror(errno)); + } else { + vshError(ctl, _("failed to write log file: %1$s"), + g_strerror(errno)); + } } =20 g_clear_pointer(&ctl->logfile, g_free); --=20 2.48.1 From nobody Tue Dec 16 03:20:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740065520904243.90096181289346; Thu, 20 Feb 2025 07:32:00 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 3E3D52275; Thu, 20 Feb 2025 10:32:00 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id CA1B92196; Thu, 20 Feb 2025 10:27:03 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id DC1902195; Thu, 20 Feb 2025 10:26:54 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 0CB6321A9 for ; Thu, 20 Feb 2025 10:26:41 -0500 (EST) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-668-Hr2biyZJNmaPQXegJYqVvw-1; Thu, 20 Feb 2025 10:26:39 -0500 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 96E4D18D95FE for ; Thu, 20 Feb 2025 15:26:38 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E71C619412A3 for ; Thu, 20 Feb 2025 15:26:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740065200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kKiZgBQZKuonJIMcLyavItFWbm5zxL2gcC1EehNSmHo=; b=EaorYvzt33bV88NtqPmRkKo8CEieLIftkq9Iy4JpeMlZyLjXV0XEYy3FnWFDfBZzXZ5hqB EJc7OT3D1+Q0F9rPRgFsKzrrmeFYQGKxOVBwvai4gelGkm5le77f2IJulbl9PbtiFdHIO/ oHczAJrwLuAtoscIIHEaSrxE50v/xqM= X-MC-Unique: Hr2biyZJNmaPQXegJYqVvw-1 X-Mimecast-MFC-AGG-ID: Hr2biyZJNmaPQXegJYqVvw_1740065198 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 10/13] virsh: Avoid using translated messages without format Date: Thu, 20 Feb 2025 16:26:12 +0100 Message-ID: <396931877b231d70441dda167c9ba6c1b7c56cef.1740064957.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: tvposPT_ObeTNMywFhuCjJ5Qm9UaTvFyoUmf-rcTACI_1740065198 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 7Z7GTPI2VTLFWXYHKW6QVHR6ACQWYIIZ X-Message-ID-Hash: 7Z7GTPI2VTLFWXYHKW6QVHR6ACQWYIIZ X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740065523336019000 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- tools/virsh-domain-monitor.c | 8 ++-- tools/virsh-domain.c | 72 ++++++++++++++++++------------------ tools/virsh-host.c | 2 +- tools/virsh-secret.c | 4 +- tools/virsh-snapshot.c | 2 +- tools/virsh-util.c | 8 ++-- tools/virsh-volume.c | 4 +- tools/virsh.c | 2 +- tools/virt-admin.c | 10 ++--- 9 files changed, 56 insertions(+), 56 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 150e6ec806..fa1c05ac77 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -783,7 +783,7 @@ cmdDomIfGetLink(vshControl *ctl, const vshCmd *cmd) iface); =20 if ((ninterfaces =3D virXPathNodeSet(xpath, ctxt, &interfaces)) < 0) { - vshError(ctl, _("Failed to extract interface information")); + vshError(ctl, "%s", _("Failed to extract interface information")); return false; } =20 @@ -795,7 +795,7 @@ cmdDomIfGetLink(vshControl *ctl, const vshCmd *cmd) =20 return false; } else if (ninterfaces > 1) { - vshError(ctl, _("multiple matching interfaces found")); + vshError(ctl, "%s", _("multiple matching interfaces found")); return false; } =20 @@ -1386,7 +1386,7 @@ cmdDomTime(vshControl *ctl, const vshCmd *cmd) =20 if (doSet || now || rtcSync) { if (now && ((seconds =3D time(NULL)) =3D=3D (time_t) -1)) { - vshError(ctl, _("Unable to get current time")); + vshError(ctl, "%s", _("Unable to get current time")); return false; } =20 @@ -2288,7 +2288,7 @@ cmdDomIfAddr(vshControl *ctl, const vshCmd *cmd) return false; =20 if ((ifaces_count =3D virDomainInterfaceAddresses(dom, &ifaces, source= , 0)) < 0) { - vshError(ctl, _("Failed to query for interfaces addresses")); + vshError(ctl, "%s", _("Failed to query for interfaces addresses")); goto cleanup; } =20 diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index e20888f2c2..2db88a1a7d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -540,7 +540,7 @@ cmdAttachDiskFormatAddress(vshControl *ctl, struct virshAddress diskAddr; =20 if (virshAddressParse(straddr, multifunction, &diskAddr) < 0) { - vshError(ctl, _("Invalid address.")); + vshError(ctl, "%s", _("Invalid address.")); return -1; } =20 @@ -689,7 +689,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd) } =20 if ((type =3D=3D VIRSH_ATTACH_DISK_SOURCE_TYPE_NETWORK) !=3D !!source_= protocol) { - vshError(ctl, _("--source-protocol option requires --sourcetype ne= twork")); + vshError(ctl, "%s", _("--source-protocol option requires --sourcet= ype network")); return false; } =20 @@ -992,7 +992,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd) if (virshParseRateStr(ctl, inboundStr, &inbound) < 0) return false; if (!inbound.average && !inbound.floor) { - vshError(ctl, _("either inbound average or floor is mandatory"= )); + vshError(ctl, "%s", _("either inbound average or floor is mand= atory")); return false; } } @@ -1000,11 +1000,11 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *c= md) if (virshParseRateStr(ctl, outboundStr, &outbound) < 0) return false; if (outbound.average =3D=3D 0) { - vshError(ctl, _("outbound average is mandatory")); + vshError(ctl, "%s", _("outbound average is mandatory")); return false; } if (outbound.floor) { - vshError(ctl, _("outbound floor is unsupported yet")); + vshError(ctl, "%s", _("outbound floor is unsupported yet")); return false; } } @@ -1048,7 +1048,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd) =20 case VIR_DOMAIN_NET_TYPE_VHOSTUSER: if (sourceMode < 0) { - vshError(ctl, _("source-mode is mandatory")); + vshError(ctl, "%s", _("source-mode is mandatory")); return false; } virBufferAsprintf(&buf, "\n", @@ -3144,7 +3144,7 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd) return false; =20 if ((nnodes =3D virXPathNodeSet("/domain/devices/interface", ctxt, &no= des)) <=3D 0) { - vshError(ctl, _("Failed to extract interface information or no int= erfaces found")); + vshError(ctl, "%s", _("Failed to extract interface information or = no interfaces found")); return false; } =20 @@ -3177,7 +3177,7 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd) /* try to find element or create new one */ if (!(linkNode =3D virXPathNode("./link", ctxt))) { if (!(linkNode =3D xmlNewChild(ifaceNode, NULL, BAD_CAST "link", N= ULL))) { - vshError(ctl, _("failed to create XML node")); + vshError(ctl, "%s", _("failed to create XML node")); return false; } } @@ -3188,13 +3188,13 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd) stateAttr =3D xmlNewProp(linkNode, BAD_CAST "state", BAD_CAST stat= e); =20 if (!stateAttr) { - vshError(ctl, _("Failed to create or modify the state XML attribut= e")); + vshError(ctl, "%s", _("Failed to create or modify the state XML at= tribute")); return false; } =20 if (!(xml_buf =3D virXMLNodeToString(xml, ifaceNode))) { vshSaveLibvirtError(); - vshError(ctl, _("Failed to create XML")); + vshError(ctl, "%s", _("Failed to create XML")); return false; } =20 @@ -3204,7 +3204,7 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd) } =20 if (virDomainUpdateDeviceFlags(dom, xml_buf, flags) < 0) { - vshError(ctl, _("Failed to update interface link state")); + vshError(ctl, "%s", _("Failed to update interface link state")); return false; } =20 @@ -3297,7 +3297,7 @@ cmdDomIftune(vshControl *ctl, const vshCmd *cmd) =20 if ((!inbound.average && (inbound.burst || inbound.peak)) && !inbound.floor) { - vshError(ctl, _("either inbound average or floor is mandatory"= )); + vshError(ctl, "%s", _("either inbound average or floor is mand= atory")); goto cleanup; } =20 @@ -3335,12 +3335,12 @@ cmdDomIftune(vshControl *ctl, const vshCmd *cmd) goto cleanup; } if (outbound.average =3D=3D 0 && (outbound.burst || outbound.peak)= ) { - vshError(ctl, _("outbound average is mandatory")); + vshError(ctl, "%s", _("outbound average is mandatory")); goto cleanup; } =20 if (outbound.floor) { - vshError(ctl, _("outbound floor is unsupported yet")); + vshError(ctl, "%s", _("outbound floor is unsupported yet")); goto cleanup; } =20 @@ -3659,7 +3659,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) ignore_value(vshCommandOptStringQuiet(ctl, cmd, "storage", &vol_string= )); =20 if (!(vol_string || remove_all_storage) && wipe_storage) { - vshError(ctl, + vshError(ctl, "%s", _("'--wipe-storage' requires '--storage ' or '--r= emove-all-storage'")); return false; } @@ -3744,13 +3744,13 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) /* Stash domain description for later use */ if (vol_string || remove_all_storage) { if (running) { - vshError(ctl, + vshError(ctl, "%s", _("Storage volume deletion is supported only on stopp= ed domains")); goto cleanup; } =20 if (vol_string && remove_all_storage) { - vshError(ctl, + vshError(ctl, "%s", _("Specified both --storage and --remove-all-storage"= )); goto cleanup; } @@ -3923,7 +3923,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) vols[i].target, vols[i].source); fflush(stdout); if (virStorageVolWipe(vols[i].vol, 0) < 0) { - vshError(ctl, _("Failed! Volume not removed.")); + vshError(ctl, "%s", _("Failed! Volume not removed.")); ret =3D false; continue; } else { @@ -7206,7 +7206,7 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd) return false; =20 if (count =3D=3D 0) { - vshError(ctl, _("Can't set 0 processors for a VM")); + vshError(ctl, "%s", _("Can't set 0 processors for a VM")); return false; } =20 @@ -7272,7 +7272,7 @@ cmdGuestvcpus(vshControl *ctl, const vshCmd *cmd) return false; =20 if (cpulist && !(enable || disable)) { - vshError(ctl, _("One of options --enable or --disable is required = by option --cpulist")); + vshError(ctl, "%s", _("One of options --enable or --disable is req= uired by option --cpulist")); return false; } =20 @@ -7470,7 +7470,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) return false; =20 if ((rc =3D virDomainGetIOThreadInfo(dom, &info, flags)) < 0) { - vshError(ctl, _("Unable to get domain IOThreads information")); + vshError(ctl, "%s", _("Unable to get domain IOThreads information"= )); goto cleanup; } niothreads =3D rc; @@ -7751,7 +7751,7 @@ cmdIOThreadSet(vshControl *ctl, const vshCmd *cmd) return false; =20 if (npar =3D=3D 0) { - vshError(ctl, _("Not enough arguments passed, nothing to set")); + vshError(ctl, "%s", _("Not enough arguments passed, nothing to set= ")); return false; } =20 @@ -8593,7 +8593,7 @@ cmdSendKey(vshControl *ctl, const vshCmd *cmd) =20 for (opt =3D vshCommandOptArgv(cmd, "keycode"); opt && *opt; opt++) { if (count =3D=3D VIR_DOMAIN_SEND_KEY_MAX_KEYS) { - vshError(ctl, _("too many keycodes")); + vshError(ctl, "%s", _("too many keycodes")); return false; } =20 @@ -8922,10 +8922,10 @@ virshGetUpdatedMemoryXML(char **updatedMemoryXML, vshSaveLibvirtError(); return -1; } else if (nmems =3D=3D 0) { - vshError(ctl, _("no memory device found")); + vshError(ctl, "%s", _("no memory device found")); return -1; } else if (nmems > 1) { - vshError(ctl, _("multiple memory devices found, use --alias or --n= ode to select one")); + vshError(ctl, "%s", _("multiple memory devices found, use --alias = or --node to select one")); return -1; } =20 @@ -8944,7 +8944,7 @@ virshGetUpdatedMemoryXML(char **updatedMemoryXML, requestedSizeNode =3D virXPathNode("./target/requested", ctxt); =20 if (!requestedSizeNode) { - vshError(ctl, _("virtio-mem device is missing ")); + vshError(ctl, "%s", _("virtio-mem device is missing ")); return -1; } =20 @@ -11730,7 +11730,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) return false; =20 if (!virDomainIsActive(dom)) { - vshError(ctl, _("Domain is not running")); + vshError(ctl, "%s", _("Domain is not running")); return false; } =20 @@ -11767,7 +11767,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) if (type) vshError(ctl, _("No graphical display with type '%1$s' found")= , type); else - vshError(ctl, _("No graphical display found")); + vshError(ctl, "%s", _("No graphical display found")); } =20 return ret; @@ -11800,7 +11800,7 @@ cmdVNCDisplay(vshControl *ctl, const vshCmd *cmd) =20 /* Check if the domain is active and don't rely on -1 for this */ if (!virDomainIsActive(dom)) { - vshError(ctl, _("Domain is not running")); + vshError(ctl, "%s", _("Domain is not running")); return false; } =20 @@ -11810,7 +11810,7 @@ cmdVNCDisplay(vshControl *ctl, const vshCmd *cmd) /* Get the VNC port */ if (virXPathInt("string(/domain/devices/graphics[@type=3D'vnc']/@port)= ", ctxt, &port)) { - vshError(ctl, _("Failed to get VNC port. Is this domain using VNC?= ")); + vshError(ctl, "%s", _("Failed to get VNC port. Is this domain usin= g VNC?")); return false; } =20 @@ -12454,7 +12454,7 @@ virshUpdateDiskXML(xmlNodePtr disk_node, source_block =3D false; new_source =3D NULL; } else if (!new_source) { - vshError(NULL, _("New disk media source was not specified")); + vshError(NULL, "%s", _("New disk media source was not specified")); return NULL; } =20 @@ -12861,7 +12861,7 @@ cmdDomFSTrim(vshControl *ctl, const vshCmd *cmd) return false; =20 if (virDomainFSTrim(dom, mountPoint, minimum, flags) < 0) { - vshError(ctl, _("Unable to invoke fstrim")); + vshError(ctl, "%s", _("Unable to invoke fstrim")); return false; } =20 @@ -12898,7 +12898,7 @@ cmdDomFSFreeze(vshControl *ctl, const vshCmd *cmd) nmountpoints =3D g_strv_length((GStrv) mountpoints); =20 if ((count =3D virDomainFSFreeze(dom, mountpoints, nmountpoints, 0)) <= 0) { - vshError(ctl, _("Unable to freeze filesystems")); + vshError(ctl, "%s", _("Unable to freeze filesystems")); return false; } =20 @@ -12936,7 +12936,7 @@ cmdDomFSThaw(vshControl *ctl, const vshCmd *cmd) nmountpoints =3D g_strv_length((GStrv) mountpoints); =20 if ((count =3D virDomainFSThaw(dom, mountpoints, nmountpoints, 0)) < 0= ) { - vshError(ctl, _("Unable to thaw filesystems")); + vshError(ctl, "%s", _("Unable to thaw filesystems")); return false; } =20 @@ -12970,7 +12970,7 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd) =20 rc =3D virDomainGetFSInfo(dom, &info, 0); if (rc < 0) { - vshError(ctl, _("Unable to get filesystem information")); + vshError(ctl, "%s", _("Unable to get filesystem information")); goto cleanup; } ninfos =3D rc; @@ -13252,7 +13252,7 @@ cmdSetUserSSHKeys(vshControl *ctl, const vshCmd *cm= d) flags |=3D VIR_DOMAIN_AUTHORIZED_SSH_KEYS_SET_APPEND; =20 if (!from) { - vshError(ctl, _("Option --file is required")); + vshError(ctl, "%s", _("Option --file is required")); return false; } } diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 1b992e70f6..9e8f542c96 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1146,7 +1146,7 @@ vshExtractCPUDefXMLs(vshControl *ctl, xmlNodeSetName(nodes[i], (const xmlChar *)"cpu"); while (nodes[i]->properties) { if (xmlRemoveProp(nodes[i]->properties) < 0) { - vshError(ctl, + vshError(ctl, "%s", _("Cannot extract CPU definition from domain = capabilities XML")); return NULL; } diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index 3a4160107b..68b14a5276 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -235,7 +235,7 @@ cmdSecretSetValue(vshControl *ctl, const vshCmd *cmd) =20 if (base64) { /* warn users that the --base64 option passed from command line is= wrong */ - vshWarn(ctl, _("Passing secret value as command-line argument is i= nsecure!")); + vshWarn(ctl, "%s", _("Passing secret value as command-line argumen= t is insecure!")); secret_val =3D g_strdup(base64); secret_len =3D strlen(secret_val); } else if (filename) { @@ -257,7 +257,7 @@ cmdSecretSetValue(vshControl *ctl, const vshCmd *cmd) secret_len =3D strlen(secret_val); plain =3D true; } else { - vshError(ctl, _("Input secret value is missing")); + vshError(ctl, "%s", _("Input secret value is missing")); return false; } =20 diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index e0be8e7582..2821cd9e26 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -1140,7 +1140,7 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPt= r dom, =20 if (count < 0) { if (!last_error) - vshError(ctl, _("failed to collect snapshot list")); + vshError(ctl, "%s", _("failed to collect snapshot list")); goto cleanup; } =20 diff --git a/tools/virsh-util.c b/tools/virsh-util.c index 55ab71f26a..a4ae5be08c 100644 --- a/tools/virsh-util.c +++ b/tools/virsh-util.c @@ -383,14 +383,14 @@ virshDomainGetXMLFromDom(vshControl *ctl, g_autofree char *desc =3D NULL; =20 if (!(desc =3D virDomainGetXMLDesc(dom, flags))) { - vshError(ctl, _("Failed to get domain description xml")); + vshError(ctl, "%s", _("Failed to get domain description xml")); return -1; } =20 *xml =3D virXMLParseStringCtxt(desc, _("(domain_definition)"), ctxt); =20 if (!(*xml)) { - vshError(ctl, _("Failed to parse domain description xml")); + vshError(ctl, "%s", _("Failed to parse domain description xml")); return -1; } =20 @@ -408,14 +408,14 @@ virshNetworkGetXMLFromNet(vshControl *ctl, g_autofree char *desc =3D NULL; =20 if (!(desc =3D virNetworkGetXMLDesc(net, flags))) { - vshError(ctl, _("Failed to get network description xml")); + vshError(ctl, "%s", _("Failed to get network description xml")); return -1; } =20 *xml =3D virXMLParseStringCtxt(desc, _("(network_definition)"), ctxt); =20 if (!(*xml)) { - vshError(ctl, _("Failed to parse network description xml")); + vshError(ctl, "%s", _("Failed to parse network description xml")); return -1; } =20 diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 430961fef2..7b1847d7ae 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -676,7 +676,7 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd) flags |=3D VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM; =20 if (!(st =3D virStreamNew(priv->conn, 0))) { - vshError(ctl, _("cannot create a new stream")); + vshError(ctl, "%s", _("cannot create a new stream")); return false; } =20 @@ -793,7 +793,7 @@ cmdVolDownload(vshControl *ctl, const vshCmd *cmd) cbData.isBlock =3D !!S_ISBLK(sb.st_mode); =20 if (!(st =3D virStreamNew(priv->conn, 0))) { - vshError(ctl, _("cannot create a new stream")); + vshError(ctl, "%s", _("cannot create a new stream")); goto cleanup; } =20 diff --git a/tools/virsh.c b/tools/virsh.c index 090fdb2017..800e280c7a 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -757,7 +757,7 @@ virshParseArgv(vshControl *ctl, int argc, char **argv) vshError(ctl, _("unsupported option '%1$s'. See --help."),= argv[optind - 1]); exit(EXIT_FAILURE); default: - vshError(ctl, _("unknown option")); + vshError(ctl, "%s", _("unknown option")); exit(EXIT_FAILURE); } longindex =3D -1; diff --git a/tools/virt-admin.c b/tools/virt-admin.c index fe2868d379..2d63098444 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -975,14 +975,14 @@ cmdDaemonLogFilters(vshControl *ctl, const vshCmd *cm= d) const char *filters =3D NULL; if ((vshCommandOptString(ctl, cmd, "filters", &filters) < 0 || virAdmConnectSetLoggingFilters(priv->conn, filters, 0) < 0)) { - vshError(ctl, _("Unable to change daemon logging settings")); + vshError(ctl, "%s", _("Unable to change daemon logging setting= s")); return false; } } else { g_autofree char *filters =3D NULL; if (virAdmConnectGetLoggingFilters(priv->conn, &filters, 0) < 0) { - vshError(ctl, _("Unable to get daemon logging filters informat= ion")); + vshError(ctl, "%s", _("Unable to get daemon logging filters in= formation")); return false; } =20 @@ -1024,13 +1024,13 @@ cmdDaemonLogOutputs(vshControl *ctl, const vshCmd *= cmd) const char *outputs =3D NULL; if ((vshCommandOptString(ctl, cmd, "outputs", &outputs) < 0 || virAdmConnectSetLoggingOutputs(priv->conn, outputs, 0) < 0)) { - vshError(ctl, _("Unable to change daemon logging settings")); + vshError(ctl, "%s", _("Unable to change daemon logging setting= s")); return false; } } else { g_autofree char *outputs =3D NULL; if (virAdmConnectGetLoggingOutputs(priv->conn, &outputs, 0) < 0) { - vshError(ctl, _("Unable to get daemon logging outputs informat= ion")); + vshError(ctl, "%s", _("Unable to get daemon logging outputs in= formation")); return false; } =20 @@ -1320,7 +1320,7 @@ vshAdmParseArgv(vshControl *ctl, int argc, char **arg= v) vshError(ctl, _("unsupported option '%1$s'. See --help."),= argv[optind - 1]); exit(EXIT_FAILURE); default: - vshError(ctl, _("unknown option")); + vshError(ctl, "%s", _("unknown option")); exit(EXIT_FAILURE); } longindex =3D -1; --=20 2.48.1 From nobody Tue Dec 16 03:20:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740065550358613.7124047010718; Thu, 20 Feb 2025 07:32:30 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id C066F1ECC; Thu, 20 Feb 2025 10:32:29 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 5DE8C2269; Thu, 20 Feb 2025 10:27:07 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 9FD5F2212; Thu, 20 Feb 2025 10:26:55 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id A11FD21AD for ; Thu, 20 Feb 2025 10:26:43 -0500 (EST) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-111-ej0TfSXUOuuJjuo4KjMgBw-1; Thu, 20 Feb 2025 10:26:41 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 59ED319783BE for ; Thu, 20 Feb 2025 15:26:40 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DA0AC30001A6 for ; Thu, 20 Feb 2025 15:26:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740065203; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l8U7RPbx/IfQEwUnOY0j35KKdBNq0ekfpbekmBm1ADo=; b=L6qeQUKJNVmIuioE+mTi4XSfka+qkf2SYLZ876GSeDG8m6TRhkkJTDGvfSQ9ZNpYkCnAfp RaZdB2Hrmt4RywbQsz6f6VQWeIVAHUNRW4crvXD5mY8EmgBxf6hf3eqk9N3iIvnN16lg0B vWgQLF/+29OJiWsEdPF83XcXf6Ru5eU= X-MC-Unique: ej0TfSXUOuuJjuo4KjMgBw-1 X-Mimecast-MFC-AGG-ID: ej0TfSXUOuuJjuo4KjMgBw_1740065200 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 11/13] virsh: Drop extra newlines at the end of error messages Date: Thu, 20 Feb 2025 16:26:13 +0100 Message-ID: <999f6cd69860adaa68bbad0f1ba5c67847f03272.1740064957.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: RuqNi7p3jZqNwOULVW7XcMDgwuY4pFyK2ElczuZt5TY_1740065200 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: RNAHJXENQ45KRBNUCYCYUONH5ERZ5A6C X-Message-ID-Hash: RNAHJXENQ45KRBNUCYCYUONH5ERZ5A6C X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740065551252019000 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- tools/virsh-domain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 2db88a1a7d..c8c341b3d1 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2648,7 +2648,7 @@ virshBlockJobInfo(vshControl *ctl, if (!raw) { speed <<=3D 20; if (speed >> 20 !=3D info.bandwidth) { - vshError(ctl, _("overflow in converting %1$ld MiB/s to byt= es\n"), + vshError(ctl, _("overflow in converting %1$ld MiB/s to byt= es"), info.bandwidth); return false; } @@ -3831,7 +3831,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) =20 if (!vol.vol) { vshError(ctl, - _("Storage volume '%1$s'(%2$s) is not managed by = libvirt. Remove it manually.\n"), + _("Storage volume '%1$s'(%2$s) is not managed by = libvirt. Remove it manually."), target, source); vshResetLibvirtError(); continue; @@ -3848,7 +3848,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) for (i =3D 0; i < nvol_list; i++) { if (vol_list[i]) { vshError(ctl, - _("Volume '%1$s' was not found in domain's de= finition.\n"), + _("Volume '%1$s' was not found in domain's de= finition."), vol_list[i]); found =3D true; } --=20 2.48.1 From nobody Tue Dec 16 03:20:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740065566959706.8249871077367; Thu, 20 Feb 2025 07:32:46 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id D3256220E; Thu, 20 Feb 2025 10:32:45 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id F10A5226C; Thu, 20 Feb 2025 10:27:08 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7F95221C2; Thu, 20 Feb 2025 10:26:57 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 2DC731985 for ; Thu, 20 Feb 2025 10:26:45 -0500 (EST) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-166-C7IcajePMg6gE2H0Z0YnBw-1; Thu, 20 Feb 2025 10:26:43 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6466119783B2 for ; Thu, 20 Feb 2025 15:26:42 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E4A4D180087E for ; Thu, 20 Feb 2025 15:26:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740065204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WVoL76O29hPJNp1P32SkQI7PmPM5aNhY4XiO3t1u+qI=; b=XdDSg8iaVwuSQe65qEMmID2o1BNnuVU/iAyZz3zdcIsWWKg4kPcVczB9JOY39A632EfyTL GGVLJYS370XQotTe8soMaUMwIag0AJpe78zQWxO+CM/AAkZDzw2qC7nybS8OYMHa2gKkYg QGjaR40ft2s6disY+gCiyeU73CtRU4U= X-MC-Unique: C7IcajePMg6gE2H0Z0YnBw-1 X-Mimecast-MFC-AGG-ID: C7IcajePMg6gE2H0Z0YnBw_1740065202 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 12/13] virsh: Let prohibit_newline_at_end_of_diagnostic check pass Date: Thu, 20 Feb 2025 16:26:14 +0100 Message-ID: <3a65d92251da2ac9d0603f3752f09723a976d58d.1740064957.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: JYEzkWMfeWmm2BY1_yDgn_6nMY_IH6oUxap64nb_D-k_1740065202 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: YUBCH24LPUMTUTVNSOJQIGJV6AMOI5S5 X-Message-ID-Hash: YUBCH24LPUMTUTVNSOJQIGJV6AMOI5S5 X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740065568539019100 Content-Type: text/plain; charset="utf-8" The prohibit_newline_at_end_of_diagnostic syntax check is confused when another unrelated translatable message with a newline is too close to the function it is supposed to check. Refactoring the code to make the two strings further apart seems like the easiest solution. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- tools/virsh-domain.c | 9 +++++---- tools/virsh-snapshot.c | 10 ++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index c8c341b3d1..cc5ae60536 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -12307,12 +12307,13 @@ cmdDetachInterface(vshControl *ctl, const vshCmd = *cmd) return ret; =20 cleanup: - if (!ret) { - vshError(ctl, "%s", _("Failed to detach interface")); - } else { + if (ret) { vshPrintExtra(ctl, "%s", _("Interface detached successfully\n")); + return true; } - return ret; + + vshError(ctl, "%s", _("Failed to detach interface")); + return false; } =20 =20 diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 2821cd9e26..dbd849bb3b 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -1758,11 +1758,13 @@ cmdDomainSnapshotRevert(vshControl *ctl, const vshC= md *cmd) result =3D virDomainRevertToSnapshot(snapshot, flags); } =20 - if (result < 0) + if (result < 0) { vshError(ctl, _("Failed to revert snapshot %1$s"), name); - else - vshPrintExtra(ctl, _("Domain snapshot %1$s reverted\n"), name); - return result >=3D 0; + return false; + } + + vshPrintExtra(ctl, _("Domain snapshot %1$s reverted\n"), name); + return true; } =20 /* --=20 2.48.1 From nobody Tue Dec 16 03:20:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740065582638881.9552030812265; Thu, 20 Feb 2025 07:33:02 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 0C4751ECC; Thu, 20 Feb 2025 10:33:01 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 93DDD2212; Thu, 20 Feb 2025 10:27:11 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 2FF16222A; Thu, 20 Feb 2025 10:27:00 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5A2A121A6 for ; Thu, 20 Feb 2025 10:26:47 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-108-i3xDV66dN3SI7QWJWBgFoA-1; Thu, 20 Feb 2025 10:26:45 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5635B190F9F3 for ; Thu, 20 Feb 2025 15:26:44 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D5153191D7C9 for ; Thu, 20 Feb 2025 15:26:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740065206; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y1cy7xpUJOG3rcJz+G1Ttw/1TrB2EH1JuZ8LSunuD1A=; b=XKCgKnIliCR6SplESv51sxMX+Z3leiPyKf49yc/+mp+BNILF+0rCOGO7TBRqRX2twbQKNO JfftXx1kUdzPlwd2nCz0OZfXTonS+eAR/uvxUFUw5MYFnw2j04uKpWcGmtfb+BVEdGGvY6 sGER8yDQu22esk07wRRqOJlt5DAho8E= X-MC-Unique: i3xDV66dN3SI7QWJWBgFoA-1 X-Mimecast-MFC-AGG-ID: i3xDV66dN3SI7QWJWBgFoA_1740065204 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 13/13] build: Enable syntax checks for vshError and vshWarn Date: Thu, 20 Feb 2025 16:26:15 +0100 Message-ID: <5c2a6f3911da443c239167b4a1cf9be67970d6a2.1740064957.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: cJfLIsKM9xTPVHd8NJcYvB_tbeD_e7VbuonU5_f6APc_1740065204 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: JJ4TQ74ORCFHQEE5EKL757UAAXWKZFCY X-Message-ID-Hash: JJ4TQ74ORCFHQEE5EKL757UAAXWKZFCY X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740065583412019000 Content-Type: text/plain; charset="utf-8" To make sure both error and warning messages printed by virsh are properly marked for translation. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- build-aux/syntax-check.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index bd3dd6cb54..d414e033df 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -401,6 +401,8 @@ msg_gen_function +=3D virReportError msg_gen_function +=3D virReportErrorHelper msg_gen_function +=3D virReportSystemError msg_gen_function +=3D virLastErrorPrefixMessage +msg_gen_function +=3D vshError +msg_gen_function +=3D vshWarn =20 # Uncomment the following and run "ninja test" to see diagnostics # that are not yet marked for translation, but that need to be rewritten @@ -408,7 +410,6 @@ msg_gen_function +=3D virLastErrorPrefixMessage # msg_gen_function +=3D fprintf # msg_gen_function +=3D testError # msg_gen_function +=3D vshPrint -# msg_gen_function +=3D vshError =20 space =3D $(null) $(null) func_re=3D ($(subst $(space),|,$(msg_gen_function))) --=20 2.48.1