From nobody Sun Feb 8 07:15:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1660140439; cv=none; d=zohomail.com; s=zohoarc; b=OASTfEyosb6xrTaB5fNg08TeJJ8se1E/YgjWm42Jr902FRdTEXHUBOu4Gwv3wk2LZgYBteOhP/+h5SSU+jZigqBnrxA3gMhyAhtaSgbgVinJpcnjJ+626Q/yGYJp/3S64if3BYxpA0zg43wSQtGYp74UoMnREeFUEUxayDHJwIE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660140439; 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=VQ8E6YX6ShejB4aUC4b78k0WVGKvk+0IUdq04RENJn4=; b=mn56iKT1yvc5HpPBD6NXIcohFe+vFaXUA2AqRXd/yJmEo2opO9ElMqBNYHX/bG86mttKkGQYr5C1AbbMpGNMGwFnCozVLR8Cs4cbDzSTPeJrb81ZlJZlxmkOGFbq7q73ArwqHpYhgnyMxVd2pOwXekI18jRirXbPdflrgr4HTms= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1660140439616115.94492401894843; Wed, 10 Aug 2022 07:07:19 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-45-Tw9hCn-ZN1ejNf7FtuavyQ-1; Wed, 10 Aug 2022 10:07:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8193B824072; Wed, 10 Aug 2022 14:07:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B6D894585; Wed, 10 Aug 2022 14:07:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4D7C1194F843; Wed, 10 Aug 2022 14:07:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B4E331946A4F for ; Wed, 10 Aug 2022 14:06:53 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A852F1121314; Wed, 10 Aug 2022 14:06:53 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 170A91121319 for ; Wed, 10 Aug 2022 14:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660140437; 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=VQ8E6YX6ShejB4aUC4b78k0WVGKvk+0IUdq04RENJn4=; b=O0fYioAK8MlSz0b503kuEqaJlbBb+wzqen0WNtZfkiZWPa8eE9WvfnJ02K96dYs6USXh3b JpzqPTtdtohCfiKbRugUjd+TY248TiAFNG+hNV4HvFzMdord7h1yAjUBy1/TSxcEC/2OUa XPStMU04fKv7Yc6Lr7Ix9ceeO9sxNLQ= X-MC-Unique: Tw9hCn-ZN1ejNf7FtuavyQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/4] qemuDomainObjWait: Report error when VM is being destroyed Date: Wed, 10 Aug 2022 16:06:48 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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: 1660140441046100003 Content-Type: text/plain; charset="utf-8" Since we started handing the monitor EOF event inside a job any code which uses virDomainObjWait would no longer properly abort in case when the VM crashed during the wait. This is because virDomainObjWait uses virDomainObjIsActive which checks 'vm->def->id' to see if the VM is still active. Unfortunately the domain id is cleared in qemuProcessStop which is run only inside the job. To fix this we can use the 'beingDestroyed' flag stored in the VM private data which is set to true around the time when the condition is signalled. Reported-by: Pavel Hrdina Fixes: 8c9ff9960b29d4703a99efdd1cadcf6f48799cc0 Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f68b7030c5..d3b7fcc933 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11785,5 +11785,15 @@ qemuDomainRemoveLogs(virQEMUDriver *driver, int qemuDomainObjWait(virDomainObj *vm) { - return virDomainObjWait(vm); + qemuDomainObjPrivate *priv =3D vm->privateData; + + if (virDomainObjWait(vm) < 0) + return -1; + + if (priv->beingDestroyed) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("domain is not ru= nning")); + return -1; + } + + return 0; } --=20 2.37.1