From nobody Tue Sep 9 19:00:38 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=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1750063547; cv=none; d=zohomail.com; s=zohoarc; b=iTxuLT4WHDQ2iU9gHlIwsSLNlnrvBxwoAJE7ha4KPOpPIWqTR7KWIbNX5r2zoAauZnkrWbO0wXL/A0bGw/gcIqRRlldO33g0g1GOnc2EOTipdK/NW2azyFofRN5mvqgBIdj2meD4bsN8ZU61TOX/Qp8elF7+cw7JzcV1ViC89Vo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750063547; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id:Cc; bh=pZesq129yU/wX8rQ/urfLe9HP6izMqI6bw1CE90gMAQ=; b=Fhw2RGoREMOlAe8sgTI0/BFAW0emwbIkgy6vilBDRE6apowS8BHQlatU9uPHJaSlSsAONxO9C5Iy/zII0jnaR2P2e3rhLMV618Bf9w3q33maM4rT0UApf1ta+pcRgGO26i+6Uc3ExkzzA9dqx7jKB1MVRNdbj0P9WybxxqFGwi0= ARC-Authentication-Results: i=1; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1750063547427707.2722789462716; Mon, 16 Jun 2025 01:45:47 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1D26FE76; Mon, 16 Jun 2025 04:45:46 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B3379CEE; Mon, 16 Jun 2025 04:45:27 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 55594CE4; Mon, 16 Jun 2025 04:45:25 -0400 (EDT) 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 7BC5ECDD for ; Mon, 16 Jun 2025 04:45:23 -0400 (EDT) Received: from mx-prod-mc-04.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-350-HcZrRvOpNTW0-z55MUcFFw-1; Mon, 16 Jun 2025 04:45:21 -0400 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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A15D01955F65 for ; Mon, 16 Jun 2025 08:45:20 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.3.236]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id ED2E418003FC for ; Mon, 16 Jun 2025 08:45:19 +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, 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=1750063523; 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; bh=EtotOadvKVfDnPeSiB/4cX5NdQzjDsag1anpFQ7fl3E=; b=YhyL/lpOwH2QPtv9w/joOaZAoii+EeCLW6Qs84bKMPe+YZTnkUGLCeCMsunfZLmZAsYxMV XpITjUlk2Y9O0MaeUcSmxt5GE7dgwFJ701ZHGb2wnYKYXjpcTrolX2G2LMzy+OvbtOze5C JOTZz+ntvMfh0tmQ79aVg5wP5Y5TCc8= X-MC-Unique: HcZrRvOpNTW0-z55MUcFFw-1 X-Mimecast-MFC-AGG-ID: HcZrRvOpNTW0-z55MUcFFw_1750063520 To: devel@lists.libvirt.org Subject: [PATCH] qemu: Be more forgiving when acquiring QUERY job when formatting domain XML Date: Mon, 16 Jun 2025 10:45:15 +0200 Message-ID: <6c04408bee2f57bc77c7f04ec25d17693bdb2c9a.1750063515.git.mprivozn@redhat.com> 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: 9AFxTCkK0kS2ipQDf3g2VbFEEZvREJDgCMCpyXFmTbI_1750063520 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: H2F33M63EQOD742GHZZAT7PRJ2GXKCEH X-Message-ID-Hash: H2F33M63EQOD742GHZZAT7PRJ2GXKCEH X-MailFrom: mprivozn@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: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1750063549918116600 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik In my previous commit of v11.0.0-rc1~115 I've made QEMU driver implementation for virDomainGetXMLDesc() (qemuDomainGetXMLDesc()) acquire QERY job. See its commit message for more info. But this unfortunately broke apps witch fetch domain XML for incoming migration (like virt-manager). The reason is that for incoming migration the VIR_ASYNC_JOB_MIGRATION_IN async job is set, but the mask of allowed synchronous jobs is empty (because QEMU can't talk on monitor really). This makes virDomainObjBeginJob() fail which in turn makes qemuDomainGetXMLDesc() fail too. It makes sense for qemuDomainGetXMLDesc() to acquire the job (e.g. so that it's coherent with another thread that might be in the middle of a MODIFY job). But failure to dump XML may be treated as broken daemon (e.g. virt-manager does so). Therefore, still try to acquire the QUERY job (if job mask permits it) but, do not treat failure as an error. Fixes: 6cc93bf28842526be2fd596a607ebca796b7fb2e Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2369243 Signed-off-by: Michal Privoznik Reviewed-by: Pavel Hrdina --- src/qemu/qemu_driver.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b3b0ee66f8..9b583ad7aa 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6182,6 +6182,7 @@ static char { virQEMUDriver *driver =3D dom->conn->privateData; virDomainObj *vm; + bool hasJob =3D false; char *ret =3D NULL; =20 virCheckFlags(VIR_DOMAIN_XML_COMMON_FLAGS | VIR_DOMAIN_XML_UPDATE_CPU, @@ -6193,8 +6194,10 @@ static char if (virDomainGetXMLDescEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; =20 - if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) - goto cleanup; + if (virDomainNestedJobAllowed(vm->job, VIR_JOB_QUERY) && + virDomainObjBeginJob(vm, VIR_JOB_QUERY) >=3D 0) { + hasJob =3D true; + } =20 qemuDomainUpdateCurrentMemorySize(vm); =20 @@ -6210,7 +6213,8 @@ static char =20 ret =3D qemuDomainFormatXML(driver, vm, flags); =20 - virDomainObjEndJob(vm); + if (hasJob) + virDomainObjEndJob(vm); =20 cleanup: virDomainObjEndAPI(&vm); --=20 2.49.0