From nobody Mon Feb 9 11:32:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635243466; cv=none; d=zohomail.com; s=zohoarc; b=HPUlLTxqxsCYf18MJucYwu9bjrPAXxnTmbTfgnVWXH1D/9RU2NcvgIl3goktMpX6rbYrvmceA484otPtpq3FotiJ3hGxWYqj5wWQtsg3ZrfX4N/vUt6Ep8dYp7LUOXbEzNVGlpbpSVPSYsro3354rG992rYHgg8ivMH0p/Ac7fs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635243466; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zind/yUgkR9PN7oyE+F2CjTWfb1JpYR+dPTbQfsbPrg=; b=C1Fh54F2Pvq2xzX18PAe+50yLfkClzSvCaAYQLia4uP35S/bEG9b8zKBy1jtl+v6kWN7Q7WyKzMAp9fb9OLOznPVwUnnuk1cd9l3deZMdGBESK7OdZFCXNrgluP2fJEFGnFKwE1xGdTVuwzU2M1eeJAY9FARU81Q0EsTiiVoMz8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1635243466424279.912043425315; Tue, 26 Oct 2021 03:17:46 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-192-UXFdLzgzN16FYPKnmfdb5w-1; Tue, 26 Oct 2021 06:17:43 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 34499101B4A5; Tue, 26 Oct 2021 10:17:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 14A9C5DD68; Tue, 26 Oct 2021 10:17:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D53811818480; Tue, 26 Oct 2021 10:17:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19QAHMGO008351 for ; Tue, 26 Oct 2021 06:17:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8AACF171FF; Tue, 26 Oct 2021 10:17:22 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1220D5C1CF for ; Tue, 26 Oct 2021 10:17:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635243465; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=zind/yUgkR9PN7oyE+F2CjTWfb1JpYR+dPTbQfsbPrg=; b=CLq181wPFfihEbOHNdlNVL3alTKxivnHusevS9KZSPQ29Q2Obd9xAMPPaF2NmeK0jbGtdR Yul8Hs1thPeVR7uxISjbQsjrx7yZjSn21rGcGMsJwRkb5g951jisFHKRONPJ2tLPiivE4v RsKaMhvymlPwS2fbS6Lqz0dbSmie9Qc= X-MC-Unique: UXFdLzgzN16FYPKnmfdb5w-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/3] *** DO NOT MERGE *** Date: Tue, 26 Oct 2021 12:17:08 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635243468098100001 Content-Type: text/plain; charset="utf-8" One problem with qemuProcessStop() is that it may run from "qemu-event" thread. This thread processes events from all guests, meaning there's just one thread that serves all running guests. But as such has no virIdentity set, which looks correct on the first glance - there's no identity to associate it with anyway. But, the problem arises when we need to connect to other daemons (e.g. virtnetworkd) to call APIs (e.g. delete a port). Here we want the thread to have the identity that of the guest. But since we haven't set any identity, opening connection to secondary drivers fails (because virIdentityGetCurrent() returns NULL which is treated by virGetConnectGeneric() as an error). As a terrible hack we can set the system identity. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2013573 Signed-off-by: Michal Privoznik --- src/qemu/qemu_process.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d5f8a47ac2..7ae1974710 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7888,6 +7888,7 @@ void qemuProcessStop(virQEMUDriver *driver, g_autofree char *timestamp =3D NULL; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); g_autoptr(virConnect) conn =3D NULL; + g_autoptr(virIdentity) ident =3D NULL; =20 VIR_DEBUG("Shutting down vm=3D%p name=3D%s id=3D%d pid=3D%lld, " "reason=3D%s, asyncJob=3D%s, flags=3D0x%x", @@ -7901,6 +7902,9 @@ void qemuProcessStop(virQEMUDriver *driver, * reporting so we don't squash a legit error. */ virErrorPreserveLast(&orig_err); =20 + ident =3D virIdentityGetSystem(); + virIdentitySetCurrent(ident); + if (asyncJob !=3D QEMU_ASYNC_JOB_NONE) { if (qemuDomainObjBeginNestedJob(driver, vm, asyncJob) < 0) goto cleanup; --=20 2.32.0