From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id B528E1FF15E for ; Mon, 29 Sep 2025 13:26:07 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1E75BFFB6; Mon, 29 Sep 2025 13:26:11 +0200 (CEST) References: <20250609073214.7880-1-denis.kanchev@storpool.com> <20250609073214.7880-5-denis.kanchev@storpool.com> In-Reply-To: <20250609073214.7880-5-denis.kanchev@storpool.com> Date: Mon, 29 Sep 2025 14:24:53 +0300 To: pve-devel@lists.proxmox.com MIME-Version: 1.0 Message-ID: List-Id: Proxmox VE development discussion List-Post: From: Denis Kanchev via pve-devel Precedence: list Cc: Denis Kanchev X-Mailman-Version: 2.1.29 X-BeenThere: pve-devel@lists.proxmox.com List-Subscribe: , List-Unsubscribe: , List-Archive: Reply-To: Proxmox VE development discussion List-Help: Subject: Re: [pve-devel] [PATCH atomic snapshot 4/4] plugin: add optional atomic snapshot creation Content-Type: multipart/mixed; boundary="===============6905795371735103584==" Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" --===============6905795371735103584== Content-Type: message/rfc822 Content-Disposition: inline Return-Path: X-Original-To: pve-devel@lists.proxmox.com Delivered-To: pve-devel@lists.proxmox.com Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id A9F75D708A for ; Mon, 29 Sep 2025 13:26:08 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8716DFF8B for ; Mon, 29 Sep 2025 13:25:38 +0200 (CEST) Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 29 Sep 2025 13:25:36 +0200 (CEST) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-62fc14af3fbso6312056a12.3 for ; Mon, 29 Sep 2025 04:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=storpool.com; s=google; t=1759145130; x=1759749930; darn=lists.proxmox.com; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=CpzgaP1uyKZ5R9Fi0rh+33FqZnbwzzKi+MdcZi4ZBZU=; b=GUZkkiG+9eipGSXaEWZcv2R/6MBz/E+LfHReE9plI7Vvv+cNWhnZQ6HkjwrDzi0Lm2 EQCsejDKZUlgFMTY4pUscYLoD/70dKLez6skzzzH5mNEpbcOSs5U05uBlwh7NPfrhBvM Vh7K5sTAvEpqoc8Knbw3n7lDEqXdCG1IbIYjxKq+nuNMAn1Qi+kcRymPWNsecuJ9M5U7 BmwKOxksuoUkpY42x/KtxP/HidXAY2cctYdBZNREiQuD+sh1JRbAFW4CowjvEVfIBY8m 07McWY5hIZaJy61o5A0bvsDyFdy1Unu+8HiMPXl2Uijxs/j1t8qnk2upySg0Ey8ezGCF rahw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759145130; x=1759749930; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CpzgaP1uyKZ5R9Fi0rh+33FqZnbwzzKi+MdcZi4ZBZU=; b=rvXs95xm/m3HdMIJEDwBuJpMHzj1if899sbKeGcYp2Oj2hM3RvYaIealALCAN9L6f3 UEiGXK+0ZYfsEWMdp0s/ncCLSY6K0oEfv3X9JPZNGM9wcAe2zeXuQgO1dRjBWW4FmdZw XOKpqjtNi9SOdbZryJqF4BIg6ShXHnc0P2OtI39VsPoBGY3N8AX9KXeXFxnb/epnkH5a 5Sx17hyPjY9utJsuBjHrt/veDrL+v5zFXTGbHKTrv313Qs6SAAcN7fMMatBGHTmhJSUd gDxlLM7odCujxZ59tP0tV2Wzg3AkQpIWPdBJAYNkO+pMYYQ8waUZjyBXw2jramASIn5D BtyA== X-Gm-Message-State: AOJu0YwsaS5REoL8hzLjObIKN0xuq6VLRLQwBJ47BMd+D60oKfUmL2rK MmZh9e1+wY2D8xRTEtXFmLotSkW3Xk18jNtHEt4UTX0kxsHXuKPmbTWwSU8zIMFakzNb6pGL3/G IkJ0JU8GuCjVWVsoBkE+Hot3dosNdlRCIZnsltbtUEBt5/ybD0HBw X-Gm-Gg: ASbGncvN46nK3iiPzVBfjJqJjT0SVB1qqJ10W3kN0su18Jw8yFLaloF7po+QEkLtjJ7 QKSK9X+pYyviCdWI6KtHIIeT+/TdZ6VSuYB9bzjZ7cRVckDDUut7XVG82/iKgYuGZREoLZXyhoF Qo1B5K2TO7fdNGDhG5RuPuGMA/x8XHqcd+H8yKf1l1jYNA7qJE1cd21KoWikvn9SX1x0vJr41PK jr1Sk79Ii3luuv3YA== X-Google-Smtp-Source: AGHT+IG4pyslChOo1F27hs99f2Cu30SojVJk+c7ecYTceufBtPGgbl4GNzgTdJV0NWOc+G+rF0Eu4R1HF75VcUUUVxw= X-Received: by 2002:a05:6402:2146:b0:634:6f60:d4b0 with SMTP id 4fb4d7f45d1cf-6349f9e9fffmr11385028a12.15.1759145130261; Mon, 29 Sep 2025 04:25:30 -0700 (PDT) MIME-Version: 1.0 References: <20250609073214.7880-1-denis.kanchev@storpool.com> <20250609073214.7880-5-denis.kanchev@storpool.com> In-Reply-To: <20250609073214.7880-5-denis.kanchev@storpool.com> From: Denis Kanchev Date: Mon, 29 Sep 2025 14:24:53 +0300 X-Gm-Features: AS18NWD5qb5TgLwtUaQ_Pf5enPTIMirteYlQev8aJ8ZZ9-53f3AvP8zueUndmh8 Message-ID: Subject: Re: [PATCH atomic snapshot 4/4] plugin: add optional atomic snapshot creation To: pve-devel@lists.proxmox.com X-SPAM-LEVEL: Spam detection results: 0 BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy HTML_MESSAGE 0.001 HTML included in message KAM_SHORT 0.001 Use of a URL Shortener for very short URL RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 ping On Mon, Jun 9, 2025 at 10:32=E2=80=AFAM Demayl = wrote: > This will allow creating atomic snapshots from the custom plugins when > they support it > > Signed-off-by: Demayl > --- > src/PVE/Storage.pm | 52 +++++++++++++++++++++++++++++++++++++-- > src/PVE/Storage/Plugin.pm | 16 ++++++++++++ > 2 files changed, 66 insertions(+), 2 deletions(-) > > diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm > index d0a696a..9b044cc 100755 > --- a/src/PVE/Storage.pm > +++ b/src/PVE/Storage.pm > @@ -42,11 +42,11 @@ use PVE::Storage::BTRFSPlugin; > use PVE::Storage::ESXiPlugin; > > # Storage API version. Increment it on changes in storage API interface. > -use constant APIVER =3D> 11; > +use constant APIVER =3D> 12; > # Age is the number of versions we're backward compatible with. > # This is like having 'current=3DAPIVER' and age=3D'APIAGE' in libtool, > # see > https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.= html > -use constant APIAGE =3D> 2; > +use constant APIAGE =3D> 3; > > our $KNOWN_EXPORT_FORMATS =3D ['raw+size', 'tar+size', 'qcow2+size', > 'vmdk+size', 'zfs', 'btrfs']; > > @@ -347,6 +347,54 @@ sub volume_rollback_is_possible { > } > } > > + > +sub get_volumes_storecfg { > + my ($cfg, $volume_data) =3D @_; > + my $vol_cfg =3D {}; > + for my $volid (keys %{$volume_data}) { > + my ($storeid, $volname) =3D > parse_volume_id($volume_data->{$volid}->{file}, 1); > + if ($storeid) { > + $vol_cfg->{$volname} =3D { > + storeid =3D> $storeid, > + scfg =3D> storage_config($cfg, $storeid), > + }; > + } > + elsif ($volid =3D~ m|^(/.+)$| && -e $volid) { > + die "snapshot file/device '$volid' is not possible\n"; > + } else { > + die "unable to parse volume ID '$volid'\n"; > + } > + } > + return $vol_cfg; > +} > + > +sub volumes_atomic_snapshot_possible { > + my ($cfg, $disk_data) =3D @_; > + my $last_type; > + my $voldata =3D get_volumes_storecfg($cfg, $disk_data); > + for my $key (keys %$voldata) { > + my $type =3D $voldata->{ $key }->{scfg}->{type}; > + if (defined($last_type) && $last_type ne $type) { > + return (0, 0, $voldata); > + } > + $last_type =3D $type; > + } > + my $plugin =3D PVE::Storage::Plugin->lookup($last_type); > + return ( > + $plugin->volumes_atomic_snapshot_possible($voldata), > + $plugin->atomic_snapshot_preferred($voldata), > + $voldata, > + ) > +} > + > +sub volumes_atomic_snapshot { > + my ($voldata, $snapname) =3D @_; > + my $type =3D $voldata->{(keys %{$voldata})[0]}->{scfg}->{type}; > + my $plugin =3D PVE::Storage::Plugin->lookup($type); > + > + $plugin->volumes_atomic_snapshot($voldata, $snapname); > +} > + > sub volume_snapshot { > my ($cfg, $volid, $snap) =3D @_; > > diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm > index 4e16420..391dd0b 100644 > --- a/src/PVE/Storage/Plugin.pm > +++ b/src/PVE/Storage/Plugin.pm > @@ -1904,4 +1904,20 @@ sub config_aware_base_mkdir { > } > } > > +sub volumes_atomic_snapshot_possible { > + my ($class, $voldata) =3D @_; > + return 0; > +} > + > +sub atomic_snapshot_preferred { > + my ($class, $volata) =3D @_; > + return 0; > +} > + > +# Performs an atomic (crash-consistent) snapshot of all volumes at once. > +sub volumes_atomic_snapshot { > + my ($class, $voldata, $snap) =3D @_; > + die "volumes_atomic_snapshot is not implemented for $class"; > +} > + > 1; > -- > 2.43.0 > > --=20 --=20 *Denis Kanchev* Senior Software Engineer StorPool Storage tel: +3598883395988 @: denis.kanchev@storpool.com W: www.storpool.com *The best storage solution when building **a Leading **Cloud.* --===============6905795371735103584== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel --===============6905795371735103584==--