From: Denis Kanchev via pve-devel <pve-devel@lists.proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Denis Kanchev <denis.kanchev@storpool.com>
Subject: Re: [pve-devel] [PATCH atomic snapshot 4/4] plugin: add optional atomic snapshot creation
Date: Mon, 29 Sep 2025 14:24:53 +0300 [thread overview]
Message-ID: <mailman.473.1759145169.390.pve-devel@lists.proxmox.com> (raw)
In-Reply-To: <20250609073214.7880-5-denis.kanchev@storpool.com>
[-- Attachment #1: Type: message/rfc822, Size: 8912 bytes --]
From: Denis Kanchev <denis.kanchev@storpool.com>
To: pve-devel@lists.proxmox.com
Subject: Re: [PATCH atomic snapshot 4/4] plugin: add optional atomic snapshot creation
Date: Mon, 29 Sep 2025 14:24:53 +0300
Message-ID: <CAHXTzum1YzM5OYz8VyUrqJr04vgh6MQ2A5bnG=K-hnM-uhRidw@mail.gmail.com>
ping
On Mon, Jun 9, 2025 at 10:32 AM Demayl <denis.kanchev@storpool.com> wrote:
> This will allow creating atomic snapshots from the custom plugins when
> they support it
>
> Signed-off-by: Demayl <denis.kanchev@storpool.com>
> ---
> 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 => 11;
> +use constant APIVER => 12;
> # Age is the number of versions we're backward compatible with.
> # This is like having 'current=APIVER' and age='APIAGE' in libtool,
> # see
> https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
> -use constant APIAGE => 2;
> +use constant APIAGE => 3;
>
> our $KNOWN_EXPORT_FORMATS = ['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) = @_;
> + my $vol_cfg = {};
> + for my $volid (keys %{$volume_data}) {
> + my ($storeid, $volname) =
> parse_volume_id($volume_data->{$volid}->{file}, 1);
> + if ($storeid) {
> + $vol_cfg->{$volname} = {
> + storeid => $storeid,
> + scfg => storage_config($cfg, $storeid),
> + };
> + }
> + elsif ($volid =~ 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) = @_;
> + my $last_type;
> + my $voldata = get_volumes_storecfg($cfg, $disk_data);
> + for my $key (keys %$voldata) {
> + my $type = $voldata->{ $key }->{scfg}->{type};
> + if (defined($last_type) && $last_type ne $type) {
> + return (0, 0, $voldata);
> + }
> + $last_type = $type;
> + }
> + my $plugin = 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) = @_;
> + my $type = $voldata->{(keys %{$voldata})[0]}->{scfg}->{type};
> + my $plugin = PVE::Storage::Plugin->lookup($type);
> +
> + $plugin->volumes_atomic_snapshot($voldata, $snapname);
> +}
> +
> sub volume_snapshot {
> my ($cfg, $volid, $snap) = @_;
>
> 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) = @_;
> + return 0;
> +}
> +
> +sub atomic_snapshot_preferred {
> + my ($class, $volata) = @_;
> + return 0;
> +}
> +
> +# Performs an atomic (crash-consistent) snapshot of all volumes at once.
> +sub volumes_atomic_snapshot {
> + my ($class, $voldata, $snap) = @_;
> + die "volumes_atomic_snapshot is not implemented for $class";
> +}
> +
> 1;
> --
> 2.43.0
>
>
--
--
*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.*
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
prev parent reply other threads:[~2025-09-29 11:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250609073214.7880-1-denis.kanchev@storpool.com>
2025-06-09 7:32 ` [pve-devel] [PATCH atomic snapshot 1/4] ui: snapshot: add atomic option Demayl via pve-devel
2025-06-09 7:32 ` [pve-devel] [PATCH atomic_snapshot 2/4] snapshot api: add type option when making snapshots Demayl via pve-devel
2025-06-09 7:32 ` [pve-devel] [PATCH atomic snapshot 3/4] storage snapshot: add optional atomic snapshot creation in snapshot_create Demayl via pve-devel
2025-06-09 7:32 ` [pve-devel] [PATCH atomic snapshot 4/4] plugin: add optional atomic snapshot creation Demayl via pve-devel
[not found] ` <20250609073214.7880-5-denis.kanchev@storpool.com>
2025-09-29 11:24 ` Denis Kanchev via pve-devel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mailman.473.1759145169.390.pve-devel@lists.proxmox.com \
--to=pve-devel@lists.proxmox.com \
--cc=denis.kanchev@storpool.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.