From nobody Mon Feb 9 15:32:32 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=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 1741953250360963.2156039881318; Fri, 14 Mar 2025 04:54:10 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B95DC22DC; Fri, 14 Mar 2025 07:54:09 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 43EAC22E4; Fri, 14 Mar 2025 07:53:35 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6923A1ADA; Fri, 14 Mar 2025 07:53:30 -0400 (EDT) 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 2BE3A18B0 for ; Fri, 14 Mar 2025 07:53:25 -0400 (EDT) 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-587-mWmbv6g6OQC7kjcnaBrzEw-1; Fri, 14 Mar 2025 07:53:21 -0400 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 835461956055 for ; Fri, 14 Mar 2025 11:53:20 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.com (unknown [10.44.32.138]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F07111955BCC; Fri, 14 Mar 2025 11:53:18 +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=1741953204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=19Qru9Jz2qJTWvFNP/+QZquP0hWRHcuFEANEQioLz5U=; b=hdXTwD75r8w3NYVzE1nvJtQSQx3QrnK+MVcoYyL5vQ5fFF4msaQefT0SlFsfrWPtRKx9pu CI9zloZsuL5+VA4DSDDWTJIegSnqJHzeBJgKPb+Rg+iz7AwZtMrWyJoUSNkXz+dkBArQ6R JhkkfLXOoBK8T3MuE40R8j/9lMlsVms= X-MC-Unique: mWmbv6g6OQC7kjcnaBrzEw-1 X-Mimecast-MFC-AGG-ID: mWmbv6g6OQC7kjcnaBrzEw_1741953200 From: Kirill Shchetiniuk To: devel@lists.libvirt.org Subject: [PATCH 1/2] ch: virCHProcessStop preserve last meaningful error Date: Fri, 14 Mar 2025 12:51:18 +0100 Message-ID: <20250314115236.53057-3-kshcheti@redhat.com> In-Reply-To: <20250314115236.53057-2-kshcheti@redhat.com> References: <20250314115236.53057-2-kshcheti@redhat.com> 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: 1nW4vdBUOaOAAqppUk8cOUuIi-zpaCU0BK6gVRoqIec_1741953200 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IO4P7A6BXQYEMIPZSLN235ETCJ2BM4AX X-Message-ID-Hash: IO4P7A6BXQYEMIPZSLN235ETCJ2BM4AX X-MailFrom: kshcheti@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 CC: Kirill Shchetiniuk 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: 1741953252084019000 Content-Type: text/plain; charset="utf-8"; x-default="true" The last meaningful error was being reset during the execution of virCHProcessStop, which led to inconsistent error output in case any error occurred before the stop. To maintain consistent error output and avoid unknown error messages, last meaningful error preservation has been added. Signed-off-by: Kirill Shchetiniuk --- src/ch/ch_process.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index 9a85f7869e..9388d5bd83 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -995,11 +995,14 @@ virCHProcessStop(virCHDriver *driver, virCHDomainObjPrivate *priv =3D vm->privateData; virCHDriverConfig *cfg =3D virCHDriverGetConfig(driver); virDomainDef *def =3D vm->def; + virErrorPtr orig_err =3D NULL; size_t i; =20 VIR_DEBUG("Stopping VM name=3D%s pid=3D%d reason=3D%d", vm->def->name, (int)vm->pid, (int)reason); =20 + virErrorPreserveLast(&orig_err); + if (priv->monitor) { g_clear_pointer(&priv->monitor, virCHMonitorClose); } @@ -1032,6 +1035,8 @@ virCHProcessStop(virCHDriver *driver, =20 virHostdevReAttachDomainDevices(driver->hostdevMgr, CH_DRIVER_NAME, de= f, hostdev_flags); + + virErrorRestore(&orig_err); return 0; } =20 --=20 2.48.1