From nobody Sun Feb 8 19:21:19 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=1636993447; cv=none; d=zohomail.com; s=zohoarc; b=EpBhzI6nmgDQAzaou0dx+Q4AsLc8QJa8kR4V4YuHF38wbq456fJM+DLe6lqjxHpOAQ+Lm6h+RxfEAkly1kj2Nc/iqee8GTnVGksCVL00iQr+/t5So812Y85Jh4BfaJA5n6hKs9FUnomO8bXWHMJvvrBXvFKdCYC0d3L66B4a+Ys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636993447; 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=DYUGub2tOTUB7EUtaNFQRu9F9oamZS2jZAW3haM1fhU=; b=YV4wiLAV6CW9Ie6KgftbUVmEDN3f9yWOc7ZDd3hI+dSW1+BuWvlzYPHcD5AB8fEZueCF+3Dwl3VpMEFHdceXU6fs33mqVJWhXIsZ8uAZ6f/QZF7+5/3O0fy1zLfbQknLZrEtAllfkBydYCtqK+0gQpoZYYYOPsP1j4D/SC98+2Y= 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 1636993446857916.0466449412083; Mon, 15 Nov 2021 08:24:06 -0800 (PST) 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-544-mjZ2g6SsMj6UTAVctEiEWw-1; Mon, 15 Nov 2021 11:24:03 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CD3341018724; Mon, 15 Nov 2021 16:23:58 +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 A64B319D9F; Mon, 15 Nov 2021 16:23:58 +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 769851832DD5; Mon, 15 Nov 2021 16:23:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AFGNAK7028229 for ; Mon, 15 Nov 2021 11:23:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id 39BAA67843; Mon, 15 Nov 2021 16:23:10 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F50460657 for ; Mon, 15 Nov 2021 16:23:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636993445; 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=DYUGub2tOTUB7EUtaNFQRu9F9oamZS2jZAW3haM1fhU=; b=fVKT/zg7M5Qt02orZZ6Tttyf6dt58jDzZ3q5rRJoo6w7qXJoBqsX5bAwtSPQgXmYjlpJlz EJVXMq98zKcmv+BYRvLMuSeC52GAFRK0wzuw2aP+xWQCIGo8dBMgjQSIE4F04nkmLgLWnA kPh7Xy60TO4vsVFtJwv9Vg4jBjkNE98= X-MC-Unique: mjZ2g6SsMj6UTAVctEiEWw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 04/11] qemu_snapshot: revert: fix emitting events Date: Mon, 15 Nov 2021 17:22:47 +0100 Message-Id: <7180d8122ba6cba7ad59f135d6c2d6e859ea91a0.1636993188.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.84 on 10.5.11.23 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: 1636993482749100003 Content-Type: text/plain; charset="utf-8" Now that we always restart the QEMU process events are emitted differently so we need to update the code and the comment as well. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 251a0e5cfa..e08959a754 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1852,7 +1852,6 @@ qemuSnapshotRevert(virDomainObj *vm, virDomainDef *config =3D NULL; virDomainDef *inactiveConfig =3D NULL; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); - bool was_stopped =3D false; qemuDomainSaveCookie *cookie; virCPUDef *origCPU =3D NULL; unsigned int start_flags =3D VIR_QEMU_PROCESS_START_GEN_VMID; @@ -1865,15 +1864,14 @@ qemuSnapshotRevert(virDomainObj *vm, /* We have the following transitions, which create the following event= s: * 1. inactive -> inactive: none * 2. inactive -> running: EVENT_STARTED - * 3. inactive -> paused: EVENT_STARTED, EVENT_PAUSED + * 3. inactive -> paused: EVENT_STARTED, EVENT_SUSPENDED * 4. running -> inactive: EVENT_STOPPED - * 5. running -> running: none - * 6. running -> paused: EVENT_PAUSED + * 5. running -> running: EVENT_STOPPED, EVENT_STARTED + * 6. running -> paused: EVENT_STOPPED, EVENT_STARTED, EVENT_SUSPEN= DED * 7. paused -> inactive: EVENT_STOPPED - * 8. paused -> running: EVENT_RESUMED - * 9. paused -> paused: none - * Also, several transitions occur even if we fail partway through, - * and use of FORCE can cause multiple transitions. + * 8. paused -> running: EVENT_STOPPED, EVENT_STARTED + * 9. paused -> paused: EVENT_STOPPED, EVENT_STARTED, EVENT_SUSPEN= DED + * Also, several transitions occur even if we fail partway through. */ =20 if (qemuDomainHasBlockjob(vm, false)) { @@ -1993,9 +1991,6 @@ qemuSnapshotRevert(virDomainObj *vm, VIR_DOMAIN_EVENT_STO= PPED, detail); virObjectEventStateQueue(driver->domainEventState, event); - } else { - /* Transitions 2, 3 */ - was_stopped =3D true; } =20 if (inactiveConfig) { @@ -2034,13 +2029,10 @@ qemuSnapshotRevert(virDomainObj *vm, /* Transitions 3, 6, 9 */ virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_FROM_SNAPSHOT); - if (was_stopped) { - /* Transition 3, use event as-is and add event2 */ - detail =3D VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT; - event2 =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_SUSPEND= ED, - detail); - } /* else transition 6 and 9 use event as-is */ + detail =3D VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT; + event2 =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_SUSPENDED, + detail); } else { /* Transitions 2, 5, 8 */ if (!virDomainObjIsActive(vm)) { @@ -2053,15 +2045,6 @@ qemuSnapshotRevert(virDomainObj *vm, QEMU_ASYNC_JOB_START); if (rc < 0) goto endjob; - virObjectUnref(event); - event =3D NULL; - if (was_stopped) { - /* Transition 2 */ - detail =3D VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_STARTED, - detail); - } } break; =20 --=20 2.31.1