From nobody Sat Apr 27 03:55:17 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=1678722184; cv=none; d=zohomail.com; s=zohoarc; b=kqr9kU/KH1vrO+ULPIVCys1POO70EHsklcpDoolpZW2dCt4wvoUOYvSqBNk7zE/TMZpQzYHKv+emMb6NmDsyS7mfP+0mgL5lM+pA5NJJ7FL/kflCIY2hNKC8v7qHL4aKNUIjMY4oKqBq5UCA8e62eqbRl4YoLqubITcBpABwcrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722184; 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=bGIWawdeL4r9WEhmBM5QrKYXeJMTLREZSeyb2M0ZWMo=; b=LktX9L5Kgxzx+cbGrdThrcVhu1L3XNeVubbNaN0lzYBFZ04rtUGkePZBsyxroQwojWiW48gdUumtz+bzoNRGzqzwiVZ96yIk8sLUDxD/Fc2unORsqNwKcHlHm4dLx4mo3kgbFInV9ePwovlHLJTnA6E91b+edx08o76fM//OMXY= 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 1678722184921741.4100134749225; Mon, 13 Mar 2023 08:43:04 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-543-7ErTOktHNgKV2L72IJWDbw-1; Mon, 13 Mar 2023 11:42:35 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5CD3E803D48; Mon, 13 Mar 2023 15:42:30 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48FA52166B26; Mon, 13 Mar 2023 15:42:30 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0D01B1946A46; Mon, 13 Mar 2023 15:42:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 31CBA194658F for ; Mon, 13 Mar 2023 15:42:28 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 182512166B29; Mon, 13 Mar 2023 15:42:28 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF17A2166B26 for ; Mon, 13 Mar 2023 15:42:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722183; 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=bGIWawdeL4r9WEhmBM5QrKYXeJMTLREZSeyb2M0ZWMo=; b=drik/CJR7pgG5gPEoHhdzR8/gQkB4bXQUY2TvUUQwLS9cf6b+cORfuYL+l4hHU7avcktKP s2+K3Joj7pkO3r+C2ZAd7CuiJjGbTqz6ifksEDlQGSYuUoD++ngxInsKAK7oojeVy1plQ1 bU4jufIINaA9ZoQ5cjLa1+ODAkVhnvA= X-MC-Unique: 7ErTOktHNgKV2L72IJWDbw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 01/20] libvirt_private: list virDomainMomentDefPostParse Date: Mon, 13 Mar 2023 16:42:02 +0100 Message-Id: <46cb25426fd73f281394ee626698341eef4c1ce3.1678718987.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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: 1678722187077100001 Content-Type: text/plain; charset="utf-8"; x-default="true" We will need to call this function from qemu_snapshot when introducing external snapshot revert support. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/libvirt_private.syms | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 6f44788233..245f258df4 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -809,6 +809,10 @@ virInterfaceDefParseString; virInterfaceDefParseXML; =20 =20 +# conf/moment_conf.h +virDomainMomentDefPostParse; + + # conf/netdev_bandwidth_conf.h virDomainClearNetBandwidth; virNetDevBandwidthFormat; --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722171; cv=none; d=zohomail.com; s=zohoarc; b=I1CPHk3WtM2ugTIhVaKrN3ZLyLLL5j/D/Xpvr75K42BFGe34PRUwqCaK9waGnkRSS/XMpk8sJm/PoscDhLLitoeem+v9ZpmMuz5/82plZ0Plix2Qa4Ssb+1Ejjipf9q55Ei5uL08/7QOksd9jrvNXvtS/gVeBUGUQsfX8H7Gkv4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722171; 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=zinxEaWv+Pt3BWTWF67v8ig6Kg/HCn/xeH2EmpN2mAE=; b=kX80e8NXlVil55WTWvH7Tm9eUcsRPy2c3Qz0tkf98bjn+9QTiK3qw4m/8bYF+orbsf1HVIu5h3T3YZuqm05Ab/P+lk1TKgTFMum1pirVgFP3zfTw89k71HHC0dDW9Ou447Y9u9hh1zJ5m50NPLhxpMPeE6KY2Udy9EAiSRe6uHc= 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 1678722171853285.68859324000493; Mon, 13 Mar 2023 08:42:51 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-551-dS-TICcNOP6Gzqvej5WozA-1; Mon, 13 Mar 2023 11:42:47 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED08C2810C06; Mon, 13 Mar 2023 15:42:30 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D752F406AA67; Mon, 13 Mar 2023 15:42:30 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 448D71946A63; Mon, 13 Mar 2023 15:42:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CE5DA19465A3 for ; Mon, 13 Mar 2023 15:42:28 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B408E2166B2A; Mon, 13 Mar 2023 15:42:28 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51F302166B26 for ; Mon, 13 Mar 2023 15:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722170; 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=zinxEaWv+Pt3BWTWF67v8ig6Kg/HCn/xeH2EmpN2mAE=; b=aGm/etyYwPPZAl7KKAtHJ4xQjhmeqWF5gP8lGm1gzngk/wONQx2vp7CiMXwqZK8nxp+ghI k1yV3q26vsX4EeDP/mSslQ9B1vIqTlpRf/x6uaI6Msb9mSLDcKpp6iwUIwjoZ4BhD4zCWM cGmt6BKDBEZUK1B2L/YdOJEhL0HGrPg= X-MC-Unique: dS-TICcNOP6Gzqvej5WozA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 02/20] snapshot_conf: export virDomainSnapshotDiskDefClear Date: Mon, 13 Mar 2023 16:42:03 +0100 Message-Id: <1cc856f3d14f259714ec0a787b659150ae096037.1678718987.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1678722173128100001 Content-Type: text/plain; charset="utf-8"; x-default="true" We will need to call this function from qemu_snapshot when introducing external snapshot revert support. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/conf/snapshot_conf.c | 2 +- src/conf/snapshot_conf.h | 3 +++ src/libvirt_private.syms | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 9bf3c78353..1329292293 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -74,7 +74,7 @@ VIR_ENUM_IMPL(virDomainSnapshotState, ); =20 /* Snapshot Def functions */ -static void +void virDomainSnapshotDiskDefClear(virDomainSnapshotDiskDef *disk) { VIR_FREE(disk->name); diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h index 96c77ef42b..ad49990a1e 100644 --- a/src/conf/snapshot_conf.h +++ b/src/conf/snapshot_conf.h @@ -59,6 +59,9 @@ struct _virDomainSnapshotDiskDef { virStorageSource *src; }; =20 +void +virDomainSnapshotDiskDefClear(virDomainSnapshotDiskDef *disk); + void virDomainSnapshotDiskDefFree(virDomainSnapshotDiskDef *disk); =20 diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 245f258df4..dd752ba55c 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1039,6 +1039,7 @@ virDomainSnapshotDefFormat; virDomainSnapshotDefIsExternal; virDomainSnapshotDefNew; virDomainSnapshotDefParseString; +virDomainSnapshotDiskDefClear; virDomainSnapshotDiskDefFree; virDomainSnapshotDiskDefParseXML; virDomainSnapshotFormatConvertXMLFlags; --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722176; cv=none; d=zohomail.com; s=zohoarc; b=V3/a/fIi5OLJY+3q0VfDxlSVDhHYcUJfhmDZVDsxX1moB0x6eVuIwZd1iFk+xl9XgYPntV/yLxsWZ/9gjTKENzELSu/juWubKU7jNgWgUbiMwLCArs4578oHpOuiXD5NAbiGNSiwew5rFm6Avjgn0vsdlCfOsj57hHv3GSVDgQE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722176; 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=Zaag7pqnP0Gqk8Fw37MMe9Ey9cu17cy0AfX9XCdCc30=; b=K2mJr86CklPyKYAp15IxF1D99OJABjNlCdfGk1Vehag7sQrKcSHDQ0Do6FLD6ABl3VurXmSgYMgYnPmBzjGvMJF9vEXyn3qYOBMbUhaVvKUfgQy3RBxn5t9CxiIKUY3D52nIfAsiUGGtaqeggWTsUUfgLZgaVziJJLWNl2oYl+E= 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 167872217631221.037832339688862; Mon, 13 Mar 2023 08:42:56 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-458-Dl8IiDsHMdOoM0Lxteb2yw-1; Mon, 13 Mar 2023 11:42:50 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3DC9C2810C2D; Mon, 13 Mar 2023 15:42:31 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2978C40C6E69; Mon, 13 Mar 2023 15:42:31 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7DC6119465BA; Mon, 13 Mar 2023 15:42:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6301E194658F for ; Mon, 13 Mar 2023 15:42:29 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 563462166B2A; Mon, 13 Mar 2023 15:42:29 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE3982166B29 for ; Mon, 13 Mar 2023 15:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722175; 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=Zaag7pqnP0Gqk8Fw37MMe9Ey9cu17cy0AfX9XCdCc30=; b=fjPl/Ig9uuMJ2PEk6q4XUxdfvRnSoom2bsLGJXVE22uTADyNWoSe09k3tGlqqWF3zi8p5I 0tFMQvvU9uuDqYPC47TAUAO3Y8OnDPF0GzUbQzPP62JKg7W0Z6gPuPco36iZRT5kDc58PB sQoFvrEa1l5U6qTJi5GXaleHy40jbiQ= X-MC-Unique: Dl8IiDsHMdOoM0Lxteb2yw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 03/20] snapshot_conf: use alternate domain definition in virDomainSnapshotDefAssignExternalNames Date: Mon, 13 Mar 2023 16:42:04 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: 1678722176980100002 Content-Type: text/plain; charset="utf-8"; x-default="true" Commit introduced new argument for virDomainSnapshotAlignDisks() that allows passing alternate domain definition in case the snapshot parent.dom is NULL. In case of redefining snapshot it will not hit the part of code that unconditionally uses parent.dom as there will not be need to generate default external file names. It should be still fixed to make it safe. Future external snapshot revert code will use this to generate default file names and in this case it would crash. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/conf/snapshot_conf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 1329292293..da1c694cb9 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -489,12 +489,14 @@ virDomainSnapshotRedefineValidate(virDomainSnapshotDe= f *def, /** * virDomainSnapshotDefAssignExternalNames: * @def: snapshot def object + * @domdef: domain def object * * Generate default external file names for snapshot targets. Returns 0 on * success, -1 on error. */ static int -virDomainSnapshotDefAssignExternalNames(virDomainSnapshotDef *def) +virDomainSnapshotDefAssignExternalNames(virDomainSnapshotDef *def, + virDomainDef *domdef) { const char *origpath; char *tmppath; @@ -518,7 +520,7 @@ virDomainSnapshotDefAssignExternalNames(virDomainSnapsh= otDef *def) return -1; } =20 - if (!(origpath =3D virDomainDiskGetSource(def->parent.dom->disks[i= ]))) { + if (!(origpath =3D virDomainDiskGetSource(domdef->disks[i]))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("cannot generate external snapshot name " "for disk '%s' without source"), @@ -711,7 +713,7 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDef *snapd= ef, } =20 /* Generate default external file names for external snapshot location= s */ - if (virDomainSnapshotDefAssignExternalNames(snapdef) < 0) + if (virDomainSnapshotDefAssignExternalNames(snapdef, domdef) < 0) return -1; =20 return 0; --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722176; cv=none; d=zohomail.com; s=zohoarc; b=e37U+mNed5D8RzpXv02iO672PE/OUg9cD48qh5VfAyuWxEbSQP4tHxV47TDVwdAz/0VfBbcZelwd7yaTzfdy3WO/BUWbhdTGFBvzoTWCe7YLcorE1hR99QhVtdgZ4ey165S2q2T+YBfN942f1YeKibnozYTzs1aK32MUgWKPVas= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722176; 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=+eA+iDU12nN/LNNXUmt1YNT+LqgW3juv65ndD2HYQZ4=; b=HtuD/BBy/7Z8M3sh6C2O/D/7j8NGk9Sxl4gk9oDGGPrAY3RzWSOQuwWKeg27Pl8oQJKVu/XqlqYxvF0PjJ/Z5i6wzbbWGzVF9SnTRDW5814XB+jxdAM7DRmsCri8umJ4y9JjBkJJs19UEZjFsqBSFZ/TVx7CXXmDjwLrnfVprTU= 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 1678722176447300.93787848462296; Mon, 13 Mar 2023 08:42:56 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-214-clqrlypaOA-48nMYGdjx8w-1; Mon, 13 Mar 2023 11:42:43 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8D7723C0F1B4; Mon, 13 Mar 2023 15:42:32 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 751EC406AA66; Mon, 13 Mar 2023 15:42:32 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 374FD1946A4B; Mon, 13 Mar 2023 15:42:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 05F11194658F for ; Mon, 13 Mar 2023 15:42:30 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id EE21D2166B2A; Mon, 13 Mar 2023 15:42:29 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90C752166B29 for ; Mon, 13 Mar 2023 15:42:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722175; 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=+eA+iDU12nN/LNNXUmt1YNT+LqgW3juv65ndD2HYQZ4=; b=a+B/vTiyK8aNfwqElcFTOZLlXzJw7f8qtHQXesZqXoxqkZdYP1Btxfor00Rk22Ev6r929d u1Ji6GY7wD9hm61nnFyM/DwB3dd7S/KdRjkAzNsVmMS9eRfsyMa66W3ZzjDxVlsNBNAVA7 PbnRXsszz56yJS2tbMHgbdRGnFhCGwE= X-MC-Unique: clqrlypaOA-48nMYGdjx8w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 04/20] snapshot_conf: introduce metadata element Date: Mon, 13 Mar 2023 16:42:05 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1678722176980100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This new element will hold the new disk overlay created when reverting to non-leaf snapshot in order to remember the files libvirt created. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/conf/schemas/domainsnapshot.rng | 7 +++++++ src/conf/snapshot_conf.c | 27 +++++++++++++++++++++++++++ src/conf/snapshot_conf.h | 5 +++++ 3 files changed, 39 insertions(+) diff --git a/src/conf/schemas/domainsnapshot.rng b/src/conf/schemas/domains= napshot.rng index 45f01b96cd..2549c47b22 100644 --- a/src/conf/schemas/domainsnapshot.rng +++ b/src/conf/schemas/domainsnapshot.rng @@ -60,6 +60,13 @@ + + + + + + + diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index da1c694cb9..949104c1fd 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -376,6 +376,22 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, return NULL; } =20 + if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE) { + g_autofree xmlNodePtr *revertDiskNodes =3D NULL; + + if ((n =3D virXPathNodeSet("./revertDisks/*", ctxt, &revertDiskNod= es)) < 0) + return NULL; + if (n) + def->revertdisks =3D g_new0(virDomainSnapshotDiskDef, n); + def->nrevertdisks =3D n; + for (i =3D 0; i < def->nrevertdisks; i++) { + if (virDomainSnapshotDiskDefParseXML(revertDiskNodes[i], ctxt, + &def->revertdisks[i], + flags, xmlopt) < 0) + return NULL; + } + } + if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL) { int active; =20 @@ -843,6 +859,17 @@ virDomainSnapshotDefFormatInternal(virBuffer *buf, virBufferAddLit(buf, "\n"); } =20 + if (def->nrevertdisks) { + virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(buf, 2); + for (i =3D 0; i < def->nrevertdisks; i++) { + if (virDomainSnapshotDiskDefFormat(buf, &def->revertdisks[i], = xmlopt) < 0) + return -1; + } + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); + } + if (def->parent.dom) { if (virDomainDefFormatInternal(def->parent.dom, xmlopt, buf, domainflags) < 0) diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h index ad49990a1e..ab76af604a 100644 --- a/src/conf/snapshot_conf.h +++ b/src/conf/snapshot_conf.h @@ -80,6 +80,11 @@ struct _virDomainSnapshotDef { size_t ndisks; /* should not exceed dom->ndisks */ virDomainSnapshotDiskDef *disks; =20 + /* When we revert to non-leaf snapshot we need to + * store the new overlay disks. */ + size_t nrevertdisks; + virDomainSnapshotDiskDef *revertdisks; + virObject *cookie; }; =20 --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722189; cv=none; d=zohomail.com; s=zohoarc; b=I7yIHATqcI4dmQx5xr1izNv13rghomqdOInRawc02ryttjnlfTbwO3d0oe6LQH4is6/PMPS4q2OKOTpvPk+flyg+n9JHiSto16A+TyrEEi1y1z4UFzE8uOKXorSFkcs8wqzhIdamvRyDaEDwfGMRH3W9auSzuHeyNpfJznBvWXo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722189; 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=QJn1OpgC8SRzU3QTX78Wa2ujLZo4G38kj/VPxa7Jb5U=; b=f2nLPb1OrQDUewcLVhyONy4gGTFHuEXs2gGvmudqrx9lDSRJBm4Nv6sLmOCD+1bNwE8GpRvNcrOCMtflji6z0y1fDcCI1ADUg36QAFETsdmT0WMLLd/A7r9CWHfooBBrJzck2Dm8QdAcJwPAY7CavLtUDJbBgnXlqz3mFgJhYhA= 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 1678722189165843.1676000802032; Mon, 13 Mar 2023 08:43:09 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-649-CzZs78gGM-y2DOVhOZDKWg-1; Mon, 13 Mar 2023 11:43:04 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EED62803D62; Mon, 13 Mar 2023 15:42:31 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id DAD192A68; Mon, 13 Mar 2023 15:42:31 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B479E1946594; Mon, 13 Mar 2023 15:42:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id ABA311946A7A for ; Mon, 13 Mar 2023 15:42:30 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 918752166B2A; Mon, 13 Mar 2023 15:42:30 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33B002166B2E for ; Mon, 13 Mar 2023 15:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722188; 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=QJn1OpgC8SRzU3QTX78Wa2ujLZo4G38kj/VPxa7Jb5U=; b=KdN4LJxV8yPUv/1jsjD8SkOFDrolrvD0nmPvXQ1bzM0hl9SwPDhJ/YYQOu3ifH6bAnC7T2 ugsGdEsPd8BqzU4D+/YfsL4vKaL6BbUQg2QgfBSr1fHgOWUEK3UdOpFPVANR5dmu5pTc1C YQDfP1fWOE9LPQZRcOoQGtcJUG7j2qs= X-MC-Unique: CzZs78gGM-y2DOVhOZDKWg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 05/20] qemu_snapshot: introduce qemuSnapshotDomainDefUpdateDisk Date: Mon, 13 Mar 2023 16:42:06 +0100 Message-Id: <93d73dce3595f813c7a5f643532212be483e9513.1678718987.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1678722190988100002 Content-Type: text/plain; charset="utf-8"; x-default="true" Extract the code that updates disks in domain definition while creating external snapshots. We will use it later in the external snapshot revert code. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 63 ++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 7aa4195f04..924731fdf1 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -142,6 +142,42 @@ qemuSnapshotFSThaw(virDomainObj *vm, } =20 =20 +static int +qemuSnapshotDomainDefUpdateDisk(virDomainDef *domdef, + virDomainSnapshotDef *snapdef, + bool reuse) +{ + size_t i; + + for (i =3D 0; i < snapdef->ndisks; i++) { + g_autoptr(virStorageSource) newsrc =3D NULL; + virDomainSnapshotDiskDef *snapdisk =3D &(snapdef->disks[i]); + virDomainDiskDef *defdisk =3D domdef->disks[i]; + + if (snapdisk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) + continue; + + if (!(newsrc =3D virStorageSourceCopy(snapdisk->src, false))) + return -1; + + if (virStorageSourceInitChainElement(newsrc, defdisk->src, false) = < 0) + return -1; + + if (!reuse && + virStorageSourceHasBacking(defdisk->src)) { + defdisk->src->readonly =3D true; + newsrc->backingStore =3D g_steal_pointer(&defdisk->src); + } else { + virObjectUnref(defdisk->src); + } + + defdisk->src =3D g_steal_pointer(&newsrc); + } + + return 0; +} + + /* The domain is expected to be locked and inactive. */ static int qemuSnapshotCreateInactiveInternal(virQEMUDriver *driver, @@ -216,31 +252,8 @@ qemuSnapshotCreateInactiveExternal(virQEMUDriver *driv= er, } =20 /* update disk definitions */ - for (i =3D 0; i < snapdef->ndisks; i++) { - g_autoptr(virStorageSource) newsrc =3D NULL; - - snapdisk =3D &(snapdef->disks[i]); - defdisk =3D vm->def->disks[i]; - - if (snapdisk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) - continue; - - if (!(newsrc =3D virStorageSourceCopy(snapdisk->src, false))) - goto cleanup; - - if (virStorageSourceInitChainElement(newsrc, defdisk->src, false) = < 0) - goto cleanup; - - if (!reuse && - virStorageSourceHasBacking(defdisk->src)) { - defdisk->src->readonly =3D true; - newsrc->backingStore =3D g_steal_pointer(&defdisk->src); - } else { - virObjectUnref(defdisk->src); - } - - defdisk->src =3D g_steal_pointer(&newsrc); - } + if (qemuSnapshotDomainDefUpdateDisk(vm->def, snapdef, reuse) < 0) + goto cleanup; =20 if (virDomainDefSave(vm->def, driver->xmlopt, cfg->configDir) < 0) goto cleanup; --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722189; cv=none; d=zohomail.com; s=zohoarc; b=fqqpfE9O0pfzvhxNDohYtC8QIP5s6UUkxPyDJlEzfOoqTrnDFzEtBEnK3y3WLKP0Z2ZpTiU8MYNUO8UXNasGj4dYRcfw+fFgLtL/epfr+xN3sbU9FCsPW6C/a1+LmNiNp5OiIJPus3ATS4RFncQpFLLfQ0qF6c54n7dWkyxXSoM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722189; 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=ZKqApAfPd+LBQB8I3+jEq4BcP66MuB28DRjeuTutlOQ=; b=lgemVD4+/3NGOgLcq0bzaodq2xqRKYBCbTF1ctRautR02v3VZNBbbwHN3CRt6nj/gQ18WDu+NaA21+wkXXoVcVJEKRz6UGtMLcW17tEjoT2ED+j787rvFXAaSieefUABch9AoodimwXQzDXLA69b7yCghn65OpPqUXSSHm7D274= 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 1678722189764253.8761655526805; Mon, 13 Mar 2023 08:43:09 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-59-lG3O-50uOwCR5Vrc-oMOww-1; Mon, 13 Mar 2023 11:42:59 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 373F93810B23; Mon, 13 Mar 2023 15:42:32 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 244351410F1C; Mon, 13 Mar 2023 15:42:32 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id ECC8C1946A4B; Mon, 13 Mar 2023 15:42:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4E011194658F for ; Mon, 13 Mar 2023 15:42:31 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 33BA02166B2C; Mon, 13 Mar 2023 15:42:31 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA5482166B26 for ; Mon, 13 Mar 2023 15:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722188; 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=ZKqApAfPd+LBQB8I3+jEq4BcP66MuB28DRjeuTutlOQ=; b=XF28Ps+lS94u9EH4IA68nwOz9cd5a6/JGwXBmRe/YBJeAo4QHMDmGQ/5opx01DNfj6XT+F ejMnRpf5iuuI5ikptK9GwiD9SFKgobqonHsPSfqMD3XL7+DcW0zd5Buio/uSlgRABu9jm0 0i8JwpYOcHUqjKkVerx1aasYRpS286Q= X-MC-Unique: lG3O-50uOwCR5Vrc-oMOww-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 06/20] qemu_snapshot: use virDomainDiskByName while updating domain def Date: Mon, 13 Mar 2023 16:42:07 +0100 Message-Id: <59a9f4927a7da87d2c918f291f98844338a817fe.1678718987.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: 1678722190988100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When creating external snapshot this function is called only when the VM is not running so there is only one definition to care about. However, it will be used by external snapshot revert code for active and inactive definition and they may be different if a disk was (un)plugged only for the active or inactive definition. The current code would crash so use virDomainDiskByName() to get the correct disk from the domain definition based on the disk name and make sure it exists. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 924731fdf1..bbef753db6 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -152,11 +152,14 @@ qemuSnapshotDomainDefUpdateDisk(virDomainDef *domdef, for (i =3D 0; i < snapdef->ndisks; i++) { g_autoptr(virStorageSource) newsrc =3D NULL; virDomainSnapshotDiskDef *snapdisk =3D &(snapdef->disks[i]); - virDomainDiskDef *defdisk =3D domdef->disks[i]; + virDomainDiskDef *defdisk =3D virDomainDiskByName(domdef, snapdisk= ->name, false); =20 if (snapdisk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) continue; =20 + if (!defdisk) + continue; + if (!(newsrc =3D virStorageSourceCopy(snapdisk->src, false))) return -1; =20 --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722250; cv=none; d=zohomail.com; s=zohoarc; b=Rs03As7yCvYjHOhFMrROXMEciDgjslAobSuAny7Heq8Y4XXK8tNbQBa7R3JVlJtqUgexQHVHt5fnZ5SVv8/Zaxoq4/LpZWH9lZhnEFMCX1tsxhYxreXp6pNOjK6KrxsUfFHoyCPAvKjrDfTMFqYXuTdVaTTEcY2ryqNLzAjLyso= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722250; 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=/eXxx6G9qCc+cTrukkhYokwhRpbRDfW648MRm6+idY8=; b=XX7qUyN4y/Kp/FVyOIiraaizKAb0TSux21Hwnetw3fIByWxOKRZDc8KDWK/sxvGcsit3S/v2vwvIqw81oDehvpR3NX10V1/Aqpst3m0n5LpOi5n5oTBbkpWoVAC4zbZRQSfaNrCZSqD3FRyctIxtNxBM7i3YKqAFf1NoxIcoJNA= 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 1678722250365622.6534534315706; Mon, 13 Mar 2023 08:44:10 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-382-o2h1IDDxOBiuhJKWvPwroQ-1; Mon, 13 Mar 2023 11:42:57 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 983D01C09075; Mon, 13 Mar 2023 15:42:33 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8584B1410F1B; Mon, 13 Mar 2023 15:42:33 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 753AD1946594; Mon, 13 Mar 2023 15:42:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id F11631946A4D for ; Mon, 13 Mar 2023 15:42:31 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E44B42166B26; Mon, 13 Mar 2023 15:42:31 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 86FF52166B2C for ; Mon, 13 Mar 2023 15:42:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722248; 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=/eXxx6G9qCc+cTrukkhYokwhRpbRDfW648MRm6+idY8=; b=Bd+j/p7N4NwsPG8FZzhaLUcxlZP28g7EBdlaci2Vo/Yqmi3UocLk3lHCXRiLR66J478tWF anX+RjKnGNO4n9JG++2cZzy15H28YNd1qTIZ7HT8xH1jsT3E+whPrO/4vwMKTxgbQ9dYh1 b3E7tpQxmrhMZCulTYBv6G7ob3ooWu0= X-MC-Unique: o2h1IDDxOBiuhJKWvPwroQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 07/20] qemu_snapshot: introduce qemuSnapshotCreateQcow2Files Date: Mon, 13 Mar 2023 16:42:08 +0100 Message-Id: <4bd61088ecf8d8b0e7f2bfa6c23fc7a719c1d055.1678718987.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: 1678722251508100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Extract creation of qcow2 files for external snapshots to separate function as we will need it for external snapshot revert code. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 67 +++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index bbef753db6..06ed20c815 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -181,35 +181,21 @@ qemuSnapshotDomainDefUpdateDisk(virDomainDef *domdef, } =20 =20 -/* The domain is expected to be locked and inactive. */ static int -qemuSnapshotCreateInactiveInternal(virQEMUDriver *driver, - virDomainObj *vm, - virDomainMomentObj *snap) -{ - return qemuDomainSnapshotForEachQcow2(driver, vm->def, snap, "-c", fal= se); -} - - -/* The domain is expected to be locked and inactive. */ -static int -qemuSnapshotCreateInactiveExternal(virQEMUDriver *driver, - virDomainObj *vm, - virDomainMomentObj *snap, - bool reuse) +qemuSnapshotCreateQcow2Files(virDomainObj *vm, + virDomainSnapshotDef *snapdef, + virBitmap *created, + bool reuse) { size_t i; - virDomainSnapshotDiskDef *snapdisk; - virDomainDiskDef *defdisk; const char *qemuImgPath; - g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); - int ret =3D -1; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; - virDomainSnapshotDef *snapdef =3D virDomainSnapshotObjGetDef(snap); - g_autoptr(virBitmap) created =3D virBitmapNew(snapdef->ndisks); + virQEMUDriver *driver =3D ((qemuDomainObjPrivate *) vm->privateData)->= driver; + virDomainSnapshotDiskDef *snapdisk =3D NULL; + virDomainDiskDef *defdisk =3D NULL; =20 if (!(qemuImgPath =3D qemuFindQemuImgBinary(driver))) - goto cleanup; + return -1; =20 /* If reuse is true, then qemuSnapshotPrepare already * ensured that the new files exist, and it was up to the user to @@ -218,6 +204,7 @@ qemuSnapshotCreateInactiveExternal(virQEMUDriver *drive= r, g_autoptr(virCommand) cmd =3D NULL; snapdisk =3D &(snapdef->disks[i]); defdisk =3D vm->def->disks[i]; + if (snapdisk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) continue; =20 @@ -225,7 +212,7 @@ qemuSnapshotCreateInactiveExternal(virQEMUDriver *drive= r, snapdisk->src->format =3D VIR_STORAGE_FILE_QCOW2; =20 if (qemuDomainStorageSourceValidateDepth(defdisk->src, 1, defdisk-= >dst) < 0) - goto cleanup; + return -1; =20 /* creates cmd line args: qemu-img create -f qcow2 -o */ if (!(cmd =3D virCommandNewArgList(qemuImgPath, @@ -234,7 +221,7 @@ qemuSnapshotCreateInactiveExternal(virQEMUDriver *drive= r, virStorageFileFormatTypeToString(= snapdisk->src->format), "-o", NULL))) - goto cleanup; + return -1; =20 /* adds cmd line arg: backing_fmt=3Dformat,backing_file=3D/path/to= /backing/file */ virBufferAsprintf(&buf, "backing_fmt=3D%s,backing_file=3D", @@ -251,9 +238,39 @@ qemuSnapshotCreateInactiveExternal(virQEMUDriver *driv= er, ignore_value(virBitmapSetBit(created, i)); =20 if (virCommandRun(cmd, NULL) < 0) - goto cleanup; + return -1; } =20 + return 0; +} + + +/* The domain is expected to be locked and inactive. */ +static int +qemuSnapshotCreateInactiveInternal(virQEMUDriver *driver, + virDomainObj *vm, + virDomainMomentObj *snap) +{ + return qemuDomainSnapshotForEachQcow2(driver, vm->def, snap, "-c", fal= se); +} + + +/* The domain is expected to be locked and inactive. */ +static int +qemuSnapshotCreateInactiveExternal(virQEMUDriver *driver, + virDomainObj *vm, + virDomainMomentObj *snap, + bool reuse) +{ + virDomainSnapshotDiskDef *snapdisk; + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); + int ret =3D -1; + virDomainSnapshotDef *snapdef =3D virDomainSnapshotObjGetDef(snap); + g_autoptr(virBitmap) created =3D virBitmapNew(snapdef->ndisks); + + if (qemuSnapshotCreateQcow2Files(vm, snapdef, created, reuse) < 0) + goto cleanup; + /* update disk definitions */ if (qemuSnapshotDomainDefUpdateDisk(vm->def, snapdef, reuse) < 0) goto cleanup; --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722180; cv=none; d=zohomail.com; s=zohoarc; b=dvwIHGeG4f2fFwEylJs6qW3ospXtgUatdhUDY6xThcrW+F2lN4LnA9W01v3B9d8LtYEsrrTwdmKvhMhqY1Faw7gdZ4EEXpVYy/HD+sEoVKfjEa8uhu5HU230RvbZzec+h9xBKkItb44KLbJkxnSBavERN4dB2zBJpuHgYwrGSjM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722180; 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=zz6g4mQpzPIiI0o/DRggTCkh/pw3grRaiJpu2XNBxn0=; b=WZdku2dZcyJPhE8LQWugqjLPoZYjURwTL58ktryTlpqVh0vco9zUnORUrTZNTfhKRqxZxOQlJxsQSOe4AwXxFEpFzj8WRCdJ89EbqZpcf3zc6KF70ucM/MhK9kqYA7sRQgR2xEOO2fDZmc4cra/P/gxb57VZGSJL2/hEcdRRms0= 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 1678722180672395.7743392868807; Mon, 13 Mar 2023 08:43:00 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-548-B2nUKYRcNkqbaGQokLl9mA-1; Mon, 13 Mar 2023 11:42:53 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 68B9518E0935; Mon, 13 Mar 2023 15:42:37 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54299202701E; Mon, 13 Mar 2023 15:42:37 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4237219465B8; Mon, 13 Mar 2023 15:42:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AB75D1946594 for ; Mon, 13 Mar 2023 15:42:32 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8BD692166B2A; Mon, 13 Mar 2023 15:42:32 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2EB2C2166B26 for ; Mon, 13 Mar 2023 15:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722179; 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=zz6g4mQpzPIiI0o/DRggTCkh/pw3grRaiJpu2XNBxn0=; b=K/tsWaxMSeRzFD8LhDta+XpoiOpcWoqM1pTq6xxuynpyTcGaSIgHHDD+VIH5aDELr7hW7E TTWmoiO3yQIIWg7n1etqPEbeXNaO85DkP3rnGLkF7TlQn1iIp2t6D5sW+Jb+l5vaYjev2+ 6Hk1kkyZ/gJa6rHUGc/1IztRR2WMUqw= X-MC-Unique: B2nUKYRcNkqbaGQokLl9mA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 08/20] qemu_snapshot: allow using alternate domain definition when creating qcow2 files Date: Mon, 13 Mar 2023 16:42:09 +0100 Message-Id: <88b433fb7cbb4e21a637c3c1c7b76c0c5ef9722c.1678718987.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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: 1678722180924100007 Content-Type: text/plain; charset="utf-8"; x-default="true" To create new overlay files when external snapshot revert support is introduced we will be using different domain definition than what is currently used by the domain. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 06ed20c815..9e4b978b1b 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -183,6 +183,7 @@ qemuSnapshotDomainDefUpdateDisk(virDomainDef *domdef, =20 static int qemuSnapshotCreateQcow2Files(virDomainObj *vm, + virDomainDef *def, virDomainSnapshotDef *snapdef, virBitmap *created, bool reuse) @@ -194,6 +195,9 @@ qemuSnapshotCreateQcow2Files(virDomainObj *vm, virDomainSnapshotDiskDef *snapdisk =3D NULL; virDomainDiskDef *defdisk =3D NULL; =20 + if (!def) + def =3D vm->def; + if (!(qemuImgPath =3D qemuFindQemuImgBinary(driver))) return -1; =20 @@ -203,7 +207,7 @@ qemuSnapshotCreateQcow2Files(virDomainObj *vm, for (i =3D 0; i < snapdef->ndisks && !reuse; i++) { g_autoptr(virCommand) cmd =3D NULL; snapdisk =3D &(snapdef->disks[i]); - defdisk =3D vm->def->disks[i]; + defdisk =3D def->disks[i]; =20 if (snapdisk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) continue; @@ -268,7 +272,7 @@ qemuSnapshotCreateInactiveExternal(virQEMUDriver *drive= r, virDomainSnapshotDef *snapdef =3D virDomainSnapshotObjGetDef(snap); g_autoptr(virBitmap) created =3D virBitmapNew(snapdef->ndisks); =20 - if (qemuSnapshotCreateQcow2Files(vm, snapdef, created, reuse) < 0) + if (qemuSnapshotCreateQcow2Files(vm, NULL, snapdef, created, reuse) < = 0) goto cleanup; =20 /* update disk definitions */ --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722247; cv=none; d=zohomail.com; s=zohoarc; b=AWZMXZMcgxnNlNboPjv1H8YShsD+NPiDtQWX58ujb1sllw0/vFeGYLmMGMYvSnHtx9oNcC+FU6QWzz/U57g5g/IEvhlK29w4917A23O1TJExI9TVYX62Z7iXL1+fjRQgeuHhVgAcanZ3NdutcvhS0LZJbCeFiA820UIKosqTd0Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722247; 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=1iiJNhqI4+fV2YLYIfhOv2F6WMnDmJ8YAUt4IB1X9LM=; b=PN2g0oVyKnynQOnh9HVlrAxpIVdlWcgNJY72c/xNpIMQuBDyPwcbYi6DyVcqWBV88gC5b/dvUo8rxI+IQakPXMvZ0rg1rsPhwN7HNKmiG3jwlN6g/H9Qy0ASEkS1Y1Tgiw7LvJG9X+VVDJiUtTu95mdCXA00q7lfi2fm8JaLCQw= 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 1678722247397564.3253812066521; Mon, 13 Mar 2023 08:44:07 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-41-7I-KjDnzPxqoqSxq0ojAUA-1; Mon, 13 Mar 2023 11:43:02 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4B692280AA35; Mon, 13 Mar 2023 15:42:35 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35C803542A; Mon, 13 Mar 2023 15:42:35 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 00F3519465BA; Mon, 13 Mar 2023 15:42:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3EC5D194658F for ; Mon, 13 Mar 2023 15:42:33 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 330982166B26; Mon, 13 Mar 2023 15:42:33 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA7832166B2A for ; Mon, 13 Mar 2023 15:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722246; 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=1iiJNhqI4+fV2YLYIfhOv2F6WMnDmJ8YAUt4IB1X9LM=; b=Q7gDw0Wdyr4wFHsw2zWuiUyRw3KiT5wTOfYvIw7RRZ8qNIQeWChs5uGigGLi0wgWdqnQnq OqQ79zt6UlfJBomBSzTAjQP7EjcHRnTFBUSay07YXVt+bEqSV6B/j2ZkDzMhIuumKfQ2RT BwwsQJQKvYHOWUStE0V903PacR1VeJY= X-MC-Unique: 7I-KjDnzPxqoqSxq0ojAUA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 09/20] qemu_snapshot: introduce external snapshot revert support Date: Mon, 13 Mar 2023 16:42:10 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1678722249356100002 Content-Type: text/plain; charset="utf-8"; x-default="true" When reverting to external snapshot we need to create new overlay qcow2 files from the disk files the VM had when the snapshot was taken. There are some specifics and limitations when reverting to a snapshot: 1) When reverting to last snapshot we need to first create new overlay files before we can safely delete the old overlay files in case the creation fails so we have still recovery option when we error out. These new files will not have the suffix as when the snapshot was created as renaming the original files in order to use the same file names as when the snapshot was created would add unnecessary complexity to the code. 2) When reverting to any snapshot we will always create overlay files for every disk the VM had when the snapshot was done. Otherwise we would have to figure out if there is any other qcow2 image already using any of the VM disks as backing store and that itself might be extremely complex and in some cases impossible. 3) When reverting from any state the current overlay files will be always removed as that VM state is not meant to be saved. It's the same as with internal snapshots. If user want's to keep the current state before reverting they need to create a new snapshot. For now this will only work if the current snapshot is the last. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 143 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 139 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 9e4b978b1b..af4e2ea6aa 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -18,6 +18,8 @@ =20 #include =20 +#include + #include "qemu_snapshot.h" =20 #include "qemu_monitor.h" @@ -1968,6 +1970,119 @@ qemuSnapshotRevertWriteMetadata(virDomainObj *vm, } =20 =20 +static int +qemuSnapshotRevertExternal(virDomainObj *vm, + virDomainMomentObj *snap, + virDomainDef *config, + virDomainDef *inactiveConfig, + int *memsnapFD, + char **memsnapPath) +{ + size_t i; + virDomainDef *domdef =3D NULL; + virDomainSnapshotLocation location =3D VIR_DOMAIN_SNAPSHOT_LOCATION_EX= TERNAL; + virDomainMomentObj *curSnap =3D virDomainSnapshotGetCurrent(vm->snapsh= ots); + virDomainSnapshotDef *snapdef =3D virDomainSnapshotObjGetDef(snap); + virDomainSnapshotDef *curdef =3D virDomainSnapshotObjGetDef(curSnap); + g_autoptr(virDomainSnapshotDef) tmpsnapdef =3D NULL; + g_autoptr(virBitmap) created =3D NULL; + int ret =3D -1; + + if (config) { + domdef =3D config; + } else { + domdef =3D inactiveConfig; + } + + if (!(tmpsnapdef =3D virDomainSnapshotDefNew())) + return -1; + + if (virDomainMomentDefPostParse(&tmpsnapdef->parent) < 0) + return -1; + + if (virDomainSnapshotAlignDisks(tmpsnapdef, domdef, location, false) <= 0) + return -1; + + created =3D virBitmapNew(tmpsnapdef->ndisks); + + if (qemuSnapshotCreateQcow2Files(vm, domdef, tmpsnapdef, created, fals= e) < 0) + return -1; + + if (memsnapFD && memsnapPath && snapdef->memorysnapshotfile) { + virQEMUDriver *driver =3D ((qemuDomainObjPrivate *) vm->privateDat= a)->driver; + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driv= er); + + *memsnapPath =3D snapdef->memorysnapshotfile; + *memsnapFD =3D qemuDomainOpenFile(cfg, NULL, *memsnapPath, O_RDONL= Y, NULL); + } + + if (config) { + if (qemuSnapshotDomainDefUpdateDisk(config, tmpsnapdef, false) < 0) + goto cleanup; + } + + if (qemuSnapshotDomainDefUpdateDisk(inactiveConfig, tmpsnapdef, false)= < 0) + goto cleanup; + + if (curdef->revertdisks) { + for (i =3D 0; i < curdef->nrevertdisks; i++) { + virDomainSnapshotDiskDef *snapdisk =3D &(curdef->revertdisks[i= ]); + + if (unlink(snapdisk->src->path) < 0) { + VIR_WARN("Failed to remove snapshot image '%s'", + snapdisk->src->path); + } + + virDomainSnapshotDiskDefClear(snapdisk); + } + + g_clear_pointer(&curdef->revertdisks, g_free); + curdef->nrevertdisks =3D 0; + } else { + for (i =3D 0; i < curdef->ndisks; i++) { + virDomainSnapshotDiskDef *snapdisk =3D &(curdef->disks[i]); + + if (unlink(snapdisk->src->path) < 0) { + VIR_WARN("Failed to remove snapshot image '%s'", + snapdisk->src->path); + } + } + } + + if (snap->nchildren !=3D 0) { + snapdef->revertdisks =3D g_steal_pointer(&tmpsnapdef->disks); + snapdef->nrevertdisks =3D tmpsnapdef->ndisks; + tmpsnapdef->ndisks =3D 0; + } else { + for (i =3D 0; i < snapdef->ndisks; i++) { + virDomainSnapshotDiskDefClear(&snapdef->disks[i]); + } + g_free(snapdef->disks); + snapdef->disks =3D g_steal_pointer(&tmpsnapdef->disks); + snapdef->ndisks =3D tmpsnapdef->ndisks; + tmpsnapdef->ndisks =3D 0; + } + + ret =3D 0; + + cleanup: + if (ret !=3D 0 && created) { + ssize_t bit =3D -1; + + while ((bit =3D virBitmapNextSetBit(created, bit)) >=3D 0) { + virDomainSnapshotDiskDef *snapdisk =3D &(tmpsnapdef->disks[bit= ]); + + if (unlink(snapdisk->src->path) < 0) { + VIR_WARN("Failed to remove snapshot image '%s'", + snapdisk->src->path); + } + } + } + + return ret; +} + + static int qemuSnapshotRevertActive(virDomainObj *vm, virDomainSnapshotPtr snapshot, @@ -1982,6 +2097,9 @@ qemuSnapshotRevertActive(virDomainObj *vm, { virObjectEvent *event =3D NULL; virObjectEvent *event2 =3D NULL; + virDomainMomentObj *loadSnap =3D NULL; + VIR_AUTOCLOSE memsnapFD =3D -1; + char *memsnapPath =3D NULL; int detail; bool defined =3D false; qemuDomainSaveCookie *cookie =3D (qemuDomainSaveCookie *) snapdef->coo= kie; @@ -2003,6 +2121,15 @@ qemuSnapshotRevertActive(virDomainObj *vm, virObjectEventStateQueue(driver->domainEventState, event); } =20 + if (virDomainSnapshotIsExternal(snap)) { + if (qemuSnapshotRevertExternal(vm, snap, *config, *inactiveConfig, + &memsnapFD, &memsnapPath) < 0) { + return -1; + } + } else { + loadSnap =3D snap; + } + if (*inactiveConfig) { virDomainObjAssignDef(vm, inactiveConfig, false, NULL); defined =3D true; @@ -2019,7 +2146,8 @@ qemuSnapshotRevertActive(virDomainObj *vm, =20 rc =3D qemuProcessStart(snapshot->domain->conn, driver, vm, cookie ? cookie->cpu : NULL, - VIR_ASYNC_JOB_START, NULL, -1, NULL, snap, + VIR_ASYNC_JOB_START, NULL, memsnapFD, + memsnapPath, loadSnap, VIR_NETDEV_VPORT_PROFILE_OP_CREATE, start_flags); virDomainAuditStart(vm, "from-snapshot", rc >=3D 0); @@ -2124,9 +2252,16 @@ qemuSnapshotRevertInactive(virDomainObj *vm, virObjectEventStateQueue(driver->domainEventState, event); } =20 - if (qemuSnapshotInternalRevertInactive(driver, vm, snap) < 0) { - qemuDomainRemoveInactive(driver, vm, 0, false); - return -1; + if (virDomainSnapshotIsExternal(snap)) { + if (qemuSnapshotRevertExternal(vm, snap, NULL, *inactiveConfig, + NULL, NULL) < 0) { + return -1; + } + } else { + if (qemuSnapshotInternalRevertInactive(driver, vm, snap) < 0) { + qemuDomainRemoveInactive(driver, vm, 0, false); + return -1; + } } =20 if (*inactiveConfig) { --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722177; cv=none; d=zohomail.com; s=zohoarc; b=EkimbcATGVpPi9YSVvtFmF2xgGQNNxfMUAkYvtJwGz1k5zHfEFzyVM4TVcpmxIG3cXRP2UBysr8NzmqytdbMn8Hh7qLe+K8/YpNeIaIBiFWH1iaQEehqyPjjVGKGQyru/o91Leg66gCM0nUtfNjpg9AxbMPIgi9MyL8cIpK62sI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722177; 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=Rr+Biiy+qbc/YW/T4BBEacYqc4rgAAYYP0jIIClPSEA=; b=Rij+uO6ysZ1Etm/vQVfJZ0jV4mZqbDamFNeWfei0GqhohybFsJ9SKCLCpEnjFBmH+sVCSi9+miiIXng9/gu3GLdf1KynkGOvBK3cXfVRdB/koIho6wChfUpAui9DUV4nqVYZMBAAxb4w1bcWRHn43IgAqy5BClNljv2GR43HJrQ= 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 1678722177029706.8097462060641; Mon, 13 Mar 2023 08:42:57 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-151-zzSmB84HMqiZyvek-u0X5w-1; Mon, 13 Mar 2023 11:42:53 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 11FAE100F826; Mon, 13 Mar 2023 15:42:35 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2A4B400F4F; Mon, 13 Mar 2023 15:42:34 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CCB4819465A2; Mon, 13 Mar 2023 15:42:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2A81B1946594 for ; Mon, 13 Mar 2023 15:42:34 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1BAE52166B2F; Mon, 13 Mar 2023 15:42:34 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C7152166B26 for ; Mon, 13 Mar 2023 15:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722176; 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=Rr+Biiy+qbc/YW/T4BBEacYqc4rgAAYYP0jIIClPSEA=; b=bIh09onECKI4cKw4nZQgjKGuZpaqQx6hf0/XM6oRVK/FHd9CngI1NyPTxhUEV9fe0xkmoN wXKgIhoofHR9QNYIRGz8kvZu9eky8dxUKZDudK5/8Z5lOTngm1Hz2qGAnqyHxjS6vPULe+ md/lBi5ALT9xC03bNvT1NMPgAHjLCEg= X-MC-Unique: zzSmB84HMqiZyvek-u0X5w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 10/20] qemu_snapshot: rename qemuSnapshotDeleteExternalPrepare Date: Mon, 13 Mar 2023 16:42:11 +0100 Message-Id: <778175dce6b63663886198c48875fb8b9c443425.1678718987.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: 1678722178883100005 Content-Type: text/plain; charset="utf-8"; x-default="true" The new name reflects that we prepare data for external snapshot deletion and the old name will be used later for different part of code. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index af4e2ea6aa..64730dcb0b 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2474,9 +2474,9 @@ qemuSnapshotFindParentSnapForDisk(virDomainMomentObj = *snap, =20 =20 static int -qemuSnapshotDeleteExternalPrepare(virDomainObj *vm, - virDomainMomentObj *snap, - GSList **externalData) +qemuSnapshotDeleteExternalPrepareData(virDomainObj *vm, + virDomainMomentObj *snap, + GSList **externalData) { ssize_t i; virDomainSnapshotDef *snapdef =3D virDomainSnapshotObjGetDef(snap); @@ -3333,7 +3333,7 @@ qemuSnapshotDelete(virDomainObj *vm, g_autoslist(qemuSnapshotDeleteExternalData) tmpData =3D NULL; =20 /* this also serves as validation whether the snapshot can be = deleted */ - if (qemuSnapshotDeleteExternalPrepare(vm, snap, &tmpData) < 0) + if (qemuSnapshotDeleteExternalPrepareData(vm, snap, &tmpData) = < 0) goto endjob; =20 if (!virDomainObjIsActive(vm)) { @@ -3348,7 +3348,7 @@ qemuSnapshotDelete(virDomainObj *vm, =20 /* Call the prepare again as some data require that the VM= is * running to get everything we need. */ - if (qemuSnapshotDeleteExternalPrepare(vm, snap, &externalD= ata) < 0) + if (qemuSnapshotDeleteExternalPrepareData(vm, snap, &exter= nalData) < 0) goto endjob; } else { qemuDomainJobPrivate *jobPriv =3D vm->job->privateData; --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722182; cv=none; d=zohomail.com; s=zohoarc; b=GeIUjNvfSVakGtfwbl5CM4NdzYXVdeYqV0umZodIfYuhFWHfmrIiGEFHAaOVjpES1bkrx57Hd1qjj0NqNlH67KhaHDkstRUm+kheOS7KA82a9zFLFhLgPfGLcPj6gSWkY6PiMKn6boeG5VB1WmP6gTz2vbRgmVDjALGB/SfN5Kc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722182; 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=Up1r3zbOkNIpzB5K14v7zjFMirO1dobw/nqBYPK4UbE=; b=GFlbYPlwwNiGiV+luY26fjYMzYZKxe0lN8Sco8zhqPcbhnq6fRnsTryZmudQfTDfJu4K43b5kz/Qo8oPno4PDlTcgiERfs71MYwdvG5cPtqkBKyWuMFftwX715bgeq+HNabn6UQaP3yowssLcNLm/zLdBa7NSYtvNy8hYkNAHGg= 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 1678722182618698.5634688732572; Mon, 13 Mar 2023 08:43:02 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-299-JiOvGOIBMvKl9yxPvH22bw-1; Mon, 13 Mar 2023 11:42:58 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 384383C0F68A; Mon, 13 Mar 2023 15:42:36 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25A5B492C14; Mon, 13 Mar 2023 15:42:36 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 182BD1946594; Mon, 13 Mar 2023 15:42:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BEBBB194658F for ; Mon, 13 Mar 2023 15:42:34 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id AEC862166B29; Mon, 13 Mar 2023 15:42:34 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 537FA2166B26 for ; Mon, 13 Mar 2023 15:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722181; 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=Up1r3zbOkNIpzB5K14v7zjFMirO1dobw/nqBYPK4UbE=; b=Umai+KFnMczqx/iNrxh4x7slRNMRBhP29inKws+N5XLalqiWhA8bhJV5PeUruElFdBg3wt VRG+qGHRRG39/cZO16I6kf0RJoouXIAvp72o1Q+A+k2krqxFAzZahoJZv49HxheYs7PNtV eZ0RLnOWIqIE4aAVM1cF/FOQZn7q3WE= X-MC-Unique: JiOvGOIBMvKl9yxPvH22bw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 11/20] qemu_snapshot: extract external snapshot delete prepare to function Date: Mon, 13 Mar 2023 16:42:12 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: 1678722182987100009 Content-Type: text/plain; charset="utf-8"; x-default="true" This part of code is about to grow to make deletion work when use reverts to non-leaf snapshot. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 89 +++++++++++++++++++++++++--------------- 1 file changed, 55 insertions(+), 34 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 64730dcb0b..d545c984ce 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2557,6 +2557,58 @@ qemuSnapshotDeleteExternalPrepareData(virDomainObj *= vm, } =20 =20 +static int +qemuSnapshotDeleteExternalPrepare(virDomainObj *vm, + virDomainMomentObj *snap, + unsigned int flags, + GSList **externalData, + bool *stop_qemu) +{ + virQEMUDriver *driver =3D ((qemuDomainObjPrivate *) vm->privateData)->= driver; + g_autoslist(qemuSnapshotDeleteExternalData) tmpData =3D NULL; + + if (!virDomainSnapshotIsExternal(snap)) + return 0; + + if (flags & (VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN | + VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY)) { + return 0; + } + + /* this also serves as validation whether the snapshot can be deleted = */ + if (qemuSnapshotDeleteExternalPrepareData(vm, snap, &tmpData) < 0) + return -1; + + if (!virDomainObjIsActive(vm)) { + if (qemuProcessStart(NULL, driver, vm, NULL, VIR_ASYNC_JOB_SNAPSHO= T, + NULL, -1, NULL, NULL, + VIR_NETDEV_VPORT_PROFILE_OP_CREATE, + VIR_QEMU_PROCESS_START_PAUSED) < 0) { + return -1; + } + + *stop_qemu =3D true; + + /* Call the prepare again as some data require that the VM is + * running to get everything we need. */ + if (qemuSnapshotDeleteExternalPrepareData(vm, snap, externalData) = < 0) + return -1; + } else { + qemuDomainJobPrivate *jobPriv =3D vm->job->privateData; + + *externalData =3D g_steal_pointer(&tmpData); + + /* If the VM is running we need to indicate that the async snapshot + * job is snapshot delete job. */ + jobPriv->snapshotDelete =3D true; + + qemuDomainSaveStatus(vm); + } + + return 0; +} + + typedef struct _virQEMUMomentReparent virQEMUMomentReparent; struct _virQEMUMomentReparent { const char *dir; @@ -3327,40 +3379,9 @@ qemuSnapshotDelete(virDomainObj *vm, if (qemuSnapshotDeleteValidate(vm, snap, flags) < 0) goto endjob; =20 - if (virDomainSnapshotIsExternal(snap) && - !(flags & (VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN | - VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY))) { - g_autoslist(qemuSnapshotDeleteExternalData) tmpData =3D NULL; - - /* this also serves as validation whether the snapshot can be = deleted */ - if (qemuSnapshotDeleteExternalPrepareData(vm, snap, &tmpData) = < 0) - goto endjob; - - if (!virDomainObjIsActive(vm)) { - if (qemuProcessStart(NULL, driver, vm, NULL, VIR_ASYNC_JOB= _SNAPSHOT, - NULL, -1, NULL, NULL, - VIR_NETDEV_VPORT_PROFILE_OP_CREATE, - VIR_QEMU_PROCESS_START_PAUSED) < 0) { - goto endjob; - } - - stop_qemu =3D true; - - /* Call the prepare again as some data require that the VM= is - * running to get everything we need. */ - if (qemuSnapshotDeleteExternalPrepareData(vm, snap, &exter= nalData) < 0) - goto endjob; - } else { - qemuDomainJobPrivate *jobPriv =3D vm->job->privateData; - - externalData =3D g_steal_pointer(&tmpData); - - /* If the VM is running we need to indicate that the async= snapshot - * job is snapshot delete job. */ - jobPriv->snapshotDelete =3D true; - - qemuDomainSaveStatus(vm); - } + if (qemuSnapshotDeleteExternalPrepare(vm, snap, flags, + &externalData, &stop_qemu) <= 0) { + goto endjob; } } =20 --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722306; cv=none; d=zohomail.com; s=zohoarc; b=CMKL+0A4Du8WnZoeYqC3/o/5URMxfwSzxoeuc9bw5UlYEwYDN4rSdpUYgXcq/dReIPLoBvFb9xqHlQuh0nWqrfX/nuJBBu+pbUdEYPxgoRPyUF53WlQN2im/2RU5iaNM7segBQNQWLBEg8WOyS+0v3JY+UGiAKnjpV26lIfv0oc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722306; 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=5BMjAR/p2xEDWMvySDEWVOjT9RfNH+E5QKDqxCq5urg=; b=kD5grHrEZ07KFgZZ3XRK/zm8nyIOoxMjdvQ5Qd2MNxdr3Z3nNV70/qypDksSjfunCxHiXqwOHGtE3DqwsKyeGhZHTbXVqn7GvHn4y7OGep2G0tKpg3BJeQHZbOYRVEOerkUqXulMTguzdk2gcEmPuOPmSZkctJS4TVHyMp/tXTg= 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 1678722306054469.18549141448716; Mon, 13 Mar 2023 08:45:06 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-558-OIozGFkPPH2XQgEEidTmOA-1; Mon, 13 Mar 2023 11:43:01 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 75FD91C0A58D; Mon, 13 Mar 2023 15:42:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 627B4492C14; Mon, 13 Mar 2023 15:42:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5276A1946594; Mon, 13 Mar 2023 15:42:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5B1FC19465B1 for ; Mon, 13 Mar 2023 15:42:35 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5122C2166B2C; Mon, 13 Mar 2023 15:42:35 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id E95FC2166B26 for ; Mon, 13 Mar 2023 15:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722305; 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=5BMjAR/p2xEDWMvySDEWVOjT9RfNH+E5QKDqxCq5urg=; b=DP4yHtg9qh1q+TnRLN4QFKFJEXwJCZ25l2/PEoad0ppxsizB+MXyv6DJ5Q7CJoNpYPqEG+ llHvmx9VYBwUU9T4+3vuimab10FGPuIMGT7nrwWoi0eTGD9GbiQ9VNGCwS8QZJuxPrq2dn Vj6gaM60oaoFmqxmfPQudqKQ75e8BqI= X-MC-Unique: OIozGFkPPH2XQgEEidTmOA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 12/20] qemu_snapshot: add blockCommit to external snapshot delete prepare data Date: Mon, 13 Mar 2023 16:42:13 +0100 Message-Id: <375014d4f374bae751a783003042aacfb7999f8f.1678718987.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: 1678722307880100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Before external snapshot revert every delete operation did block commit in order to delete a snapshot. But now when user reverts to non-leaf snapshot deleting leaf snapshot will not have any overlay files so we can just simply delete the snapshot images. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 102 ++++++++++++++++++++++++--------------- 1 file changed, 62 insertions(+), 40 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index d545c984ce..6ff18d7a9e 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2476,6 +2476,7 @@ qemuSnapshotFindParentSnapForDisk(virDomainMomentObj = *snap, static int qemuSnapshotDeleteExternalPrepareData(virDomainObj *vm, virDomainMomentObj *snap, + bool blockCommit, GSList **externalData) { ssize_t i; @@ -2483,7 +2484,6 @@ qemuSnapshotDeleteExternalPrepareData(virDomainObj *v= m, g_autoslist(qemuSnapshotDeleteExternalData) ret =3D NULL; =20 for (i =3D 0; i < snapdef->ndisks; i++) { - g_autofree qemuSnapshotDeleteExternalData *data =3D NULL; virDomainSnapshotDiskDef *snapDisk =3D &(snapdef->disks[i]); =20 if (snapDisk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) @@ -2495,56 +2495,78 @@ qemuSnapshotDeleteExternalPrepareData(virDomainObj = *vm, snapDisk->name); return -1; } + } + + if (!blockCommit) { + if (!snap->parent) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("snapshot '%s' doesn't have a parent snapshot= "), + snapdef->parent.name); + return -1; + } + + snapdef =3D virDomainSnapshotObjGetDef(snap->parent); + } + + for (i =3D 0; i < snapdef->ndisks; i++) { + virDomainSnapshotDiskDef *snapDisk =3D &(snapdef->disks[i]); + g_autofree qemuSnapshotDeleteExternalData *data =3D NULL; + + if (snapDisk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) + continue; =20 data =3D g_new0(qemuSnapshotDeleteExternalData, 1); data->snapDisk =3D snapDisk; =20 - data->domDisk =3D qemuDomainDiskByName(vm->def, snapDisk->name); - if (!data->domDisk) - return -1; - - data->parentDomDisk =3D virDomainDiskByTarget(snapdef->parent.dom, - data->snapDisk->name); - if (!data->parentDomDisk) { - virReportError(VIR_ERR_OPERATION_FAILED, - _("failed to find disk '%s' in snapshot VM XML"= ), - snapDisk->name); - return -1; - } - - if (virDomainObjIsActive(vm)) { - data->diskSrc =3D virStorageSourceChainLookupBySource(data->do= mDisk->src, - data->snap= Disk->src, - &data->pre= vDiskSrc); - if (!data->diskSrc) + if (blockCommit) { + data->domDisk =3D qemuDomainDiskByName(vm->def, snapDisk->name= ); + if (!data->domDisk) return -1; =20 - if (!virStorageSourceIsSameLocation(data->diskSrc, data->snapD= isk->src)) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("VM disk source and snapshot disk source = are not the same")); + data->parentDomDisk =3D virDomainDiskByTarget(snapdef->parent.= dom, + data->snapDisk->na= me); + if (!data->parentDomDisk) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to find disk '%s' in snapshot VM = XML"), + snapDisk->name); return -1; } =20 - data->parentDiskSrc =3D data->diskSrc->backingStore; - if (!virStorageSourceIsBacking(data->parentDiskSrc)) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("failed to find parent disk source in bac= king chain")); - return -1; - } + if (virDomainObjIsActive(vm)) { + data->diskSrc =3D virStorageSourceChainLookupBySource(data= ->domDisk->src, + data->= snapDisk->src, + &data-= >prevDiskSrc); + if (!data->diskSrc) + return -1; =20 - if (!virStorageSourceIsSameLocation(data->parentDiskSrc, data-= >parentDomDisk->src)) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("snapshot VM disk source and parent disk = source are not the same")); - return -1; + if (!virStorageSourceIsSameLocation(data->diskSrc, data->s= napDisk->src)) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("VM disk source and snapshot disk sou= rce are not the same")); + return -1; + } + + data->parentDiskSrc =3D data->diskSrc->backingStore; + if (!virStorageSourceIsBacking(data->parentDiskSrc)) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("failed to find parent disk source in= backing chain")); + return -1; + } + + if (!virStorageSourceIsSameLocation(data->parentDiskSrc, + data->parentDomDisk->s= rc)) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("snapshot VM disk source and parent d= isk source are not the same")); + return -1; + } } - } =20 - data->parentSnap =3D qemuSnapshotFindParentSnapForDisk(snap, data-= >snapDisk); + data->parentSnap =3D qemuSnapshotFindParentSnapForDisk(snap, d= ata->snapDisk); =20 - if (data->parentSnap && !virDomainSnapshotIsExternal(data->parentS= nap)) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("deleting external snapshot that has internal= snapshot as parent not supported")); - return -1; + if (data->parentSnap && !virDomainSnapshotIsExternal(data->par= entSnap)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("deleting external snapshot that has inte= rnal snapshot as parent not supported")); + return -1; + } } =20 ret =3D g_slist_prepend(ret, g_steal_pointer(&data)); @@ -2576,7 +2598,7 @@ qemuSnapshotDeleteExternalPrepare(virDomainObj *vm, } =20 /* this also serves as validation whether the snapshot can be deleted = */ - if (qemuSnapshotDeleteExternalPrepareData(vm, snap, &tmpData) < 0) + if (qemuSnapshotDeleteExternalPrepareData(vm, snap, true, &tmpData) < = 0) return -1; =20 if (!virDomainObjIsActive(vm)) { @@ -2591,7 +2613,7 @@ qemuSnapshotDeleteExternalPrepare(virDomainObj *vm, =20 /* Call the prepare again as some data require that the VM is * running to get everything we need. */ - if (qemuSnapshotDeleteExternalPrepareData(vm, snap, externalData) = < 0) + if (qemuSnapshotDeleteExternalPrepareData(vm, snap, true, external= Data) < 0) return -1; } else { qemuDomainJobPrivate *jobPriv =3D vm->job->privateData; --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722185; cv=none; d=zohomail.com; s=zohoarc; b=m494c6wlURAJx2P21NIcUzZNs1BbIqXLI8b0G5Lx2+wauKLeWbCjQ31xcpoR6DrT/O1mydmbgRUoON7yGEFJL0z418HMW7zz120F2ae25E7YxD3ME4oJ/9kq8Qb/k7AnwnYKWqZWo0IoadUnCcpFvTtoKYDWALYmyO7wcILbMFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722185; 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=0QILdaFr7eqkuOLdNccsdxqiudZTKV8l6Rn3yOM+72E=; b=TszpFStu8sIIY5hxSGCaSh+MLA+uv+bpeByesELtqzeJqS/8fHkQq6egMvlJWPzE286DZME7t86Oab5ALqozjXcVJ6Qwm7PC/1B1pjshQGWeLQAvZwi6y1cvBz8VlB3vHJEkxqzpe2+40G5UixoM/8IvxSJznhbXdkBYHgKSYgI= 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 1678722185712243.24939591060797; Mon, 13 Mar 2023 08:43:05 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-447-TNf0wEZtNImAQxFMVusYcg-1; Mon, 13 Mar 2023 11:42:54 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E0CB73C10142; Mon, 13 Mar 2023 15:42:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4F1D1410F1B; Mon, 13 Mar 2023 15:42:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8E7141946A46; Mon, 13 Mar 2023 15:42:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 00B22194658F for ; Mon, 13 Mar 2023 15:42:36 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E8D102166B2B; Mon, 13 Mar 2023 15:42:35 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8BA8C2166B26 for ; Mon, 13 Mar 2023 15:42:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722184; 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=0QILdaFr7eqkuOLdNccsdxqiudZTKV8l6Rn3yOM+72E=; b=LBjkA6MSm+nqPHt4CxSWET/8GToMAL6t9bCS7mO0VLydsrLPMVCui/C+M93wsL4E9S0i+U fC4NV2t2wY5cbt5Vn1L9+6KfUwaV+3dskn98WYocsQIA+EInvLI+65uzl+zFtUViVkraUW dwzDfkL45XdOLn/hOQz3GT1NgxUYaDA= X-MC-Unique: TNf0wEZtNImAQxFMVusYcg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 13/20] qemu_snapshot: prepare data for non-active leaf external snapshot deletion Date: Mon, 13 Mar 2023 16:42:14 +0100 Message-Id: <39b49b8714ff9784c30e2b2132184088ebc0ffb3.1678718987.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: 1678722187090100002 Content-Type: text/plain; charset="utf-8"; x-default="true" In this case there is no need to run block commit and using qemu process at all. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 52 ++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 6ff18d7a9e..be2e5c8cc4 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2597,34 +2597,40 @@ qemuSnapshotDeleteExternalPrepare(virDomainObj *vm, return 0; } =20 - /* this also serves as validation whether the snapshot can be deleted = */ - if (qemuSnapshotDeleteExternalPrepareData(vm, snap, true, &tmpData) < = 0) - return -1; - - if (!virDomainObjIsActive(vm)) { - if (qemuProcessStart(NULL, driver, vm, NULL, VIR_ASYNC_JOB_SNAPSHO= T, - NULL, -1, NULL, NULL, - VIR_NETDEV_VPORT_PROFILE_OP_CREATE, - VIR_QEMU_PROCESS_START_PAUSED) < 0) { - return -1; - } - - *stop_qemu =3D true; - - /* Call the prepare again as some data require that the VM is - * running to get everything we need. */ - if (qemuSnapshotDeleteExternalPrepareData(vm, snap, true, external= Data) < 0) + if (snap !=3D virDomainSnapshotGetCurrent(vm->snapshots) && + snap->nchildren =3D=3D 0) { + if (qemuSnapshotDeleteExternalPrepareData(vm, snap, false, externa= lData) < 0) return -1; } else { - qemuDomainJobPrivate *jobPriv =3D vm->job->privateData; + /* this also serves as validation whether the snapshot can be dele= ted */ + if (qemuSnapshotDeleteExternalPrepareData(vm, snap, true, &tmpData= ) < 0) + return -1; =20 - *externalData =3D g_steal_pointer(&tmpData); + if (!virDomainObjIsActive(vm)) { + if (qemuProcessStart(NULL, driver, vm, NULL, VIR_ASYNC_JOB_SNA= PSHOT, + NULL, -1, NULL, NULL, + VIR_NETDEV_VPORT_PROFILE_OP_CREATE, + VIR_QEMU_PROCESS_START_PAUSED) < 0) { + return -1; + } =20 - /* If the VM is running we need to indicate that the async snapshot - * job is snapshot delete job. */ - jobPriv->snapshotDelete =3D true; + *stop_qemu =3D true; =20 - qemuDomainSaveStatus(vm); + /* Call the prepare again as some data require that the VM is + * running to get everything we need. */ + if (qemuSnapshotDeleteExternalPrepareData(vm, snap, true, exte= rnalData) < 0) + return -1; + } else { + qemuDomainJobPrivate *jobPriv =3D vm->job->privateData; + + *externalData =3D g_steal_pointer(&tmpData); + + /* If the VM is running we need to indicate that the async sna= pshot + * job is snapshot delete job. */ + jobPriv->snapshotDelete =3D true; + + qemuDomainSaveStatus(vm); + } } =20 return 0; --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722210; cv=none; d=zohomail.com; s=zohoarc; b=nkKMIMPDTmqRq33lLoWu8jP/bA06X+lSsMgFOd/GIZlVc13rEgUZYYhvebQ7yF9c5ccpmvb9YZWkqqkA2/7c4SvOjh7+4QsLxw1drZo/+1Tzd5kuP4r8OU4DPojjvnQEDbKiXVC5ZDqOZRHFBOGw2L0DSUfsRTfHHxKdAuwQkaM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722210; 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=R5Fw4wKu73fJrY8EJIDJOvus8kNUL/8AyvRYMDkJdOI=; b=L5mYDVgWjOU2+h3Ns815afzpABtNkk2MsghTLB2khG5XSUxmmtc9m6HnDey3zvy/VlEcQil0L2Yrnt0Sn1Vwe6H9l1FzDdgtZVNixW2tGjZqd1aHhuQ/HO4Pg2mxZ9AS/YsDiZ4BVVJjDWrbBAlNdr2q7P8/9YhU5ZEGkpEyaxM= 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 16787222106851013.2364021628593; Mon, 13 Mar 2023 08:43:30 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-270-oa1elAZGPSOis8jY8Cn_tg-1; Mon, 13 Mar 2023 11:43:01 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2740338123BB; Mon, 13 Mar 2023 15:42:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12428C164E7; Mon, 13 Mar 2023 15:42:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DED6119465B2; Mon, 13 Mar 2023 15:42:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A8E8B1946594 for ; Mon, 13 Mar 2023 15:42:36 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 890DC2166B30; Mon, 13 Mar 2023 15:42:36 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E4D92166B26 for ; Mon, 13 Mar 2023 15:42:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722209; 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=R5Fw4wKu73fJrY8EJIDJOvus8kNUL/8AyvRYMDkJdOI=; b=gcgiXCBZqNcd3IuZpipLxeONn3l599w0L1kaf+HwkiBnkdbOldojy0Ir6oYJZOMPMk86Sy 9dd1AMLLmLws75NDOyEmv1dUKyq6qPGqXgKzu5VBcjklZI7fQ/twwUQGUuwL3XwLXMa/Wg zWMXL4QjLzSQXHh25SCHNWxOC3ovDak= X-MC-Unique: oa1elAZGPSOis8jY8Cn_tg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 14/20] qemu_snapshot: add support to delete external snapshot without block commit Date: Mon, 13 Mar 2023 16:42:15 +0100 Message-Id: <698e4183d7d6a879615e9cceea6ff47f5fff7cbc.1678718987.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: 1678722211195100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When block commit is not needed we can just simply unlink the disk files. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 55 +++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index be2e5c8cc4..dbcdf56758 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2414,6 +2414,7 @@ typedef struct _qemuSnapshotDeleteExternalData { virStorageSource *prevDiskSrc; /* source of disk for which @diskSrc is backing disk */ qemuBlockJobData *job; + bool blockCommit; } qemuSnapshotDeleteExternalData; =20 =20 @@ -2517,8 +2518,9 @@ qemuSnapshotDeleteExternalPrepareData(virDomainObj *v= m, =20 data =3D g_new0(qemuSnapshotDeleteExternalData, 1); data->snapDisk =3D snapDisk; + data->blockCommit =3D blockCommit; =20 - if (blockCommit) { + if (data->blockCommit) { data->domDisk =3D qemuDomainDiskByName(vm->def, snapDisk->name= ); if (!data->domDisk) return -1; @@ -2949,31 +2951,41 @@ qemuSnapshotDiscardExternal(virDomainObj *vm, virTristateBool autofinalize =3D VIR_TRISTATE_BOOL_NO; unsigned int commitFlags =3D VIR_DOMAIN_BLOCK_COMMIT_DELETE; =20 - if (data->domDisk->src =3D=3D data->diskSrc) { - commitFlags |=3D VIR_DOMAIN_BLOCK_COMMIT_ACTIVE; - autofinalize =3D VIR_TRISTATE_BOOL_YES; + if (data->blockCommit) { + if (data->domDisk->src =3D=3D data->diskSrc) { + commitFlags |=3D VIR_DOMAIN_BLOCK_COMMIT_ACTIVE; + autofinalize =3D VIR_TRISTATE_BOOL_YES; + } + + if (qemuSnapshotSetInvalid(vm, data->parentSnap, data->snapDis= k, true) < 0) + goto error; + + data->job =3D qemuBlockCommit(vm, + data->domDisk, + data->parentDiskSrc, + data->diskSrc, + data->prevDiskSrc, + 0, + VIR_ASYNC_JOB_SNAPSHOT, + autofinalize, + commitFlags); + + if (!data->job) + goto error; + } else { + if (unlink(data->snapDisk->src->path) < 0) { + VIR_WARN("Failed to remove snapshot image '%s'", + data->snapDisk->name); + } } - - if (qemuSnapshotSetInvalid(vm, data->parentSnap, data->snapDisk, t= rue) < 0) - goto error; - - data->job =3D qemuBlockCommit(vm, - data->domDisk, - data->parentDiskSrc, - data->diskSrc, - data->prevDiskSrc, - 0, - VIR_ASYNC_JOB_SNAPSHOT, - autofinalize, - commitFlags); - - if (!data->job) - goto error; } =20 for (cur =3D externalData; cur; cur =3D g_slist_next(cur)) { qemuSnapshotDeleteExternalData *data =3D cur->data; =20 + if (!data->blockCommit) + continue; + if (qemuSnapshotDeleteBlockJobRunning(vm, data->job) < 0) goto error; =20 @@ -2988,6 +3000,9 @@ qemuSnapshotDiscardExternal(virDomainObj *vm, for (cur =3D externalData; cur; cur =3D g_slist_next(cur)) { qemuSnapshotDeleteExternalData *data =3D cur->data; =20 + if (!data->blockCommit) + continue; + if (data->job->state =3D=3D QEMU_BLOCKJOB_STATE_READY) { if (qemuBlockPivot(vm, data->job, VIR_ASYNC_JOB_SNAPSHOT, NULL= ) < 0) goto error; --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722247; cv=none; d=zohomail.com; s=zohoarc; b=arb1tDDJB5qtDa5lnOmByRYyehumfH9cfGGWK6zNPYHTwtuUbl7KV2bXH0xDumB2OIXgn4XyllTcGXjtjQgxJnKJFdI9qJ36a8wh0UG8b/E2jZrVvdWG+Bo3lhNUjNYeoxDlE1S8ERFemFegNFuWPXPkJSjC+ShpmYHGbqKmq28= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722247; 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=8yarTygas45LiAz275y0oJcNslBTojsV2ucDDuxz0ko=; b=gH7uBP+lG1VJLexTE7ysAy6TdOQcRhkVkjGb6os0fTau0dZX1GxIUX9/PlMELar6Dps96truM54b76uvgwru+8k+9qzKtnM4nqn/SX6tE/1aqwrU/wiolxFtEd0GuNSgLrePV9kQUnJf7jt73nbexyAbhHArDZIFOagEtciiP1s= 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 1678722247405496.74197303598635; Mon, 13 Mar 2023 08:44:07 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-591-oxezQJLpN2Olwrlhimc8_g-1; Mon, 13 Mar 2023 11:43:02 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EC83B823D69; Mon, 13 Mar 2023 15:42:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D10FE40C6E6E; Mon, 13 Mar 2023 15:42:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9DD091946A4D; Mon, 13 Mar 2023 15:42:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3960119465B1 for ; Mon, 13 Mar 2023 15:42:37 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2D9252166B29; Mon, 13 Mar 2023 15:42:37 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id C47692166B26 for ; Mon, 13 Mar 2023 15:42:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722246; 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=8yarTygas45LiAz275y0oJcNslBTojsV2ucDDuxz0ko=; b=dRSCNX8BFwDKp0J5AbTE3skMRqVj14M6eYz+MRJh0s70idLX0WU4VLoNc2cKT69aq9MnUM R7S8jVpdWdYq4A1bCnoqakO9T7Vozg5FLXRFg7nuaVELoAVpv12B6ybT6R1loHfPno6REm mhgXWq0RhUo3aaB6AvHvq8jt3kxo4EI= X-MC-Unique: oxezQJLpN2Olwrlhimc8_g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 15/20] qemu_snapshot: delete: properly update parent snapshot with revert data Date: Mon, 13 Mar 2023 16:42:16 +0100 Message-Id: <6d56124f9610043ef6338e18d1ef5470c5b42e56.1678718987.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: 1678722249336100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When deleting external snapshot and parent snapshot is the currently active snapshot as user reverted to it we need to properly update the parent snapshot metadata. After the delete is done the new overlay files will be the currently used files created when snapshot revert was done, replacing the original overlay files. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index dbcdf56758..513bcb5a86 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -3063,6 +3063,41 @@ qemuSnapshotDiscardExternal(virDomainObj *vm, } =20 =20 +static int +qemuSnapshotDeleteUpdateParent(virDomainObj *vm, + virDomainMomentObj *parent) +{ + size_t i; + virQEMUDriver *driver =3D ((qemuDomainObjPrivate *) vm->privateData)->= driver; + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); + virDomainSnapshotDef *parentDef =3D virDomainSnapshotObjGetDef(parent); + + if (!parentDef) + return 0; + + if (!parentDef->revertdisks) + return 0; + + for (i =3D 0; i < parentDef->ndisks; i++) { + virDomainSnapshotDiskDefClear(&parentDef->disks[i]); + } + g_free(parentDef->disks); + + parentDef->disks =3D g_steal_pointer(&parentDef->revertdisks); + parentDef->ndisks =3D parentDef->nrevertdisks; + parentDef->nrevertdisks =3D 0; + + if (qemuDomainSnapshotWriteMetadata(vm, + parent, + driver->xmlopt, + cfg->snapshotDir) < 0) { + return -1; + } + + return 0; +} + + static int qemuSnapshotDiscardMetadata(virDomainObj *vm, virDomainMomentObj *snap, @@ -3102,6 +3137,11 @@ qemuSnapshotDiscardMetadata(virDomainObj *vm, virDomainMomentMoveChildren(snap, snap->parent); } =20 + if (update_parent && snap->parent) { + if (qemuSnapshotDeleteUpdateParent(vm, snap->parent) < 0) + ret =3D -1; + } + snapFile =3D g_strdup_printf("%s/%s/%s.xml", cfg->snapshotDir, vm->def= ->name, snap->def->name); =20 --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722261; cv=none; d=zohomail.com; s=zohoarc; b=UvPVugQ6zjh4mYVH5y4Ntr7L4ntmj4ktEi2wEZZfI0Ztz91UQnKHIxG3Y5oz2j4eNyABJLBpDOsOu3id0kJMR7/ImEwZDx63ajSwIFVYATHVuR8fCzaC5OytH1X17xYVkMMmCj2RatJ5n3McMxsQHOB3xVH/py0NJSuojhVCbPM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722261; 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=+5RmfVNYfzfF+NyaGf8u5UCzVT51W7jGZnS0NsCtGsA=; b=H5nE3Ou3xl7pawjt9TpwxK5IBB3Li3F44Mgc4cWFy+Bzj8rykA5M3U/6vcFrF3ZDapYBZIyHHL64ktWeYKuKjU9E4rg1e5muBwzaju1o8QAI0pupX6k+Jy6vhaD2Rz5js6yfX5uV3TzqvYwQSe+7yV3PmNvm26bewjQbYHZuHIk= 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 167872226139237.378201100059755; Mon, 13 Mar 2023 08:44:21 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-481-J2orfDp3P6KI-IaiLoLrPQ-1; Mon, 13 Mar 2023 11:42:58 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9E87F18E0A8A; Mon, 13 Mar 2023 15:42:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87BA21410F1C; Mon, 13 Mar 2023 15:42:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2E0BF1946A6B; Mon, 13 Mar 2023 15:42:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D468A1946594 for ; Mon, 13 Mar 2023 15:42:37 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C59A72166B2A; Mon, 13 Mar 2023 15:42:37 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 679142166B29 for ; Mon, 13 Mar 2023 15:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722260; 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=+5RmfVNYfzfF+NyaGf8u5UCzVT51W7jGZnS0NsCtGsA=; b=AKD3XBx4drAaJx9wnWfTzMKVuYwi5JXrnFyC4sBz4wZa6uQGXZpETJcPipfY6WjNy1ZLSd 3H2YGVIReGLx3PJU7Qhqz6epoesZ54Nn+IeITc1IzjESLKqu7v4vBWGfHJF61/LH6S7+8A dH4RyPEMCGrb1YYl6n+fFvbGGp8w9ZQ= X-MC-Unique: J2orfDp3P6KI-IaiLoLrPQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 16/20] qemu_snapshot: don't allow creating external snapshot after reverting Date: Mon, 13 Mar 2023 16:42:17 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: 1678722263444100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This would allow creating new branch in the external snapshot history which we currently don't support. The issue with branching the external snapshot history is that deleting some snapshot would require calling block-stream instead of block-commit which is currently not implemented. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 513bcb5a86..95297cfe6a 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -665,6 +665,8 @@ qemuSnapshotPrepare(virDomainObj *vm, bool found_internal =3D false; bool forbid_internal =3D false; int external =3D 0; + virDomainMomentObj *curSnap =3D NULL; + virDomainSnapshotDef *curDef =3D NULL; =20 for (i =3D 0; i < def->ndisks; i++) { virDomainSnapshotDiskDef *disk =3D &def->disks[i]; @@ -801,6 +803,16 @@ qemuSnapshotPrepare(virDomainObj *vm, return -1; } =20 + curSnap =3D virDomainSnapshotGetCurrent(vm->snapshots); + if (curSnap) + curDef =3D virDomainSnapshotObjGetDef(curSnap); + + if (curDef && curDef->revertdisks) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("creating external snapshot after reverting to no= t last snapshot is not supported")); + return -1; + } + /* Alter flags to let later users know what we learned. */ if (external && !active) *flags |=3D VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY; --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722254; cv=none; d=zohomail.com; s=zohoarc; b=KtPpAn7Jv7Utwrcs0SKT4QwqT1hBMEaxHjGe9IARBxva38QMf+eGoNi60Yu1tTVN/1wBVvBDYgfmIYGKF01AJa6rP3QQL1Kup1/BtGaZmcW7qeSlMv7oFWoBJchRyOYbNeh3oFL0UQuKLL/zqPK3n7wCl3NYKwahvQFAK7XsiRM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722254; 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=CkOkrtcgZDw6+jzu3utN8ZZrFs/SgYEJT2UTXi/hsJU=; b=NUqIOcysuvpdk+F9sNMD1voYR2S8J4JBR85nY9BYyZismeTN7CPM+SbwNTEKdY982M2yoMTxcuR092ZtJNb4D/zfeR1Tb4suRkCG63emwVa9DpYhdvSnEHfcHFUlTHSIc9JNPhctaTzMIp85+s9MDYgXHIXCOy5EtonWOLOml/0= 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 1678722254819502.05822034548805; Mon, 13 Mar 2023 08:44:14 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-355-b7lv8mpSM1K03KfOesRkDQ-1; Mon, 13 Mar 2023 11:43:02 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 00B3818E0A68; Mon, 13 Mar 2023 15:42:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E029D140E96A; Mon, 13 Mar 2023 15:42:39 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CF8011946594; Mon, 13 Mar 2023 15:42:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 817EA19465B8 for ; Mon, 13 Mar 2023 15:42:38 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6820F2166B29; Mon, 13 Mar 2023 15:42:38 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0AD142166B26 for ; Mon, 13 Mar 2023 15:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722253; 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=CkOkrtcgZDw6+jzu3utN8ZZrFs/SgYEJT2UTXi/hsJU=; b=PZWpnYMI8aTkRtXLsuoKBMP4cnMGfFIBgTM0Ecs4hgc77RLTrTHCVpVEDGD4G2wfLxa1sz YRd6vi7M6vEUBngcAJ9ntlEpKWOxhjD5e9iBuPxvdveHh2Oqr+JlTcopNWIdwzuAKUZRge Z7OrTkcwu9vlfA7Z0GlGOcTZLHsEwD8= X-MC-Unique: b7lv8mpSM1K03KfOesRkDQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 17/20] virdomainmomentobjlist: introduce virDomainMomentIsAncestor Date: Mon, 13 Mar 2023 16:42:18 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: 1678722255435100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This new helper will allow us to check if we are able to delete external snapshot after user did revert to non-leaf snapshot. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/conf/virdomainmomentobjlist.c | 21 +++++++++++++++++++++ src/conf/virdomainmomentobjlist.h | 4 ++++ src/libvirt_private.syms | 1 + 3 files changed, 26 insertions(+) diff --git a/src/conf/virdomainmomentobjlist.c b/src/conf/virdomainmomentob= jlist.c index f19ec3319a..0c520fb173 100644 --- a/src/conf/virdomainmomentobjlist.c +++ b/src/conf/virdomainmomentobjlist.c @@ -582,3 +582,24 @@ virDomainMomentFindLeaf(virDomainMomentObjList *list) return moment; return NULL; } + + +bool +virDomainMomentIsAncestor(virDomainMomentObj *moment, + virDomainMomentObj *ancestor) +{ + if (!moment) + return false; + + if (moment =3D=3D ancestor) + return false; + + do { + moment =3D moment->parent; + + if (moment =3D=3D ancestor) + return true; + } while (moment); + + return false; +} diff --git a/src/conf/virdomainmomentobjlist.h b/src/conf/virdomainmomentob= jlist.h index d2ab3b46b1..2ea6b181c0 100644 --- a/src/conf/virdomainmomentobjlist.h +++ b/src/conf/virdomainmomentobjlist.h @@ -157,3 +157,7 @@ virDomainMomentCheckCycles(virDomainMomentObjList *list, =20 virDomainMomentObj * virDomainMomentFindLeaf(virDomainMomentObjList *list); + +bool +virDomainMomentIsAncestor(virDomainMomentObj *moment, + virDomainMomentObj *ancestor); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index dd752ba55c..8a724ef241 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1222,6 +1222,7 @@ virDomainMomentDropChildren; virDomainMomentDropParent; virDomainMomentForEachChild; virDomainMomentForEachDescendant; +virDomainMomentIsAncestor; virDomainMomentMoveChildren; virDomainMomentObjFree; virDomainMomentObjNew; --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722255; cv=none; d=zohomail.com; s=zohoarc; b=cE2OcPRBPw0VfAdxedtCv4kEVgQDsZDDGRl+uBz9NJ/kjEetoUboF+7hs91SfhApHZU3NeABHc22vE7Cr6ODDf4vj33jSneheywqRw3CUbdlW1is5VYZ4+GVq0/KSp/4KdjGO2Ouaeld3LMhx1w9QW5OGSgh9sw/PJOYh+At5ms= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722255; 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=J2EphdGoA74wlgP9MixMPbNq5qRN2hFnO5foTffZbu8=; b=cEZ7eaoj6w0XXwHLeU9MWS4f6bCUbsN/kbpHdcRfe04jCoKmOIlC10lJLmECkBUv48w1xNp9M+Yz+3lmj8LSwPjUlfGMt2XbYR7aZki0ZuMNC/NdljyuZ6i/vxkbApPA7BkQRGuh644jjleLMPqCXy4v07NYU+wXAIaOJ/w9cnA= 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 1678722255455730.5527433849251; Mon, 13 Mar 2023 08:44:15 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-583-3kieMTKpOUy9pFxvG_-e5A-1; Mon, 13 Mar 2023 11:43:04 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9B6622808E68; Mon, 13 Mar 2023 15:42:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 705CF2166B34; Mon, 13 Mar 2023 15:42:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1E76619465A3; Mon, 13 Mar 2023 15:42:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 194D91946594 for ; Mon, 13 Mar 2023 15:42:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0E5502166B29; Mon, 13 Mar 2023 15:42:39 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id A285F2166B26 for ; Mon, 13 Mar 2023 15:42:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722254; 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=J2EphdGoA74wlgP9MixMPbNq5qRN2hFnO5foTffZbu8=; b=b0K/ViQ7gDZLnlrOIeNn8b3yAN8qJUgkcNnK+t4lmz/aERG3KrTZJFdTP2+lyTOq8dwYmY Lfr3CGCfyeVnRot0980nR2GJnSi7N3yts8DZg6icxeBjPvGjP+ccpFGB0B4cZeZRCKt8mU URSa/MyKb2l9jrOeDmGrujDwkg2j0aw= X-MC-Unique: 3kieMTKpOUy9pFxvG_-e5A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 18/20] qemu_snapshot: check only once if snapshot is external Date: Mon, 13 Mar 2023 16:42:19 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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: 1678722257460100003 Content-Type: text/plain; charset="utf-8"; x-default="true" There will be more external snapshot checks introduced by following patch so group them together. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 95297cfe6a..05386b11fe 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -3426,18 +3426,18 @@ qemuSnapshotDeleteValidate(virDomainObj *vm, } } =20 - if (virDomainSnapshotIsExternal(snap) && - qemuDomainHasBlockjob(vm, false)) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("cannot delete external snapshots when there is a= nother active block job")); - return -1; - } + if (virDomainSnapshotIsExternal(snap)) { + if (qemuDomainHasBlockjob(vm, false)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("cannot delete external snapshots when there = is another active block job")); + return -1; + } =20 - if (virDomainSnapshotIsExternal(snap) && - (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("deletion of external disk snapshots with childre= n not supported")); - return -1; + if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("deletion of external disk snapshots with chi= ldren not supported")); + return -1; + } } =20 return 0; --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722255; cv=none; d=zohomail.com; s=zohoarc; b=YBV6pMAnHc37egxbOkvZqMIKDXLGhI0H9B3kSL0BnCd8Z09MfRrw/uuCaZF/AyZChZHBap7NAi1fTOFVKIumpEanzZdOgRcLR7X7D9pt5FC/2eREB0TpoFxyy9DWWHnN4ikRpitGhRyYjhhpSc2ZU9A9gFDJTG6Bwt5CGwr4ut4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722255; 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=gr+H8Gu/ti/ETCuzkYCzNgmQyKt6HNALlubnIe7AoAc=; b=fAMd/vidCRBzZ6KFVRQlFIiu6ZvXnndbKJ46YbdghES6qDqQg1depBIJyhmjytcx3LQSPYHEn5ahKVyyJ+oCNWO9zEXQv/mesrq2DxcM44Z6FatFyNZjHmiGj+6Dl4to6PH6TrrqOLREPAUhlCd0CsGVml+IVozcOsbXPvW5q94= 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 167872225556748.50125270447063; Mon, 13 Mar 2023 08:44:15 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-522-kw85ZQBdO9aSb-vFuEMFgA-1; Mon, 13 Mar 2023 11:43:02 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B030780A1CB; Mon, 13 Mar 2023 15:42:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CA8F492C14; Mon, 13 Mar 2023 15:42:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8E79D1946594; Mon, 13 Mar 2023 15:42:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CFE8A19465A2 for ; Mon, 13 Mar 2023 15:42:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A62532166B26; Mon, 13 Mar 2023 15:42:39 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48D322166B2A for ; Mon, 13 Mar 2023 15:42:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722254; 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=gr+H8Gu/ti/ETCuzkYCzNgmQyKt6HNALlubnIe7AoAc=; b=QVv2I0G2TEKv1H4RJ8533VQ2Oqty7vXex4sZ3V4G9iLipTxw4qZ5HTHgPXmYvncN0jylly nORFobaLMIGBMYAPs1g8KqxOoIJFaKjMbqx5pzgDUla8HG0GWPpYWPP4jF1PUHkLjY1/Hb oI5pQ/fHyN/i/Cgld0Z5xRFsKAAJ3z8= X-MC-Unique: kw85ZQBdO9aSb-vFuEMFgA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 19/20] qemu_snapshot: add checks for external snapshot deletion Date: Mon, 13 Mar 2023 16:42:20 +0100 Message-Id: <9ef8f2c2ca057ed1bccb12e6f655c1f888f0d805.1678718987.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: 1678722257470100004 Content-Type: text/plain; charset="utf-8"; x-default="true" With the introduction of external snapshot revert support we need to error out in some cases when trying to delete some snapshots. If users reverts to non-leaf snapshots and would try to delete it after the revert is done it would not work currently as this operation would require using block-stream which is not implemented for now as in this case the snapshot has two children so the disk files have multiple overlays. Similarly if user reverts to non-leaf snapshot and would try to delete snapshot that is non-leaf but not in currently active snapshot chain we would still need to use block-commit operation. The issue here is that in order to do that we would have to start new qemu process with different domain definition than what is currently used by the domain. If the current domain would be running it would complicate things even more so this operation is not yet supported. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 05386b11fe..c6c7b077dd 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -3427,6 +3427,8 @@ qemuSnapshotDeleteValidate(virDomainObj *vm, } =20 if (virDomainSnapshotIsExternal(snap)) { + virDomainMomentObj *current =3D virDomainSnapshotGetCurrent(vm->sn= apshots); + if (qemuDomainHasBlockjob(vm, false)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("cannot delete external snapshots when there = is another active block job")); @@ -3438,6 +3440,19 @@ qemuSnapshotDeleteValidate(virDomainObj *vm, _("deletion of external disk snapshots with chi= ldren not supported")); return -1; } + + if (snap =3D=3D current && snap->nchildren !=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("deletion of active external snapshot that is= not a leaf snapshot is not supported")); + return -1; + } + + if (snap !=3D current && snap->nchildren !=3D 0 && + virDomainMomentIsAncestor(snap, current)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("deletion of non-leaf external snapshot that = is not in active chain is not supported ")); + return -1; + } } =20 return 0; --=20 2.39.2 From nobody Sat Apr 27 03:55:17 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=1678722199; cv=none; d=zohomail.com; s=zohoarc; b=nnJv6G6CmudYMggN3eDWw5lY3KO8lrXCOkhVUVi6u4xV0JV/wuYPTWY+HyKNVIvIF7TRuNBF4lQWqt+A/QLXuBYKOF6WgUJQyJ3JPmdhOLMYH8rKY5Zb5l1ZobAuA4HL/E9lfxiyuAZbl5xtuR0VENjlWJxA5S+pMs0tMDXxwRM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678722199; 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=23O3p8Y28wdlFKqlTK9WdVpJ9WVtc96sidAHuDt/yfM=; b=AijKeEaO25BgdTt267QysY4J4Vf0dOwtVjCY+/gtB4EQTNx8DceB2eVzYEJe+cy6735PhJNbO2JNBZsbEJJr52xgeWYQrbNFTsl/QYlTH7CnTezKCzMJ5XLJzk+e6Hbt8jOCmQOS02Gqjq0M8d8U+Ya2LweTJTZCJl2r9f3jcSU= 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 1678722199652343.5238112769489; Mon, 13 Mar 2023 08:43:19 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-6-hjoiz8qpMAaLiSsJ2en4lA-1; Mon, 13 Mar 2023 11:43:02 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 962C7803503; Mon, 13 Mar 2023 15:42:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 837D740C6E67; Mon, 13 Mar 2023 15:42:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 668271946594; Mon, 13 Mar 2023 15:42:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 90C5519465A2 for ; Mon, 13 Mar 2023 15:42:40 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6E73C2166B31; Mon, 13 Mar 2023 15:42:40 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF7CE2166B26 for ; Mon, 13 Mar 2023 15:42:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678722198; 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=23O3p8Y28wdlFKqlTK9WdVpJ9WVtc96sidAHuDt/yfM=; b=EggbVNZn9Wz+v6Xpl+ec32Fsw4uleSXwurwXGgXBn7kyiveLLKiV5W8+wYz6Q2HmC0PiRd hoUeN8cCOEl6EUiimXedcHmsPAFt6cOSk65SsrQTnvd7nziqTfAIS5O4R1RvPIJtsc4QMh fn+IRGZrTsGHy1UgzdURhD7kme8iWoM= X-MC-Unique: hjoiz8qpMAaLiSsJ2en4lA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 20/20] qemu_snapshot: allow snapshot revert for external snapshots Date: Mon, 13 Mar 2023 16:42:21 +0100 Message-Id: <5812dad2df46a85a7712bfa1b43e861f0d6493f9.1678718987.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: 1678722201065100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Now that the support to revert external snapshots is implemented we can drop this check. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index c6c7b077dd..ec5b2e68d6 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1864,12 +1864,6 @@ qemuSnapshotRevertValidate(virDomainObj *vm, return -1; } =20 - 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"), --=20 2.39.2