From nobody Sun Feb 8 19:59:29 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=1636993618; cv=none; d=zohomail.com; s=zohoarc; b=HuIIbcntS3nVD8/Dy2SFCXvCUhCdU1n1hqHJItxHE0nrjCsM0ajWFIw/ttT4nHN++EeYDu7GQ0Vy+5ed2LWgDVIwXv9Ky/hdlr4J9vm2i8jA96B+E7ulSvt0c4fiZxk/aA57qFRJTzymP4T8q10dyhqeRb2oWNn04+mZjywkrBc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636993618; 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=b7OZ7UhuHnJtuoWDn7nTsxCsBT58RVfAwN/zmtvW9y8=; b=N82HUaqxGYTQNEgyESiOZw21xu7tDfKt+od2698CkYrKOlz5j/0WFuc1yNXKbRugKuXPi4E/0/2+NBJYB7fLA+gRBasFSRQuAwo/t31r4+hPZ2q5F1JDpj004wQmNO5yzzxudEJjaf54rC3CWOe96cqaOd3qYdlAM2jVEDfqJpY= 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 1636993618300138.07042047275456; Mon, 15 Nov 2021 08:26:58 -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-251-sVqkcO9wOkCIjrgAIMhf1g-1; Mon, 15 Nov 2021 11:26:55 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5950888EF03; Mon, 15 Nov 2021 16:26:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 39C8260BE5; Mon, 15 Nov 2021 16:26:33 +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 02C784E58E; Mon, 15 Nov 2021 16:26:33 +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 1AFGNEMw028278 for ; Mon, 15 Nov 2021 11:23:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id A65AB19EF9; Mon, 15 Nov 2021 16:23:14 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 21D6660657 for ; Mon, 15 Nov 2021 16:23:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636993617; 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=b7OZ7UhuHnJtuoWDn7nTsxCsBT58RVfAwN/zmtvW9y8=; b=WvpjRyE9/qj/ERnoEuY5wteDiWlDyzTMAYDCyOrfhDDOuk/u3S5M/i8ntdFICthlRLO2G6 a+3Pot/nPi9xnEk1PW3e7xpoSxpRiQHfrFt4qkCburFYeOoLOu42M+uEWTU76t2Wvkyd65 smBMlJSu43SpMmq5TiuN1Aki5mbfgfk= X-MC-Unique: sVqkcO9wOkCIjrgAIMhf1g-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 09/11] test: snapshot revert: fix emitting events Date: Mon, 15 Nov 2021 17:22:52 +0100 Message-Id: <20dfb7830956fd402d1f7b9589bf7e0d7ed75488.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.79 on 10.5.11.12 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: 1636993620410100001 Content-Type: text/plain; charset="utf-8" Now that we always emulate restarting the VM 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/test/test_driver.c | 42 +++++++++--------------------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 4ae68571ef..333b5e8bfc 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -9014,15 +9014,14 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr sna= pshot, /* 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 (!(vm =3D testDomObjFromSnapshot(snapshot))) @@ -9072,8 +9071,6 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snaps= hot, if (snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_RUNNING || snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_PAUSED) { /* Transitions 2, 3, 5, 6, 8, 9 */ - bool was_running =3D false; - bool was_stopped =3D false; =20 if (virDomainObjIsActive(vm)) { /* Transitions 5, 6, 8, 9 */ @@ -9083,8 +9080,6 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snaps= hot, VIR_DOMAIN_EVENT_STO= PPED, VIR_DOMAIN_EVENT_STO= PPED_FROM_SNAPSHOT); virObjectEventStateQueue(privconn->eventState, event); - } else { - was_stopped =3D true; } =20 virDomainObjAssignDef(vm, config, false, NULL); @@ -9102,28 +9097,9 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snap= shot, /* 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 */ - event2 =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_SUSPENDED, - VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT); - } /* else transition 6 and 9 use event as-is */ - } else { - /* Transitions 2, 5, 8 */ - virObjectUnref(event); - event =3D NULL; - - if (was_stopped) { - /* Transition 2 */ - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_STARTED, - VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT); - } else if (was_running) { - /* Transition 8 */ - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_RESUMED, - VIR_DOMAIN_EVENT_RESUMED); - } + event2 =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_SUSPENDED, + VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT); } } else { /* Transitions 1, 4, 7 */ --=20 2.31.1