From nobody Sun Feb 8 19:35:31 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=1638452276; cv=none; d=zohomail.com; s=zohoarc; b=BdLHtNCwaqrIPS31N28bJp8FGwMBVFyz7R4wC6+OEhIPdg9CXi8zF8hDGOPTYUzpU5YN6lpiB2Q7l+YKupIFJBG5O/Yx0ldI4v74roeBUPogWYwcY1ATICIRvauzD4WqcP3dcwy3lZcxngGZXXbosl52bWvnwzbx/4IREaQUEXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638452276; 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=vuMlUoEwYGF1pzJVAoPgqDenWFTNrPPmoFRgTWBKcUI=; b=SjpCnUwbu70LwaOnbPCn5u4lBq5931zlOppX0RuiPl5Q1w97XhKUxxcVKxbKI2uf3I1gC/1AzPEZ5tZ0JQUW3RH1hOe7xMlXJvWhlLNAonhCPrFSuVnc7V0trM5YXlcBxvelsjc8Jhf+732TDNuHJXf1CVJW46FD00aSEO+JJE4= 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 1638452276257377.7929786581665; Thu, 2 Dec 2021 05:37:56 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-122-IOmxcjvjPoSHnsRc2drfWw-1; Thu, 02 Dec 2021 08:37:53 -0500 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 F3558801AA6; Thu, 2 Dec 2021 13:37:45 +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 CFC9A5DF3F; Thu, 2 Dec 2021 13:37:45 +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 9B4521809C8A; Thu, 2 Dec 2021 13:37:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1B2DXVaA021064 for ; Thu, 2 Dec 2021 08:33:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0607C5D9D5; Thu, 2 Dec 2021 13:33:31 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78326ADDC for ; Thu, 2 Dec 2021 13:33:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638452275; 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=vuMlUoEwYGF1pzJVAoPgqDenWFTNrPPmoFRgTWBKcUI=; b=HOc60cToMGZMlnQ7x1+4jXud2To6J6TmbOAV23EVIefwGpJ+6rXwLtU+XfS+aZEmRbOM+J JKCiUvY/Hky/Z5sO9i2Nv9pboXjVRxJ2ks7flGBKXjMiH3qxK4jD7mz6/3iIt2D+LQqk8p p4/PY4xSHFrGD62NSybfQmQkDm/sheI= X-MC-Unique: IOmxcjvjPoSHnsRc2drfWw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 09/14] qemu_snapshot: revert: refactor cleanup section Date: Thu, 2 Dec 2021 14:33:16 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: 1638452277834100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 950b1a65ff..1d4af221e2 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2256,14 +2256,18 @@ qemuSnapshotRevert(virDomainObj *vm, ret =3D -1; } } - if (ret =3D=3D 0 && defined && vm->persistent && - !(ret =3D virDomainDefSave(vm->newDef ? vm->newDef : vm->def, - driver->xmlopt, cfg->configDir))) { - detail =3D VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT; - virObjectEventStateQueue(driver->domainEventState, - virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_DEFINED, - detail)); + if (ret =3D=3D 0 && defined && vm->persistent) { + virDomainDef *saveDef =3D vm->newDef ? vm->newDef : vm->def; + + ret =3D virDomainDefSave(saveDef, driver->xmlopt, cfg->configDir); + + if (ret =3D=3D 0) { + detail =3D VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT; + event =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_DEFINED, + detail); + virObjectEventStateQueue(driver->domainEventState, event); + } } =20 return ret; --=20 2.31.1