From nobody Tue Mar 3 03:11:41 2026 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=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1771257068; cv=none; d=zohomail.com; s=zohoarc; b=fVMquLeG7ZRjJaVW9Yi3z+POIYT0ZKKcd5ezJb4eoJKoZBZx5Vzt4Pal8FS79grT3c4NcS61v/cNK/MtsH8g6XKG7Sq8pKJ9ceJND7zNL74NN6om6B0IfIcbmyiQbNeRGxik1+6FbKjvNlPXZ+SRYnyHztDgs+g+VjY5x9MkiyY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771257068; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=aufGzUZ8TPn2JZyrOWA0rPeRLWN367sQWOxLJD4vDzU=; b=UQF78KhItv04Ueb8bPTpnL9lkjjGqXBmgW5jXcDFmFo/DMG3/icIxoh+fQVFPOKrAlLbfQPgCOj/GT+xstAVUpJ5IXzmlvq9z4FjNpSsqR8lNdpsZ1PoMm/7mpoNV5xiVHzbQEYM+HM8iQxH1+dRIUIWV1WwWNZzqUjVKkXu5o8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1771257068850533.7141141481686; Mon, 16 Feb 2026 07:51:08 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id B5D6E417D3; Mon, 16 Feb 2026 10:51:07 -0500 (EST) Received: from [172.19.199.9] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id AFF874180F; Mon, 16 Feb 2026 10:50:24 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 31CD63F3DD; Mon, 16 Feb 2026 10:50:19 -0500 (EST) Received: from mail-dy1-f176.google.com (mail-dy1-f176.google.com [74.125.82.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 550433F36D for ; Mon, 16 Feb 2026 10:50:18 -0500 (EST) Received: by mail-dy1-f176.google.com with SMTP id 5a478bee46e88-2baab3137bcso2879054eec.0 for ; Mon, 16 Feb 2026 07:50:18 -0800 (PST) Received: from localhost.localdomain ([2804:29b8:5090:5879:a8a6:8571:534b:ee51]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2bacb658fc4sm11633198eec.22.2026.02.16.07.50.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 16 Feb 2026 07:50:16 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771257017; x=1771861817; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=aufGzUZ8TPn2JZyrOWA0rPeRLWN367sQWOxLJD4vDzU=; b=bFFFP7vPy/kZFdI8uxo5kbAlStFBRBnBsJVeQ6qttw0ouGl3rCSYFKYO/1C6BH5dtj TurK5vVQlnLqJ5RNgWJLY2QGCGxlp9CVNr//rh5vHTpfAt/ueSQaL+1HnI9LsMGfqnzU 4hzRj9dSaMDufkpw2qcOcaBRVDxKj91h6JePmycY//L8pNaMLHxrn4Er4Fo6DznCNfco 0pDkycG7RqguFSs86Naj3hXSNEI4CNbHByAkwNB1Bgx7LTgWNY56nmoO5Xed5jJ3k9km M/MukBMwP9B4nOuKcsg5FVAA3mnKmp6Pijm10MA5xdj4mmi8IznTtt1YINF6loMKWKn6 rMTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771257017; x=1771861817; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=aufGzUZ8TPn2JZyrOWA0rPeRLWN367sQWOxLJD4vDzU=; b=q0kQUiRf0w9QJYU+x2F7ZAamLKitgFQtLhYbTOvoVy/Z1H+Q+JAfJloSug7QIpCr+R 9NxXM5/r88h4xXoIYqBNpRMZBfKH+5iSmV0dP1yhXwAO89COCS9UdQcu2H8au6rXMGb2 vrqswMsXHFefKEOWzm1ZbL8H65UhSQbARYbegbcetu2u2m0Nzjyx/B6FSiWFRw8JyDIB 07dpTJAPLSUUvbQh7PLkEOcV3OiIve4fkwrOfDhJVl3SAtfVvJ4NRmWT/0sHfEMfMhll ytS3VobBHDwaCiAU4jFQpQlbYozWiZFnQKmBb3ROH3/MM//bqvd/FTdy+KmGztp5roUo vRQg== X-Gm-Message-State: AOJu0YwQ0spo/Qyj3h28hEsD7XqNQSu8kjj2Ym8ak7RjR/E82gr3KupK wOYE9OpBA1RjWpKCXZN2xmeTsg7q/VQA8yVVi6wHKQaxi3aoHJyAekAWuZbaAQ== X-Gm-Gg: AZuq6aIvHpPduGK8KBlunB5fJNV5v91RszIFPZHKNq9K7V6/F55f2IWAyEucypM504h 342eMkzjn/EYT1Xt5x2EelCBiJhd/lLkAQlX7LAkX8jWIpzu4sNVQhvszmzQFmNgK/Ws8kCXOoU CJJVkiUfrLRgzFEFepHk+GohyyMiCWvkGPws1MdoVr3d0t45Z67M0nebFG/tdBWc4iwxhugluyi VuKIwBGbTTRzuQxyvIotI3unLJ6RNzfdfiAAXQpo9q176gOJOotUqIQ0GKyQBOtNsCwQqWLtdVk c1CxxxrPnL2y0+ckPt6b3OBkrWQ284+z5/47D7i8MhmAodM+WZDLeFjRE1B3YbXI/BnTcBW38aK pFOTJoKT1Gu2jDGadqnWbreDuwDZFhO7v9ie403nS7j8uU46uPjXIGlgR+tVjrzuGj7HI9EnSdf vL+zBkN073Dk0q2puGsLtkzbBP6CWRt+YVymfOhKY/OaK2HSe02RnsFZ47G3GMNgbrQNzdIQ== X-Received: by 2002:a05:7300:f191:b0:2b8:21d7:b7c3 with SMTP id 5a478bee46e88-2bac933b19fmr3357228eec.3.1771257016782; Mon, 16 Feb 2026 07:50:16 -0800 (PST) From: Lucas Amaral To: devel@lists.libvirt.org Subject: [PATCH] virsh: report "unknown" for autostart when API query fails Date: Mon, 16 Feb 2026 12:50:06 -0300 Message-ID: <20260216155007.32148-1-lucaaamaral@gmail.com> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 3TTHVPKHJXS53L5L72SVR2XBXEGLNMCK X-Message-ID-Hash: 3TTHVPKHJXS53L5L72SVR2XBXEGLNMCK X-MailFrom: lucaaamaral@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Lucas Amaral X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1771257071395158500 When virStoragePoolGetAutostart(), virNetworkGetAutostart(), or virNodeDeviceGetAutostart() fails, the respective info commands report "no autostart". This is incorrect: the API failure means we cannot determine the autostart state, not that autostart is disabled. The persistent field in the same functions already correctly reports "unknown" on API failure. Apply the same pattern to the autostart field for consistency and correctness. Signed-off-by: Lucas Amaral Reviewed-by: Michal Privoznik --- Found by code audit. The inconsistency dates back to c2160b137d (Jun 2010), which introduced both the "Persistent" and "Autostart" fields for pool-info. The persistent field used _("unknown") on failure while the autostart field used _("no autostart") =E2=80=94 the mismatch was then copied into net-info, pool-list, net-list, and nodedev-info as those were added. All 5 instances across 3 files (virsh-pool.c, virsh-network.c, virsh-nodedev.c) are fixed in this patch. Tested on CentOS Stream 9 =E2=80=94 full test suite passes (307 OK, 1 Expected Fail, 0 Fail). tools/virsh-network.c | 4 ++-- tools/virsh-nodedev.c | 2 +- tools/virsh-pool.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 2e9613e01b..eb7de3da85 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -715,7 +715,7 @@ cmdNetworkInfo(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%-15s %s\n", _("Persistent:"), persistent ? _("yes"= ) : _("no")); =20 if (virNetworkGetAutostart(network, &autostart) < 0) - vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("no autostart")); + vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("unknown")); else vshPrint(ctl, "%-15s %s\n", _("Autostart:"), autostart ? _("yes") = : _("no")); =20 @@ -1055,7 +1055,7 @@ cmdNetworkList(vshControl *ctl, const vshCmd *cmd G_G= NUC_UNUSED) =20 if (optTable) { if (virNetworkGetAutostart(network, &is_autostart) < 0) - autostartStr =3D _("no autostart"); + autostartStr =3D _("unknown"); else autostartStr =3D is_autostart ? _("yes") : _("no"); =20 diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 2ce0c1411f..e78fc24897 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -1245,7 +1245,7 @@ cmdNodeDeviceInfo(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%-15s %s\n", _("Persistent:"), virNodeDeviceIsPersistent(device) ? _("yes") : _("no")); if (virNodeDeviceGetAutostart(device, &autostart) < 0) - vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("no autostart")); + vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("unknown")); else vshPrint(ctl, "%-15s %s\n", _("Autostart:"), autostart ? _("yes") = : _("no")); =20 diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 2010ef1356..2db2cf6893 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -1204,7 +1204,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC= _UNUSED) =20 /* Retrieve the autostart status of the pool */ if (virStoragePoolGetAutostart(list->pools[i], &autostart) < 0) - poolInfoTexts[i].autostart =3D g_strdup(_("no autostart")); + poolInfoTexts[i].autostart =3D g_strdup(_("unknown")); else poolInfoTexts[i].autostart =3D g_strdup(autostart ? _("yes") := _("no")); =20 @@ -1554,7 +1554,7 @@ cmdPoolInfo(vshControl *ctl, const vshCmd *cmd) =20 /* Check and display whether the pool is autostarted or not */ if (virStoragePoolGetAutostart(pool, &autostart) < 0) - vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("no autostart")= ); + vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("unknown")); else vshPrint(ctl, "%-15s %s\n", _("Autostart:"), autostart ? _("ye= s") : _("no")); =20 --=20 2.52.0