From nobody Fri May 3 10:35:07 2024 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=1638452432; cv=none; d=zohomail.com; s=zohoarc; b=hQHHM303O/qC12vrAfnnPraiwYiZYYh2/8+1YpP2pQDewX0w+8moBiYALgRmdIhH4bvy+5gdClbE3ozu79uuu9CwsgOL9fmpYTLYOL2aZ2nmUcUCNBMN0QNaSq8P1PiUoJ7xXEUAHvGS7SrXZXnki8Gc177QzzYF5Cc3pN8TAFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638452432; 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=m9t4e+e4Du1+P+X8sFm/1jAmqzVrKnSxwIeLNsdu6CM=; b=DMCvKtJl0Net4L72JzYz25OosHI9wKQ08Tq22bttiKZaBEhY1TELEIB0H+LCmYA9OdvUTmphEupwh2lUq6p/wuQ5SBd2fhSMN2fSRTYjDS2zOG68YGu6Awxrp3L+Lkw49KrEL46j/umAjr9u6L4roxBJRLI9dqoxzYJaVTxP46E= 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 16384524329441019.4331625393578; Thu, 2 Dec 2021 05:40:32 -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-242-wk6qnbxqMS6QRwrCkKPpRA-1; Thu, 02 Dec 2021 08:40:28 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 836838042EA; Thu, 2 Dec 2021 13:40:23 +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 326EE45D78; Thu, 2 Dec 2021 13:40:23 +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 858C84BB7C; Thu, 2 Dec 2021 13:40:22 +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 1B2DXN97020980 for ; Thu, 2 Dec 2021 08:33:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id EF7BC5D9CA; Thu, 2 Dec 2021 13:33:23 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E4C15D9D5 for ; Thu, 2 Dec 2021 13:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638452431; 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=m9t4e+e4Du1+P+X8sFm/1jAmqzVrKnSxwIeLNsdu6CM=; b=a9JGXU2LPTLrdPJhl5GdXAeiN4qeNJORg+tYmhzb3urArgUjFHvRbog03LURrkmErz1yQU ID7XVTr13tq7jCGvfN5hNA74fLwGSejCwrK31mXH8nxOYFPpTywFqHf6SCD3KiYOGwtEhN vmqBzV4D+9GOCSkLZsYzhKCt6ciRZdw= X-MC-Unique: wk6qnbxqMS6QRwrCkKPpRA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 01/14] qemu_snapshot: revert: fix incorrect jump to cleanup Date: Thu, 2 Dec 2021 14:33:08 +0100 Message-Id: <954f4652f880ea23c7b04b6b4d476d6daa6f04c3.1638451855.git.phrdina@redhat.com> 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.11 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: 1638452434098100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_snapshot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index edf5511e42..64b5838db8 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2087,7 +2087,7 @@ qemuSnapshotRevert(virDomainObj *vm, */ if (cookie && qemuDomainFixupCPUs(vm, &cookie->cpu) < 0) - goto cleanup; + goto endjob; =20 rc =3D qemuProcessStart(snapshot->domain->conn, driver, vm, cookie ? cookie->cpu : NULL, --=20 2.31.1 From nobody Fri May 3 10:35:07 2024 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=1638452024; cv=none; d=zohomail.com; s=zohoarc; b=F12tuqZ+SxHVmyVPgDhCcOtXuCM8pu1Iz0r+Nu6PH/T/1bK3x9eJVVIzt07XCGg32AdO0rfQM17bueVepnaV58yBWiDGxj76DG8WTeONH2R/BAGS60etgI3MAFT0N3Y56ASLq5Z1b1m+yRcObivQM9g1CK9TFc2Zc24YnPmsQUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638452024; 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=+rNCx+hOAq4oQ1MWMQXcqgsTLcCkyD34SSzpYJu1Eu0=; b=T0KRAtZfZE/+aKSTzAeXDpv8QPIwyZysTUAJYf/wb1GiXd1dzTRoYg2OwroN0e6A6bi+oF3pIkqMD6lcbsK2ethXiOeg5A2wmuUWD1hwZ3rzoTRZ1ZxaRy/faHLeSxnHn1GmwasW1kdwsrnaQzLvHHG9qoQ0ft01MB3072yqVGQ= 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 163845202483846.7690780126826; Thu, 2 Dec 2021 05:33:44 -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-595-KtrxIr-qOd6yzQGGEdNDKw-1; Thu, 02 Dec 2021 08:33:40 -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 652FA83DEA6; Thu, 2 Dec 2021 13:33:35 +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 60DBF4EDC1; Thu, 2 Dec 2021 13:33: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 CBDEC4CA9B; Thu, 2 Dec 2021 13:33:27 +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 1B2DXOFV020987 for ; Thu, 2 Dec 2021 08:33:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id D399918371; Thu, 2 Dec 2021 13:33:24 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51BDA5D9D5 for ; Thu, 2 Dec 2021 13:33:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638452023; 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=+rNCx+hOAq4oQ1MWMQXcqgsTLcCkyD34SSzpYJu1Eu0=; b=agdtP6wADfTFs1QYoMJcDNy5mm19BiQBHTGsHDDq7YISP8A+Nvk8A892nHiltUno9OxnVJ m+V8+ZCothndOwb+lIDFqYZ5Uw+en3pELJ5hpd9NuLwAtPPdA31iSznPWUu1vjUBaWHlcf 8gMeukGP0EoeJavurVXYxflM54ckxG0= X-MC-Unique: KtrxIr-qOd6yzQGGEdNDKw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 02/14] qemu_snapshot: revert: drop unused variable Date: Thu, 2 Dec 2021 14:33:09 +0100 Message-Id: <0c122b1f9690e9ed3daf6eede5af71c5cd86f658.1638451855.git.phrdina@redhat.com> 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: 1638452025430100002 Content-Type: text/plain; charset="utf-8" Commit dropped unused code but missed one variable. Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_snapshot.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 64b5838db8..413b31bae5 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1944,7 +1944,6 @@ qemuSnapshotRevert(virDomainObj *vm, virDomainDef *inactiveConfig =3D NULL; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); qemuDomainSaveCookie *cookie; - virCPUDef *origCPU =3D NULL; unsigned int start_flags =3D VIR_QEMU_PROCESS_START_GEN_VMID; bool defined =3D false; =20 @@ -2234,7 +2233,6 @@ qemuSnapshotRevert(virDomainObj *vm, } virObjectEventStateQueue(driver->domainEventState, event); virObjectEventStateQueue(driver->domainEventState, event2); - virCPUDefFree(origCPU); virDomainDefFree(config); virDomainDefFree(inactiveConfig); =20 --=20 2.31.1 From nobody Fri May 3 10:35:07 2024 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=1638452024; cv=none; d=zohomail.com; s=zohoarc; b=nxZRM0DbogCmHlhYbQt7MjBEmwmoYxirmVyhR+CiYRwCed/H3uQ7B+zyZ2fIY/i0zsTUGnA2s6u17s05haYvElieNhKgXIY2LFYMSMn0suIOjXgdQJRJdd4WqC+rcmfDSphaz8kJdkDG4snTYrMZwsAEh0UPvdVGF5vseV2IYeQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638452024; 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=6xiK6GYS1E9AzK9s0fpDMtHU3p8fo7ntpcqo603kTFo=; b=lVBzwuAcXx2qtyucJ54DJF93fFY76c2scGPRA7KBlpSgzqEnARiAGiYebOQR5yxHZQMvXQPf8GF8NDZB/nkZFuFGA6fIP0idQgHAh6uI54n6IXPsW2VLs8l/OicCbdHbyRJx6hk0XKPYEM6jNRqHVlsNKF/lJOe0CdyxwflNeJA= 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 1638452024710769.6995459109879; Thu, 2 Dec 2021 05:33:44 -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-427-ewHy8jfNN1a9qItbx6WzPQ-1; Thu, 02 Dec 2021 08:33:40 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7CBA818690E3; Thu, 2 Dec 2021 13:33:34 +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 7D6AA100E125; Thu, 2 Dec 2021 13:33: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 C3E0A4CA93; Thu, 2 Dec 2021 13:33:27 +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 1B2DXPi0020996 for ; Thu, 2 Dec 2021 08:33:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id B57915D9D5; Thu, 2 Dec 2021 13:33:25 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 336964EDC1 for ; Thu, 2 Dec 2021 13:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638452023; 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=6xiK6GYS1E9AzK9s0fpDMtHU3p8fo7ntpcqo603kTFo=; b=E8t1rnvCWuUPCquBPjmgINgmSfMMPQehNBKZiDMo4YKzmIWovtLPRMSn1JpAS9A7uYPvBS DhHikHthzbauD4RLoQ8ys31wqyFHMNldjYDtlxPrhpl1/XKZ0sd8Ux2kZISAlHw/l00+26 TssqsVFnFZzM5JsvnuPkkv8o6ojS5Gk= X-MC-Unique: ewHy8jfNN1a9qItbx6WzPQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 03/14] qemu_snapshot: revert: use g_autoptr Date: Thu, 2 Dec 2021 14:33:10 +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.84 on 10.5.11.22 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: 1638452025409100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_snapshot.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 413b31bae5..5ac1c99a68 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1940,8 +1940,8 @@ qemuSnapshotRevert(virDomainObj *vm, int detail; qemuDomainObjPrivate *priv =3D vm->privateData; int rc; - virDomainDef *config =3D NULL; - virDomainDef *inactiveConfig =3D NULL; + g_autoptr(virDomainDef) config =3D NULL; + g_autoptr(virDomainDef) inactiveConfig =3D NULL; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); qemuDomainSaveCookie *cookie; unsigned int start_flags =3D VIR_QEMU_PROCESS_START_GEN_VMID; @@ -2233,8 +2233,6 @@ qemuSnapshotRevert(virDomainObj *vm, } virObjectEventStateQueue(driver->domainEventState, event); virObjectEventStateQueue(driver->domainEventState, event2); - virDomainDefFree(config); - virDomainDefFree(inactiveConfig); =20 return ret; } --=20 2.31.1 From nobody Fri May 3 10:35:07 2024 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=1638452054; cv=none; d=zohomail.com; s=zohoarc; b=O8bLfarA00N/k2G1Rsnl+uPFwqhPVWSuUHLGgoLybov8MGo9e8gSEZbX1JAXpmpafXtY8PIc0HzYzcnq19TB1DInAG4nqbK9mD1TcUVRYWvDG88r+mghx8g4hk1ycWVFXu1vWPDBaUWspxzaa8SYxLHZDhXmxD7RlpzjH48npWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638452054; 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=fmvaIbvxusFxnGftAMZ+ociJyg6J2mnAThVEmtLQAZM=; b=P77yLtrdKWWyJKgwNQsjdn0XWqyQEKAEzQpNJCovh0vtZ3ED7gQR+e06FC1gypyjXjIFlN0UjVxopF8maSHpfu3wKH55yem+rsvg4C2btpme8V1HVoyQP3dl7RCYpNa/nV5TLqAVX1ZJ25/GP5snKtUqZTWe4sOKQ1v7nQ/37UI= 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 1638452054553229.46857929673342; Thu, 2 Dec 2021 05:34:14 -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-492-P09S12ryMzmcBp48RM5Ikw-1; Thu, 02 Dec 2021 08:34:06 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 72C4684BA1E; Thu, 2 Dec 2021 13:34:01 +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 5933E45D67; Thu, 2 Dec 2021 13:34:01 +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 2D4C41809C8A; Thu, 2 Dec 2021 13:34:01 +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 1B2DXQtC021001 for ; Thu, 2 Dec 2021 08:33:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 97CE85D9D5; Thu, 2 Dec 2021 13:33:26 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15DA95D9CA for ; Thu, 2 Dec 2021 13:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638452053; 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=fmvaIbvxusFxnGftAMZ+ociJyg6J2mnAThVEmtLQAZM=; b=LbgzSxwPClaivh6Bfgieq+gOxooh/SP8F2MljAeqtNskR0Od87iZxpI6C+xS9ewVKmey7W 6Giqb0nutzW+6uVVOj6QK2Rlj2FhJDLyRVtw7ErB5XGgPYaRfi5i+PsiVdoSusV9XAk5Vp YOMm5Ohm4b8k6vPTImyHRLvfHcjqnUk= X-MC-Unique: P09S12ryMzmcBp48RM5Ikw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 04/14] qemu_snapshot: revert: jump to endjob instead of calling qemuProcessEndJob Date: Thu, 2 Dec 2021 14:33:11 +0100 Message-Id: <561bfc5157632d3fb82fab38da3d979d4f491a54.1638451855.git.phrdina@redhat.com> 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.11 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: 1638452055534100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_snapshot.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 5ac1c99a68..8191733a6d 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2149,8 +2149,7 @@ qemuSnapshotRevert(virDomainObj *vm, =20 if (qemuSnapshotRevertInactive(driver, vm, snap) < 0) { qemuDomainRemoveInactive(driver, vm); - qemuProcessEndJob(driver, vm); - goto cleanup; + goto endjob; } =20 if (inactiveConfig) { @@ -2173,8 +2172,7 @@ qemuSnapshotRevert(virDomainObj *vm, virDomainAuditStart(vm, "from-snapshot", rc >=3D 0); if (rc < 0) { qemuDomainRemoveInactive(driver, vm); - qemuProcessEndJob(driver, vm); - goto cleanup; + goto endjob; } detail =3D VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; event =3D virDomainEventLifecycleNewFromObj(vm, --=20 2.31.1 From nobody Fri May 3 10:35:07 2024 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=1638452270; cv=none; d=zohomail.com; s=zohoarc; b=FY8HfYjoBoZ4Oa2Jbq1QFn1Mh/dvyKvBEFSMQTY9EsHhrwC5nYq6jipTl6NLfAHQpFLVBKi/Tz8Z9B2SdcLjwLUxcqlcXS+2L3Z9dg0L84RvCPWKf691lH1wdqtJj/7HUQNUyfEhZugiypnY/LPG17+F+BQ6DxsJsGenQQwf5+M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638452270; 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=UEsRhYSJr4bJJe8oDGKP7j/wyMdcL67HaL7TVr8j4ps=; b=Lo4vdLetEc99+dmhRvK4yGEGvwKj4DC7RmckYUQacm2FNDspHnFc4vF9D3oF6qr27DVWERfDb6P1CG5pv+NSevWCdt8zDdovyBQ1L/LMbFuMATqoWjwK3487wE2uH9KCr7RDDE1omGz3jZJty7Wn224eXytqBzWW3wPH/TmBRVk= 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 1638452270527700.9109126877416; Thu, 2 Dec 2021 05:37:50 -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-263-I-SAMXjLNXWRCGrSk5_TgQ-1; Thu, 02 Dec 2021 08:37:48 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1A8E18042E1; Thu, 2 Dec 2021 13:37:41 +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 EA79E79450; Thu, 2 Dec 2021 13:37:40 +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 A92FF1809CB7; Thu, 2 Dec 2021 13:37:40 +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 1B2DXREd021014 for ; Thu, 2 Dec 2021 08:33:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7AD8C5D9D5; Thu, 2 Dec 2021 13:33:27 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC1A15D9CA for ; Thu, 2 Dec 2021 13:33:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638452269; 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=UEsRhYSJr4bJJe8oDGKP7j/wyMdcL67HaL7TVr8j4ps=; b=YIrIysBNdlAn+oYu0Ev1GBYtPAywtYV807BpYu+qqwELfIM9sKCV6L4RWtb/iqNCtm20Xx C711xfxYxEOettOY4T0/1ftgjgrb3B6wD3fncSOjYrrzaYdxIAj9fN+cUbIzIbCF7wPPef gAtQxJZsWVzRGmzhaKVrvuYCvn5i1g8= X-MC-Unique: I-SAMXjLNXWRCGrSk5_TgQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 05/14] qemu_snapshot: revert: remove cleanup label Date: Thu, 2 Dec 2021 14:33:12 +0100 Message-Id: <3a9da1e08a8105311da596ba598aa1f37d4f6b03.1638451855.git.phrdina@redhat.com> 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.16 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: 1638452272254100001 Content-Type: text/plain; charset="utf-8" Now the cleanup label is not necessary so we can drop it. Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_snapshot.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 8191733a6d..beeb012431 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1967,13 +1967,13 @@ qemuSnapshotRevert(virDomainObj *vm, if (qemuDomainHasBlockjob(vm, false)) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain has active block job")); - goto cleanup; + return -1; } =20 if (qemuProcessBeginJob(driver, vm, VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT, flags) < 0) - goto cleanup; + return -1; =20 if (!(snap =3D qemuSnapObjFromSnapshot(vm, snapshot))) goto endjob; @@ -2210,7 +2210,6 @@ qemuSnapshotRevert(virDomainObj *vm, endjob: qemuProcessEndJob(driver, vm); =20 - cleanup: if (ret =3D=3D 0) { qemuSnapshotSetCurrent(vm, snap); if (qemuDomainSnapshotWriteMetadata(vm, snap, --=20 2.31.1 From nobody Fri May 3 10:35:07 2024 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=1638452263; cv=none; d=zohomail.com; s=zohoarc; b=VNRPozr+6gBeTXPCPoIrIE0Cggio9ycDo+rvo2cufCu7wUtKk9xr8bP5TPlPpR4wE8fio2IzNmFZgoPVSBeAhi4XbCPFnLklALqhVhkKjZsBMZ9PKXGqk50fEawgbhpLckcmjgVlS6AIR8UaluWZD1SU3gypo1tqwVWRBorkr9s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638452263; 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=aZSwn0+30Ev+CAIYh+NsHwiS8CtpdYSC8imv/Xw1/UE=; b=HPGB83E4pdCnE/PtYki2z+8DocSy6vEbqU79soqCP7oe97A4fgeG+tGPFS8GYzaFIkgsrkI/kb0Yev/qwXRpBdQKNyNHAsrSy8Ip9GezB1vNoxeSr2fIvwpODONeBoaGEzdQBjfCbuLclzfdkZxneoyLOj+eZVodUvkR8Dz66w4= 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 163845226345774.82198237919488; Thu, 2 Dec 2021 05:37:43 -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-375-gGbxmJ50OsW2BxD7YDYYtg-1; Thu, 02 Dec 2021 08:37:40 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AC9201023F53; Thu, 2 Dec 2021 13:37:35 +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 8EE611000051; Thu, 2 Dec 2021 13:37:35 +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 5D7011809C89; Thu, 2 Dec 2021 13:37:35 +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 1B2DXSqS021031 for ; Thu, 2 Dec 2021 08:33:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5DB145D9CA; Thu, 2 Dec 2021 13:33:28 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id D032818371 for ; Thu, 2 Dec 2021 13:33:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638452262; 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=aZSwn0+30Ev+CAIYh+NsHwiS8CtpdYSC8imv/Xw1/UE=; b=bL0qn1DZyg13HQ60aG67+PTAT3V4yAXCEli8dlnPgy+1ZJzYhHbzemaDu9NvwjohN04gPE xxiwBZf0Bw8epoU4fO/i7vhDcJBVmHrkny3eEMbIQwCCj7kOl/j7Ye25FzSDV7ozlaNuoy rOYNZALGeVoaJK/kbnkBgtssV4iUKhY= X-MC-Unique: gGbxmJ50OsW2BxD7YDYYtg-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 06/14] qemu_snapshot: revert: move validation to separate function Date: Thu, 2 Dec 2021 14:33:13 +0100 Message-Id: <1782615665359a8c2698e5a2856deccc0c37ac18.1638451855.git.phrdina@redhat.com> 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.84 on 10.5.11.22 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: 1638452265003100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_snapshot.c | 78 ++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 34 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index beeb012431..cc219f8b64 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1897,6 +1897,49 @@ qemuSnapshotCreateXML(virDomainPtr domain, } =20 =20 +static int +qemuSnapshotRevertValidate(virDomainObj *vm, + virDomainMomentObj *snap, + virDomainSnapshotDef *snapdef, + unsigned int flags) +{ + if (!vm->persistent && + snapdef->state !=3D VIR_DOMAIN_SNAPSHOT_RUNNING && + snapdef->state !=3D VIR_DOMAIN_SNAPSHOT_PAUSED && + (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING | + VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) =3D=3D 0) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("transient domain needs to request run or pause t= o revert to inactive snapshot")); + return -1; + } + + if (virDomainSnapshotIsExternal(snap)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("revert to external snapshot not supported yet")); + return -1; + } + + if (!snap->def->dom) { + virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, + _("snapshot '%s' lacks domain '%s' rollback info"), + snap->def->name, vm->def->name); + return -1; + } + + if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) { + if (vm->hasManagedSave && + !(snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_RUNNING || + snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_PAUSED)) { + virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, "%s", + _("snapshot without memory state, removal of ex= isting managed saved state strongly recommended to avoid corruption")); + return -1; + } + } + + return 0; +} + + /* The domain is expected to be locked and inactive. */ static int qemuSnapshotRevertInactive(virQEMUDriver *driver, @@ -1979,41 +2022,8 @@ qemuSnapshotRevert(virDomainObj *vm, goto endjob; snapdef =3D virDomainSnapshotObjGetDef(snap); =20 - if (!vm->persistent && - snapdef->state !=3D VIR_DOMAIN_SNAPSHOT_RUNNING && - snapdef->state !=3D VIR_DOMAIN_SNAPSHOT_PAUSED && - (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING | - VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) =3D=3D 0) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("transient domain needs to request run or pause " - "to revert to inactive snapshot")); + if (qemuSnapshotRevertValidate(vm, snap, snapdef, flags) < 0) goto endjob; - } - - if (virDomainSnapshotIsExternal(snap)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("revert to external snapshot not supported yet")); - goto endjob; - } - - if (!snap->def->dom) { - virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, - _("snapshot '%s' lacks domain '%s' rollback info"), - snap->def->name, vm->def->name); - goto endjob; - } - - if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) { - if (vm->hasManagedSave && - !(snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_RUNNING || - snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_PAUSED)) { - virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, "%s", - _("snapshot without memory state, removal of " - "existing managed saved state strongly " - "recommended to avoid corruption")); - goto endjob; - } - } =20 config =3D virDomainDefCopy(snap->def->dom, driver->xmlopt, priv->qemuCaps, true); --=20 2.31.1 From nobody Fri May 3 10:35:07 2024 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=1638452270; cv=none; d=zohomail.com; s=zohoarc; b=Q6zcWz5JSbUN1vLAuOtyOFL7e4ZupA9PcDdgrGHje4ak2kA+TuwrFyx/MvE/Fu6chH1b0RbsDo15Yjm/WfWwBCVuymOIJyJ+LcgNhYuFvtrO8pnPain29znVFwABNXpMYereeM6QhoR17uEKFISQA202JDthpXPP++wMzV4TyMo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638452270; 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=T6L1tEC8K1lMOhsUhZWhKMMS5H6HpYYyy8YezUvu+Ok=; b=hghwDJb417kh7m8WSrZ+EtraxU6LD5HMXL91/mfkYQD0pIN9bGZISNSf+cyzn80VJFBFciK7zJGdZHTqU+SprU+W2QjbRZNbk+LWL7PxqTXZrU5ZGPTJ/o/UihuIBptGpczsNt6DMwP/pWA+CBdJNKbox0jqbuxzXK8rgRRuGF8= 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 1638452270954590.4491037069495; Thu, 2 Dec 2021 05:37:50 -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-598--UTahCfaNNKV4eFRwkjGrA-1; Thu, 02 Dec 2021 08:37:48 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3C5A5101873E; Thu, 2 Dec 2021 13:37:42 +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 1D0B376608; Thu, 2 Dec 2021 13:37:42 +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 99B384BB7C; Thu, 2 Dec 2021 13:37:41 +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 1B2DXTpU021038 for ; Thu, 2 Dec 2021 08:33:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 417605D9D5; Thu, 2 Dec 2021 13:33:29 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id B362A5D9CA for ; Thu, 2 Dec 2021 13:33:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638452269; 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=T6L1tEC8K1lMOhsUhZWhKMMS5H6HpYYyy8YezUvu+Ok=; b=QArk0xEx/zkyGkkND0oWxE14+InaJ0niScOhLKNq1po1ptT82WRxt8bIuFerXQSfODVyxz U2Mu6paIs4vVYzL6tBJEiy0wpS0PKPle37w8gwGaX16hwY92ru0HFkMGhzNso5eMATGT3+ GjlfTdB8y6H2s9EDvFvLKh6W0WMAg/4= X-MC-Unique: -UTahCfaNNKV4eFRwkjGrA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 07/14] qemu_snapshot: revert: move config prepare code to separate function Date: Thu, 2 Dec 2021 14:33:14 +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.16 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: 1638452272336100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_snapshot.c | 95 +++++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 36 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index cc219f8b64..589daaa73e 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1940,6 +1940,63 @@ qemuSnapshotRevertValidate(virDomainObj *vm, } =20 =20 +static int +qemuSnapshotRevertPrep(virDomainMomentObj *snap, + virDomainSnapshotDef *snapdef, + virQEMUDriver *driver, + virDomainObj *vm, + virDomainDef **retConfig, + virDomainDef **retInactiveConfig) +{ + qemuDomainObjPrivate *priv =3D vm->privateData; + g_autoptr(virDomainDef) config =3D NULL; + g_autoptr(virDomainDef) inactiveConfig =3D NULL; + + config =3D virDomainDefCopy(snap->def->dom, + driver->xmlopt, priv->qemuCaps, true); + if (!config) + return -1; + + if (STRNEQ(config->name, vm->def->name)) { + VIR_FREE(config->name); + config->name =3D g_strdup(vm->def->name); + } + + if (snap->def->inactiveDom) { + inactiveConfig =3D virDomainDefCopy(snap->def->inactiveDom, + driver->xmlopt, priv->qemuCaps, = true); + if (!inactiveConfig) + return -1; + + if (STRNEQ(inactiveConfig->name, vm->def->name)) { + VIR_FREE(inactiveConfig->name); + inactiveConfig->name =3D g_strdup(vm->def->name); + } + } else { + /* Inactive domain definition is missing: + * - either this is an old active snapshot and we need to copy the + * active definition as an inactive one + * - or this is an inactive snapshot which means config contains t= he + * inactive definition. + */ + if (snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_RUNNING || + snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_PAUSED) { + inactiveConfig =3D virDomainDefCopy(snap->def->dom, + driver->xmlopt, priv->qemuCa= ps, true); + if (!inactiveConfig) + return -1; + } else { + inactiveConfig =3D g_steal_pointer(&config); + } + } + + *retConfig =3D g_steal_pointer(&config); + *retInactiveConfig =3D g_steal_pointer(&inactiveConfig); + + return 0; +} + + /* The domain is expected to be locked and inactive. */ static int qemuSnapshotRevertInactive(virQEMUDriver *driver, @@ -1981,7 +2038,6 @@ qemuSnapshotRevert(virDomainObj *vm, virObjectEvent *event =3D NULL; virObjectEvent *event2 =3D NULL; int detail; - qemuDomainObjPrivate *priv =3D vm->privateData; int rc; g_autoptr(virDomainDef) config =3D NULL; g_autoptr(virDomainDef) inactiveConfig =3D NULL; @@ -2025,42 +2081,9 @@ qemuSnapshotRevert(virDomainObj *vm, if (qemuSnapshotRevertValidate(vm, snap, snapdef, flags) < 0) goto endjob; =20 - config =3D virDomainDefCopy(snap->def->dom, - driver->xmlopt, priv->qemuCaps, true); - if (!config) + if (qemuSnapshotRevertPrep(snap, snapdef, driver, vm, + &config, &inactiveConfig) < 0) { goto endjob; - - if (STRNEQ(config->name, vm->def->name)) { - VIR_FREE(config->name); - config->name =3D g_strdup(vm->def->name); - } - - if (snap->def->inactiveDom) { - inactiveConfig =3D virDomainDefCopy(snap->def->inactiveDom, - driver->xmlopt, priv->qemuCaps, = true); - if (!inactiveConfig) - goto endjob; - - if (STRNEQ(inactiveConfig->name, vm->def->name)) { - VIR_FREE(inactiveConfig->name); - inactiveConfig->name =3D g_strdup(vm->def->name); - } - } else { - /* Inactive domain definition is missing: - * - either this is an old active snapshot and we need to copy the - * active definition as an inactive one - * - or this is an inactive snapshot which means config contains t= he - * inactive definition. - */ - if (snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_RUNNING || - snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_PAUSED) { - inactiveConfig =3D virDomainDefCopy(snap->def->dom, - driver->xmlopt, priv->qemuCa= ps, true); - if (!inactiveConfig) - goto endjob; - } else { - inactiveConfig =3D g_steal_pointer(&config); - } } =20 cookie =3D (qemuDomainSaveCookie *) snapdef->cookie; --=20 2.31.1 From nobody Fri May 3 10:35:07 2024 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=1638452344; cv=none; d=zohomail.com; s=zohoarc; b=nOAmiswbDKGW4kRg3iQoIw2glKIcxuumupAAJeIb6GpoOLElGoqqNKQCSM/3FbDdHZidMHAZgXh/EYMJ05c5Gz3xor5ZUWfuiOw9hhU0EHiyJCLscyYiHpdI+elvHHvPgQscWwr3vx5zkzKKUYqp9RA2ZSr4mCrBXz4mFKUP9YE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638452344; 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=h9bb/sbXcMnptxBIVFGhqa1Q02XWU88ZuGGSELIqqg8=; b=jgU6owrsMxSXAb5k0vGVAiE7qObEt89Zfnq1v8WU/zpKJaMmWbCg/juG3WawDkBWwIp+KYzn3mKgh4tkmS+0a4andYZhuo5583n8UvQj2VARWAXg2shkeMomabI1xWVVpop0xjOaLcyQCZW+6T4HMf9a3SudOC28uaAuOYc3cRM= 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 1638452344282694.7311180428255; Thu, 2 Dec 2021 05:39:04 -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-414-EN4JGXC3N8aGcfH8FKm4pA-1; Thu, 02 Dec 2021 08:37:53 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D0E2101F7B8; Thu, 2 Dec 2021 13:37:44 +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 DC1F15F4ED; Thu, 2 Dec 2021 13:37:43 +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 A51314A7C9; Thu, 2 Dec 2021 13:37:43 +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 1B2DXUUs021046 for ; Thu, 2 Dec 2021 08:33:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id 23D975D9D5; Thu, 2 Dec 2021 13:33:30 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 969445D9CA for ; Thu, 2 Dec 2021 13:33:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638452343; 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=h9bb/sbXcMnptxBIVFGhqa1Q02XWU88ZuGGSELIqqg8=; b=LW33lRy5Kdm/6ktglqYeZA2PGYt517VGh+dQ/m+qThNp/nDvFpdIfXBwtf3BBBCFtTODHb 4pNfZb7F2Vyvvvq0n+eiVCVFSxDqXWWJ0+Rzlbzc2lggz1p2MbchoBavnuYah99OQyYm6v +ucuZkPZGJJirfZacCI73EELO190UPk= X-MC-Unique: EN4JGXC3N8aGcfH8FKm4pA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 08/14] qemu_snapshot: revert: emit event right after they are created Date: Thu, 2 Dec 2021 14:33:15 +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.15 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: 1638452345398100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_snapshot.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 589daaa73e..950b1a65ff 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2131,6 +2131,7 @@ qemuSnapshotRevert(virDomainObj *vm, event =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, detail); + virObjectEventStateQueue(driver->domainEventState, event); if (rc < 0) goto endjob; =20 @@ -2145,6 +2146,7 @@ qemuSnapshotRevert(virDomainObj *vm, event2 =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, detail); + virObjectEventStateQueue(driver->domainEventState, event2); } else { /* Transitions 2, 5, 8 */ if (!virDomainObjIsActive(vm)) { @@ -2178,6 +2180,7 @@ qemuSnapshotRevert(virDomainObj *vm, event =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, detail); + virObjectEventStateQueue(driver->domainEventState, event); } =20 if (qemuSnapshotRevertInactive(driver, vm, snap) < 0) { @@ -2197,7 +2200,6 @@ qemuSnapshotRevert(virDomainObj *vm, =20 start_flags |=3D paused ? VIR_QEMU_PROCESS_START_PAUSED : 0; =20 - virObjectEventStateQueue(driver->domainEventState, event); rc =3D qemuProcessStart(snapshot->domain->conn, driver, vm, NU= LL, QEMU_ASYNC_JOB_START, NULL, -1, NULL, NU= LL, VIR_NETDEV_VPORT_PROFILE_OP_CREATE, @@ -2211,11 +2213,13 @@ qemuSnapshotRevert(virDomainObj *vm, event =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, detail); + virObjectEventStateQueue(driver->domainEventState, event); if (paused) { detail =3D VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT; event2 =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPEND= ED, detail); + virObjectEventStateQueue(driver->domainEventState, event2); } } break; @@ -2261,8 +2265,6 @@ qemuSnapshotRevert(virDomainObj *vm, VIR_DOMAIN_EVENT_DEFINED, detail)); } - virObjectEventStateQueue(driver->domainEventState, event); - virObjectEventStateQueue(driver->domainEventState, event2); =20 return ret; } --=20 2.31.1 From nobody Fri May 3 10:35:07 2024 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 Reviewed-by: J=C3=A1n Tomko --- 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 From nobody Fri May 3 10:35:07 2024 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=1638452283; cv=none; d=zohomail.com; s=zohoarc; b=aCAjGeyfCHkAQx62rZ/d0GqDtn2rTbzVKLDdupHU/ODxjLbqU3oTejXe3ZQ6uc7Kim9KlFEgBpmPQkWT6pT9VXN9B8/5Z6YXfZ1lt3SX83R/lfKdkpVaUXihFzz0erd3mzejZqsu/btvqmMRW5kAoXErAGOmBeTt49QhYyPUJDU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638452283; 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=/LFQx6dtthDND2Q+qIdKcEz3w7eqaRR9ElW6jGYgPSA=; b=jzSNuA826LaSPfZLvF3K8K9JLb0xSb1a64isO45i1+mWhKt4Z9F9JZ4OIju7uDvlvw0rHxOFuo7dezyOyM9yRGVecRUWQr5CAlmOtlRJyF6wgYqQIgTwd2M36CS4+KcFdRZ+EOiy+Ah//Ab7HntFGn2HKnM+pli8NVUrT3gS2ws= 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 1638452283848925.5687879309462; Thu, 2 Dec 2021 05:38:03 -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-356-C1-f6gXlPM-NX-1YRwlROg-1; Thu, 02 Dec 2021 08:37:59 -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 721FA64083; Thu, 2 Dec 2021 13:37:54 +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 556005D9D5; Thu, 2 Dec 2021 13:37:54 +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 27D761809CB7; Thu, 2 Dec 2021 13:37:54 +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 1B2DXWp6021074 for ; Thu, 2 Dec 2021 08:33:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id DCD0B5D9D5; 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 5B96D5D9CA for ; Thu, 2 Dec 2021 13:33:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638452282; 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=/LFQx6dtthDND2Q+qIdKcEz3w7eqaRR9ElW6jGYgPSA=; b=ClwAF3UKrU6cyQP75zoZMLGnjhE15acc719H1eWPEiyjM0pZpcV5xDxZtmcs0Rz/yNZ5si KctIMwaSqVJ5pd6yUMCCu+kGLPFnQf9WMznElml0Re80xu4Tbe6u/wT9A6OzHSbi2mb7ZR EkYZcSmdGzcRx+L2qutHrQCslhRiICg= X-MC-Unique: C1-f6gXlPM-NX-1YRwlROg-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 10/14] qemu_snapshot: revert: move saving metadata to separate function Date: Thu, 2 Dec 2021 14:33:17 +0100 Message-Id: <8cb15abb0bd40e64e8f1d16e5fca4c96552341bd.1638451855.git.phrdina@redhat.com> 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: 1638452285790100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_snapshot.c | 58 +++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 1d4af221e2..8ad441e41a 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1997,6 +1997,40 @@ qemuSnapshotRevertPrep(virDomainMomentObj *snap, } =20 =20 +static int +qemuSnapshotRevertWriteMetadata(virDomainObj *vm, + virDomainMomentObj *snap, + virQEMUDriver *driver, + virQEMUDriverConfig *cfg, + bool defined) +{ + qemuSnapshotSetCurrent(vm, snap); + if (qemuDomainSnapshotWriteMetadata(vm, snap, + driver->xmlopt, + cfg->snapshotDir) < 0) { + virDomainSnapshotSetCurrent(vm->snapshots, NULL); + return -1; + } + + if (defined && vm->persistent) { + int detail; + virObjectEvent *event =3D NULL; + virDomainDef *saveDef =3D vm->newDef ? vm->newDef : vm->def; + + if (virDomainDefSave(saveDef, driver->xmlopt, cfg->configDir) < 0) + return -1; + + detail =3D VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT; + event =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_DEFINED, + detail); + virObjectEventStateQueue(driver->domainEventState, event); + } + + return 0; +} + + /* The domain is expected to be locked and inactive. */ static int qemuSnapshotRevertInactive(virQEMUDriver *driver, @@ -2247,28 +2281,8 @@ qemuSnapshotRevert(virDomainObj *vm, endjob: qemuProcessEndJob(driver, vm); =20 - if (ret =3D=3D 0) { - qemuSnapshotSetCurrent(vm, snap); - if (qemuDomainSnapshotWriteMetadata(vm, snap, - driver->xmlopt, - cfg->snapshotDir) < 0) { - virDomainSnapshotSetCurrent(vm->snapshots, NULL); - ret =3D -1; - } - } - 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); - } - } + if (ret =3D=3D 0) + ret =3D qemuSnapshotRevertWriteMetadata(vm, snap, driver, cfg, def= ined); =20 return ret; } --=20 2.31.1 From nobody Fri May 3 10:35:07 2024 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=1638452284; cv=none; d=zohomail.com; s=zohoarc; b=BozX2o1oi8l5RR0yHrMDGwWwNQRqS4Xwq4DJpW2OznzqTu4zAEWH7ivZB5KtlTSTUw+SrgLAvNGxz+HCgZQd/rJmLv699IubrCsDuI4vUcDtl9cpAsjIp/1a25uZKgONyX8wl3vl9AO+EWhVE5bMaL2flLatDCrJYeqeHGvS5Tg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638452284; 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=ryLkmCg4o8Q948+IwltWwkS8zEVljDOIublmxt9CPOI=; b=i/ChV8dOhKmTW1S6Z2GDBjhFgQ6Izjw+bFi6s++dLy2geVe3ms2iXHtufQP0n9tXZUVl3WOMxPq4zOuL8tGPZd55Z1Vl4rIplqKspbNjP+QunWRTI0UhVsKX5GQgkzv3SCGJMsnhvGAcRZkAk5k4Gx4wYKkKTn8C7E/W9FK+tb0= 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 1638452284602644.5752683695509; Thu, 2 Dec 2021 05:38:04 -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-419-0eAmOkcbMGedL4V9U0XIhQ-1; Thu, 02 Dec 2021 08:38:02 -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 38B3284BA68; Thu, 2 Dec 2021 13:37:57 +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 DF02C22DEA; Thu, 2 Dec 2021 13:37:56 +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 A9CDB4A7C9; Thu, 2 Dec 2021 13:37:56 +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 1B2DXWnU021084 for ; Thu, 2 Dec 2021 08:33:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id BEAB75D9D5; Thu, 2 Dec 2021 13:33:32 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D3555D9CA for ; Thu, 2 Dec 2021 13:33:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638452283; 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=ryLkmCg4o8Q948+IwltWwkS8zEVljDOIublmxt9CPOI=; b=UQyyAUOJpeAMR2G3dFr6CM3dIHN6l3uL3Hkq/zXOEl67vj7ZsbKlpzhNN1+TSzrFOyvqrg LdinvctDdQKLG9I23jIoK/s/205d7dCGkfj59CfK88HIMDfw7JWYjQLUkqAcdng02vGBRx OU4mywNzv+CABSd3/6B7L6adJwRvITw= X-MC-Unique: 0eAmOkcbMGedL4V9U0XIhQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 11/14] qemu_snapshot: revert: save metadata within qemu process job Date: Thu, 2 Dec 2021 14:33:18 +0100 Message-Id: <5499179ab17c1122992679d6b841d03690ca729a.1638451855.git.phrdina@redhat.com> 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.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: 1638452285947100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_snapshot.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 8ad441e41a..5c974280af 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2276,14 +2276,11 @@ qemuSnapshotRevert(virDomainObj *vm, goto endjob; } =20 - ret =3D 0; + ret =3D qemuSnapshotRevertWriteMetadata(vm, snap, driver, cfg, defined= ); =20 endjob: qemuProcessEndJob(driver, vm); =20 - if (ret =3D=3D 0) - ret =3D qemuSnapshotRevertWriteMetadata(vm, snap, driver, cfg, def= ined); - return ret; } =20 --=20 2.31.1 From nobody Fri May 3 10:35:07 2024 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=1638452417; cv=none; d=zohomail.com; s=zohoarc; b=CxcPrgXfcaszbBmAQqKohTUaZQgVNVWlN5vpozk/9OHVPUE8fdpnlGwJcg5FXGkcTHjrXn0KvTXesEzU96r7UNQAv10R3CF9mw1x7PV5lmNi+ShmCtq/4CjTHG6UP5zysBhZJaoCgFN+0+XyRLf1oU4RsSzT26ztsOjrlhmP0lw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638452417; 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=FR7qtNwoGnuIxla92vmPRY3UjeKpO+3iLEsvS2xbIbI=; b=RA++xa5voY3rRilNkVtemTXV0fCACIURvHMBYnvoXJJiLrXCw5Wsdbz6litL4GZ8NRmu9Z25GFzXUBLIr7JLkLPN8mdL3aVj1HmOyKN6+k9G46vBUCzjDG90UmtPmGlO/ZA1LowrBf0VJv4FvoE3vJdg1348l638XOYDhGZO0gs= 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 1638452417430184.69005980454335; Thu, 2 Dec 2021 05:40:17 -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-68-SxfleEn3OX2SuUvaGAPgJw-1; Thu, 02 Dec 2021 08:37:56 -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 E3A3B85B6C3; Thu, 2 Dec 2021 13:37:46 +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 A2D715DF2B; Thu, 2 Dec 2021 13:37:46 +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 6AEBD4A7CA; Thu, 2 Dec 2021 13:37:46 +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 1B2DXXJ5021096 for ; Thu, 2 Dec 2021 08:33:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id A0F105DF3F; Thu, 2 Dec 2021 13:33:33 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F97D5D9CA for ; Thu, 2 Dec 2021 13:33:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638452416; 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=FR7qtNwoGnuIxla92vmPRY3UjeKpO+3iLEsvS2xbIbI=; b=dVbrxM73eaNzLivImrSQf22t1663w3O2bZof+D4b6JbJ1Dl6f356AiDhAvzJGT44AnbmPC aCt4jBvteL8N/d9jnoDXcdjESsunqbrdaWupceHc4NT9oYVrSRxYl2G6HANKQBgik+xrzE PZcX35TLLJ8SHTF8IVD/scWKEG+0ZUg= X-MC-Unique: SxfleEn3OX2SuUvaGAPgJw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 12/14] qemu_snapshot: revert: move active snapshot revert to separate function Date: Thu, 2 Dec 2021 14:33:19 +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: 1638452418471100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_snapshot.c | 171 ++++++++++++++++++++++----------------- 1 file changed, 98 insertions(+), 73 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 5c974280af..4f0e484ab5 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2031,6 +2031,99 @@ qemuSnapshotRevertWriteMetadata(virDomainObj *vm, } =20 =20 +static int +qemuSnapshotRevertActive(virDomainObj *vm, + virDomainSnapshotPtr snapshot, + virDomainMomentObj *snap, + virDomainSnapshotDef *snapdef, + virQEMUDriver *driver, + virQEMUDriverConfig *cfg, + virDomainDef **config, + virDomainDef **inactiveConfig, + unsigned int start_flags, + unsigned int flags) +{ + virObjectEvent *event =3D NULL; + virObjectEvent *event2 =3D NULL; + int detail; + bool defined =3D false; + qemuDomainSaveCookie *cookie =3D (qemuDomainSaveCookie *) snapdef->coo= kie; + int rc; + + start_flags |=3D VIR_QEMU_PROCESS_START_PAUSED; + + /* Transitions 2, 3, 5, 6, 8, 9 */ + if (virDomainObjIsActive(vm)) { + /* Transitions 5, 6, 8, 9 */ + qemuProcessStop(driver, vm, + VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, + QEMU_ASYNC_JOB_START, 0); + virDomainAuditStop(vm, "from-snapshot"); + detail =3D VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT; + event =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_STOPPED, + detail); + virObjectEventStateQueue(driver->domainEventState, event); + } + + if (*inactiveConfig) { + virDomainObjAssignDef(vm, inactiveConfig, false, NULL); + defined =3D true; + } + + virDomainObjAssignDef(vm, config, true, NULL); + + /* No cookie means libvirt which saved the domain was too old to + * mess up the CPU definitions. + */ + if (cookie && + qemuDomainFixupCPUs(vm, &cookie->cpu) < 0) + return -1; + + rc =3D qemuProcessStart(snapshot->domain->conn, driver, vm, + cookie ? cookie->cpu : NULL, + QEMU_ASYNC_JOB_START, NULL, -1, NULL, snap, + VIR_NETDEV_VPORT_PROFILE_OP_CREATE, + start_flags); + virDomainAuditStart(vm, "from-snapshot", rc >=3D 0); + detail =3D VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; + event =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_STARTED, + detail); + virObjectEventStateQueue(driver->domainEventState, event); + if (rc < 0) + return -1; + + /* Touch up domain state. */ + if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING) && + (snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_PAUSED || + (flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED))) { + /* Transitions 3, 6, 9 */ + virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, + VIR_DOMAIN_PAUSED_FROM_SNAPSHOT); + detail =3D VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT; + event2 =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_SUSPENDED, + detail); + virObjectEventStateQueue(driver->domainEventState, event2); + } else { + /* Transitions 2, 5, 8 */ + if (!virDomainObjIsActive(vm)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit")); + return -1; + } + rc =3D qemuProcessStartCPUs(driver, vm, + VIR_DOMAIN_RUNNING_FROM_SNAPSHOT, + QEMU_ASYNC_JOB_START); + if (rc < 0) + return -1; + } + + return qemuSnapshotRevertWriteMetadata(vm, snap, driver, cfg, defined); +} + + /* The domain is expected to be locked and inactive. */ static int qemuSnapshotRevertInactive(virQEMUDriver *driver, @@ -2076,7 +2169,6 @@ qemuSnapshotRevert(virDomainObj *vm, g_autoptr(virDomainDef) config =3D NULL; g_autoptr(virDomainDef) inactiveConfig =3D NULL; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); - qemuDomainSaveCookie *cookie; unsigned int start_flags =3D VIR_QEMU_PROCESS_START_GEN_VMID; bool defined =3D false; =20 @@ -2120,81 +2212,14 @@ qemuSnapshotRevert(virDomainObj *vm, goto endjob; } =20 - cookie =3D (qemuDomainSaveCookie *) snapdef->cookie; - switch ((virDomainSnapshotState) snapdef->state) { case VIR_DOMAIN_SNAPSHOT_RUNNING: case VIR_DOMAIN_SNAPSHOT_PAUSED: - start_flags |=3D VIR_QEMU_PROCESS_START_PAUSED; - - /* Transitions 2, 3, 5, 6, 8, 9 */ - if (virDomainObjIsActive(vm)) { - /* Transitions 5, 6, 8, 9 */ - qemuProcessStop(driver, vm, - VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, - QEMU_ASYNC_JOB_START, 0); - virDomainAuditStop(vm, "from-snapshot"); - detail =3D VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT; - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_STO= PPED, - detail); - virObjectEventStateQueue(driver->domainEventState, event); - } - - if (inactiveConfig) { - virDomainObjAssignDef(vm, &inactiveConfig, false, NULL); - defined =3D true; - } - - virDomainObjAssignDef(vm, &config, true, NULL); - - /* No cookie means libvirt which saved the domain was too old to - * mess up the CPU definitions. - */ - if (cookie && - qemuDomainFixupCPUs(vm, &cookie->cpu) < 0) - goto endjob; - - rc =3D qemuProcessStart(snapshot->domain->conn, driver, vm, - cookie ? cookie->cpu : NULL, - QEMU_ASYNC_JOB_START, NULL, -1, NULL, snap, - VIR_NETDEV_VPORT_PROFILE_OP_CREATE, - start_flags); - virDomainAuditStart(vm, "from-snapshot", rc >=3D 0); - detail =3D VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_STARTED, - detail); - virObjectEventStateQueue(driver->domainEventState, event); - if (rc < 0) - goto endjob; - - /* Touch up domain state. */ - if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING) && - (snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_PAUSED || - (flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED))) { - /* Transitions 3, 6, 9 */ - virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, - VIR_DOMAIN_PAUSED_FROM_SNAPSHOT); - detail =3D VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT; - event2 =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_SUSPENDED, - detail); - virObjectEventStateQueue(driver->domainEventState, event2); - } else { - /* Transitions 2, 5, 8 */ - if (!virDomainObjIsActive(vm)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); - goto endjob; - } - rc =3D qemuProcessStartCPUs(driver, vm, - VIR_DOMAIN_RUNNING_FROM_SNAPSHOT, - QEMU_ASYNC_JOB_START); - if (rc < 0) - goto endjob; - } - break; + ret =3D qemuSnapshotRevertActive(vm, snapshot, snap, snapdef, + driver, cfg, + &config, &inactiveConfig, + start_flags, flags); + goto endjob; =20 case VIR_DOMAIN_SNAPSHOT_SHUTDOWN: case VIR_DOMAIN_SNAPSHOT_SHUTOFF: --=20 2.31.1 From nobody Fri May 3 10:35:07 2024 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=1638452436; cv=none; d=zohomail.com; s=zohoarc; b=bDnH6wgcgbBaojJHOSpOVBwMBd0E8qj5zC0zg1lMWdVcjILyXjqQ0CqOeV14fzg/nRNiYX0h1FygL/flFs3mUUBg22d8n5AHQk5SMzZUifQw/m1eifjwNsYTneDyjSuEv/nVzfE4seUdub9RTqIL9LKpvfPXcvk4TnFRLukpOsA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638452436; 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=gJw5XXZLfZN8uvfROBApd8C151ZyalQPgnZJZeVCly4=; b=H500Wm6IC26crqkEsukGP6C1kiBtRj8Jn3RlYpywwu1bcC2Bcj0URkFTVCw9Nvc8HfEPgZyjLsJiIMLhcoyT3gOHc1cxuftO1ad1PumUCXskj514MBl5EJf/hqNSrggPsVDu76j4p8Fj6Q9jp9pImzCATmo9BQ/QICk+Gz9N6ek= 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 1638452436170155.28215870209465; Thu, 2 Dec 2021 05:40:36 -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-562-ez0BYmSoOrSLSwoPwHxkSg-1; Thu, 02 Dec 2021 08:40:33 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DC48B5EE; Thu, 2 Dec 2021 13:40:28 +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 82DE5694C1; Thu, 2 Dec 2021 13:40:28 +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 570EE1809C89; Thu, 2 Dec 2021 13:40:28 +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 1B2DXY5M021105 for ; Thu, 2 Dec 2021 08:33:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8B7ED5E27A; Thu, 2 Dec 2021 13:33:34 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01C4F5D9CA for ; Thu, 2 Dec 2021 13:33:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638452435; 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=gJw5XXZLfZN8uvfROBApd8C151ZyalQPgnZJZeVCly4=; b=eFI1gdPo1j/1Qp+Igag7IooAUxfgWMHdDTLjxXru4DEJ6c/mZ6S4YW+5sWqLhwmSIne0Df VOtbgNAYIqnLd9FguGZdRkb9WU2qJOipmxh0Wu4vf/m8g5+iCbfOnIRHCeBwOek2Qk43ax Tsh2znqcaQq4CkvC3BBIiICkWICbsvA= X-MC-Unique: ez0BYmSoOrSLSwoPwHxkSg-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 13/14] qemu_snapshot: revert: rename qemuSnapshotRevertInactive Date: Thu, 2 Dec 2021 14:33:20 +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.13 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: 1638452436669100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_snapshot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 4f0e484ab5..6b300d808a 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2126,9 +2126,9 @@ qemuSnapshotRevertActive(virDomainObj *vm, =20 /* The domain is expected to be locked and inactive. */ static int -qemuSnapshotRevertInactive(virQEMUDriver *driver, - virDomainObj *vm, - virDomainMomentObj *snap) +qemuSnapshotInternalRevertInactive(virQEMUDriver *driver, + virDomainObj *vm, + virDomainMomentObj *snap) { size_t i; =20 @@ -2242,7 +2242,7 @@ qemuSnapshotRevert(virDomainObj *vm, virObjectEventStateQueue(driver->domainEventState, event); } =20 - if (qemuSnapshotRevertInactive(driver, vm, snap) < 0) { + if (qemuSnapshotInternalRevertInactive(driver, vm, snap) < 0) { qemuDomainRemoveInactive(driver, vm); goto endjob; } --=20 2.31.1 From nobody Fri May 3 10:35:07 2024 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=1638452290; cv=none; d=zohomail.com; s=zohoarc; b=bmjKrnY2JUKlQrYfPQbHhp8mLonsN+0Mynsllc3u1iO/WOUfVZS8dqd68c9y5YARNW5RwD9oXs8lfv1dft28NJ7k0hg9qStTwE9hBSMNiwwrlUqStDuYEdNdrNkDZBr0lzjZb3EClZ89+BGNLSFfjH8XjoEjJwPHE9kfVVSNnsQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638452290; 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=m0Q2UYHwqM3737hndu+rzWTA+o74Pa883Q0g4H/qTdk=; b=c0MnVjiFCbS1qYlKEx7VvghgRlo0zJUR3DqZfCFSDWABqgRvVpSTNbI+qxeMzx0FKsgCDJrUs/fDZP2MnyZAkO8I+1Qzq6afbCcI9/MU9+CFB+IzQibMz+HFPZMYYB0lSv2fh0fZevT0woO3skwsehXX0NXt2/MM07NqT4GYDPI= 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 16384522900521010.3157295392185; Thu, 2 Dec 2021 05:38:10 -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-142-8h4Z9JkpNByYB9m3lNVnNw-1; Thu, 02 Dec 2021 08:38:05 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B3E771005E4C; Thu, 2 Dec 2021 13:37:59 +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 932745FC22; Thu, 2 Dec 2021 13:37:59 +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 3DA454A7CB; Thu, 2 Dec 2021 13:37:59 +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 1B2DXZBY021117 for ; Thu, 2 Dec 2021 08:33:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 66B174EC37; Thu, 2 Dec 2021 13:33:35 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id D9D795DF21 for ; Thu, 2 Dec 2021 13:33:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638452289; 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=m0Q2UYHwqM3737hndu+rzWTA+o74Pa883Q0g4H/qTdk=; b=GpENpY5Usx1ibd/pbWSCVR9VqGxlIToV7x8vRg/nIDoGV+LisjfzKk37jp2pQMfLs+WES0 Hc3nvGtPoW0+oKS2fKaBYsnvk1TJzsNa84QbDrXRJST4e3pBjvdfXd03guoGmFzO/HhbiS 5V3ZOSGsVkOGxfXmlWfwuzJKstdMwgE= X-MC-Unique: 8h4Z9JkpNByYB9m3lNVnNw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 14/14] qemu_snapshot: revert: move inactive snapshot to separate function Date: Thu, 2 Dec 2021 14:33:21 +0100 Message-Id: <54e4880cfecdd4f5fe7c49e19543f5a87a44675e.1638451855.git.phrdina@redhat.com> 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.16 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: 1638452291497100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_snapshot.c | 148 ++++++++++++++++++++++----------------- 1 file changed, 83 insertions(+), 65 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 6b300d808a..1a32b15f51 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2153,6 +2153,84 @@ qemuSnapshotInternalRevertInactive(virQEMUDriver *dr= iver, } =20 =20 +static int +qemuSnapshotRevertInactive(virDomainObj *vm, + virDomainSnapshotPtr snapshot, + virDomainMomentObj *snap, + virQEMUDriver *driver, + virQEMUDriverConfig *cfg, + virDomainDef **inactiveConfig, + unsigned int start_flags, + unsigned int flags) +{ + virObjectEvent *event =3D NULL; + virObjectEvent *event2 =3D NULL; + int detail; + bool defined =3D false; + int rc; + + /* Transitions 1, 4, 7 */ + /* Newer qemu -loadvm refuses to revert to the state of a snapshot + * created by qemu-img snapshot -c. If the domain is running, we + * must take it offline; then do the revert using qemu-img. + */ + + if (virDomainObjIsActive(vm)) { + /* Transitions 4, 7 */ + qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, + QEMU_ASYNC_JOB_START, 0); + virDomainAuditStop(vm, "from-snapshot"); + detail =3D VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT; + event =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_STOPPED, + detail); + virObjectEventStateQueue(driver->domainEventState, event); + } + + if (qemuSnapshotInternalRevertInactive(driver, vm, snap) < 0) { + qemuDomainRemoveInactive(driver, vm); + return -1; + } + + if (*inactiveConfig) { + virDomainObjAssignDef(vm, inactiveConfig, false, NULL); + return -1; + } + + if (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING | + VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) { + /* Flush first event, now do transition 2 or 3 */ + bool paused =3D (flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED) !=3D 0; + + start_flags |=3D paused ? VIR_QEMU_PROCESS_START_PAUSED : 0; + + rc =3D qemuProcessStart(snapshot->domain->conn, driver, vm, NULL, + QEMU_ASYNC_JOB_START, NULL, -1, NULL, NULL, + VIR_NETDEV_VPORT_PROFILE_OP_CREATE, + start_flags); + virDomainAuditStart(vm, "from-snapshot", rc >=3D 0); + if (rc < 0) { + qemuDomainRemoveInactive(driver, vm); + return -1; + } + detail =3D VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; + event =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_STARTED, + detail); + virObjectEventStateQueue(driver->domainEventState, event); + if (paused) { + detail =3D VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT; + event2 =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_SUSPENDED, + detail); + virObjectEventStateQueue(driver->domainEventState, event2); + } + } + + return qemuSnapshotRevertWriteMetadata(vm, snap, driver, cfg, defined); +} + + int qemuSnapshotRevert(virDomainObj *vm, virDomainSnapshotPtr snapshot, @@ -2162,15 +2240,10 @@ qemuSnapshotRevert(virDomainObj *vm, int ret =3D -1; virDomainMomentObj *snap =3D NULL; virDomainSnapshotDef *snapdef; - virObjectEvent *event =3D NULL; - virObjectEvent *event2 =3D NULL; - int detail; - int rc; g_autoptr(virDomainDef) config =3D NULL; g_autoptr(virDomainDef) inactiveConfig =3D NULL; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); unsigned int start_flags =3D VIR_QEMU_PROCESS_START_GEN_VMID; - bool defined =3D false; =20 virCheckFlags(VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING | VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED | @@ -2224,64 +2297,11 @@ qemuSnapshotRevert(virDomainObj *vm, case VIR_DOMAIN_SNAPSHOT_SHUTDOWN: case VIR_DOMAIN_SNAPSHOT_SHUTOFF: case VIR_DOMAIN_SNAPSHOT_CRASHED: - /* Transitions 1, 4, 7 */ - /* Newer qemu -loadvm refuses to revert to the state of a snapshot - * created by qemu-img snapshot -c. If the domain is running, we - * must take it offline; then do the revert using qemu-img. - */ - - if (virDomainObjIsActive(vm)) { - /* Transitions 4, 7 */ - qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, - QEMU_ASYNC_JOB_START, 0); - virDomainAuditStop(vm, "from-snapshot"); - detail =3D VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT; - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_STOPPED, - detail); - virObjectEventStateQueue(driver->domainEventState, event); - } - - if (qemuSnapshotInternalRevertInactive(driver, vm, snap) < 0) { - qemuDomainRemoveInactive(driver, vm); - goto endjob; - } - - if (inactiveConfig) { - virDomainObjAssignDef(vm, &inactiveConfig, false, NULL); - defined =3D true; - } - - if (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING | - VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) { - /* Flush first event, now do transition 2 or 3 */ - bool paused =3D (flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED) != =3D 0; - - start_flags |=3D paused ? VIR_QEMU_PROCESS_START_PAUSED : 0; - - rc =3D qemuProcessStart(snapshot->domain->conn, driver, vm, NU= LL, - QEMU_ASYNC_JOB_START, NULL, -1, NULL, NU= LL, - VIR_NETDEV_VPORT_PROFILE_OP_CREATE, - start_flags); - virDomainAuditStart(vm, "from-snapshot", rc >=3D 0); - if (rc < 0) { - qemuDomainRemoveInactive(driver, vm); - goto endjob; - } - detail =3D VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_STARTED, - detail); - virObjectEventStateQueue(driver->domainEventState, event); - if (paused) { - detail =3D VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT; - event2 =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_SUSPEND= ED, - detail); - virObjectEventStateQueue(driver->domainEventState, event2); - } - } - break; + ret =3D qemuSnapshotRevertInactive(vm, snapshot, snap, + driver, cfg, + &inactiveConfig, + start_flags, flags); + goto endjob; =20 case VIR_DOMAIN_SNAPSHOT_PMSUSPENDED: virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", @@ -2301,8 +2321,6 @@ qemuSnapshotRevert(virDomainObj *vm, goto endjob; } =20 - ret =3D qemuSnapshotRevertWriteMetadata(vm, snap, driver, cfg, defined= ); - endjob: qemuProcessEndJob(driver, vm); =20 --=20 2.31.1