all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [Add group snapshots 0/4] Adds support for atomic snapshots
@ 2026-12-01 14:19 Demayl
  2026-12-01 14:19 ` [Add group snapshots 1/4] plugin: add volumes_atomic_snapshot Demayl
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Demayl @ 2026-12-01 14:19 UTC (permalink / raw)
  To: pve-devel

This change consists patches in 4 different respositories:
pve-manager, qemu-server, pve-guest-common and pve-storage.

Allows creating snapshots for all volumes at once.
This feature is enabled only when the storage plugin allows it.
Continuation of the discussion here:
https://lists.proxmox.com/pipermail/pve-devel/2024-October/065549.html
Here is how it looks in a storage plugin:
https://github.com/storpool/pve-storpool/pull/12


-- 
2.53.0




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Add group snapshots 1/4] plugin: add volumes_atomic_snapshot
  2026-12-01 14:19 [Add group snapshots 0/4] Adds support for atomic snapshots Demayl
@ 2026-12-01 14:19 ` Demayl
  2026-12-01 14:19 ` [Add group snapshots 2/4] snapshot: add atomic snapshots Demayl
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Demayl @ 2026-12-01 14:19 UTC (permalink / raw)
  To: pve-devel

May be implemented if the underlying storage supports atomic snapshots.
Activating atomic_snapshots as a feature in a plugin
and atomic_snapshot as a volume feature for all volumes,
will call volumes_atomic_snapshot. It has 3 parameters
1. Hash scfg - storage configuration
2. Array[Hash] volumes_list - [{name=>'',storeid=>'',..}]
3. Str snapshot_name

Signed-off-by: Demayl <denis.kanchev@storpool.com>
---
 src/PVE/Storage.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index c77a675..b8c1c24 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -507,6 +507,13 @@ sub volume_snapshot {
     }
 }
 
+sub volumes_atomic_snapshot {
+    my ($scfg, $voldata, $snapname, $storage_type) = @_;
+    my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
+
+    $plugin->volumes_atomic_snapshot($scfg, $voldata, $snapname);
+}
+
 sub volume_snapshot_rollback {
     my ($cfg, $volid, $snap) = @_;
 
-- 
2.53.0




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Add group snapshots 2/4] snapshot: add atomic snapshots
  2026-12-01 14:19 [Add group snapshots 0/4] Adds support for atomic snapshots Demayl
  2026-12-01 14:19 ` [Add group snapshots 1/4] plugin: add volumes_atomic_snapshot Demayl
@ 2026-12-01 14:19 ` Demayl
  2026-12-01 14:19 ` [Add group snapshots 3/4] snapshot: add atomic_snapshot Demayl
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Demayl @ 2026-12-01 14:19 UTC (permalink / raw)
  To: pve-devel

Allows atomic (group) snapshots when the storage allows it.
It must be enabled as a feature in the storage.
The plugindata feature atomic_snapshots is a Hash adding
2 options:
freeze_fs=1 - bool allows freezefs if needed.
allow_different_templates=0 - bool allows snapshotting
volumes from different storage templates.

Without atomic_snapshots enabled it behaves like before
and creates sequential volume snapshots.

Signed-off-by: Demayl <denis.kanchev@storpool.com>
---
 src/PVE/AbstractConfig.pm | 94 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 82 insertions(+), 12 deletions(-)

diff --git a/src/PVE/AbstractConfig.pm b/src/PVE/AbstractConfig.pm
index 68e203c..8f68d9e 100644
--- a/src/PVE/AbstractConfig.pm
+++ b/src/PVE/AbstractConfig.pm
@@ -1056,10 +1056,69 @@ sub __snapshot_activate_storages {
     return;
 }
 
+# Get list of atomic volumes data and checks if all volumes have the atomic feature on
+# plugindata->features->atomic_snapshot
+sub get_atomic_snapshot_volumes {
+    my ($class, $snap) = @_;
+    my $store_main_id  = undef;
+    my $storage_main   = undef;
+    my $feature_atomic = undef;
+    my $store_cfg    = PVE::Storage::config();
+    my @volumes;
+
+    $class->foreach_volume($snap, sub {
+        my ($vs, $volume) = @_;
+        if ($volume->{file} && $volume->{file} ne 'none') {
+            my $volid = $volume->{file};
+            my ( $storeid, $volname )  = PVE::Storage::parse_volume_id($volid);
+
+            die "unable to parse volume ID '$volid'\n" if !$storeid;
+
+            my $storage        = PVE::Storage::storage_config($store_cfg, $storeid);
+            $feature_atomic = PVE::Storage::storage_has_feature(
+            $store_cfg, $storeid, 'atomic_snapshot');
+            $store_main_id     = $storeid if !defined $store_main_id;
+            $storage_main      = $storage->{type} if !defined $storage_main;
+            $volume->{storeid} = $storeid;
+            $volume->{storage} = $storage;
+            $volume->{volname} = $volname;
+            $volume->{drive}   = $vs;
+
+            if (!$feature_atomic) {
+                die "storage '$storeid' doesn't support atomic snapshots"
+            }
+
+            if (
+            !$feature_atomic->{allow_different_templates}
+            && $storeid ne $store_main_id
+            ) {
+                die "storage '$storeid' differs from '$store_main_id' "
+                ."and can't perform atomic snapshots on different templates!"
+            }
+
+            if ($storage_main ne $storage->{type}) {
+                die "atomic snapshots are not allowed for different storages.";
+            }
+            push @volumes, $volume;
+        }
+    });
+    return { volumes => \@volumes, config => $feature_atomic };
+}
+
+sub __snapshot_volumes_atomically {
+    my ($class, $voldata, $snapname) = @_;
+    my $scfg     = $voldata->[0]->{storage};
+    my $storeid  = $voldata->[0]->{storeid};
+    my @volnames = map {{ name => $_->{volname}, storeid => $_->{storeid} }} @$voldata;
+    # Every volume can be part of different store
+    PVE::Storage::volumes_atomic_snapshot($scfg, \@volnames, $snapname);
+}
+
 # Creates a snapshot for the VM/CT.
 sub snapshot_create {
-    my ($class, $vmid, $snapname, $save_vmstate, $comment) = @_;
+    my ($class, $vmid, $snapname, $save_vmstate, $comment, $type) = @_;
 
+    my $atomic = $type && $type eq 'atomic';
     my $snap = $class->__snapshot_prepare($vmid, $snapname, $save_vmstate, $comment);
 
     $save_vmstate = 0 if !$snap->{vmstate};
@@ -1070,32 +1129,43 @@ sub snapshot_create {
         $class->__snapshot_check_freeze_needed($vmid, $conf, $snap->{vmstate});
 
     my $drivehash = {};
+    my $allow_freeze = 1;
+    my $atomic_volumes;
 
     eval {
         $class->__snapshot_activate_storages($conf, 0);
 
-        if ($freezefs) {
-            print "freeze guest filesystem\n";
+        if ($atomic) {
+            my $atomic_data = $class->get_atomic_snapshot_volumes($snap);
+            if (defined $atomic_data->{config}->{freeze_fs}) {
+                $allow_freeze = $atomic_data->{config}->{freeze_fs};
+            }
+            $atomic_volumes = $atomic_data->{volumes};
+        }
+
+        if ($freezefs && $allow_freeze) {
             $class->__snapshot_freeze($vmid, 0);
         }
 
         $class->__snapshot_create_vol_snapshots_hook($vmid, $snap, $running, "before");
 
-        $class->foreach_volume(
-            $snap,
-            sub {
-                my ($vs, $volume) = @_;
+        if ($atomic) {
+            $class->__snapshot_volumes_atomically($atomic_volumes, $snapname);
+            $drivehash = { map { $_->{drive} => 1 } @$atomic_volumes };
+        } else {
+            $class->foreach_volume($snap, sub {
+            my ($vs, $volume) = @_;
 
-                $class->__snapshot_create_vol_snapshot($vmid, $vs, $volume, $snapname);
-                $drivehash->{$vs} = 1;
-            },
-        );
+            $class->__snapshot_create_vol_snapshot($vmid, $vs, $volume, $snapname);
+            $drivehash->{$vs} = 1;
+            });
+        }
     };
     my $err = $@;
 
     if ($running) {
         $class->__snapshot_create_vol_snapshots_hook($vmid, $snap, $running, "after");
-        if ($freezefs) {
+        if ($freezefs && $allow_freeze) {
             print "thaw guest filesystem\n";
             $class->__snapshot_freeze($vmid, 1);
         }
-- 
2.53.0




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Add group snapshots 3/4] snapshot: add atomic_snapshot
  2026-12-01 14:19 [Add group snapshots 0/4] Adds support for atomic snapshots Demayl
  2026-12-01 14:19 ` [Add group snapshots 1/4] plugin: add volumes_atomic_snapshot Demayl
  2026-12-01 14:19 ` [Add group snapshots 2/4] snapshot: add atomic snapshots Demayl
@ 2026-12-01 14:19 ` Demayl
  2026-12-01 14:19 ` [Add group snapshots 4/4] ui: add atomic snapshot type when creating a snapshot Demayl
  2026-12-01 16:19 ` [Add group snapshots 0/4] Adds support for atomic snapshots DERUMIER, Alexandre
  4 siblings, 0 replies; 6+ messages in thread
From: Demayl @ 2026-12-01 14:19 UTC (permalink / raw)
  To: pve-devel

Adds the vm feature check for atomic_snapshot
It must be supported by a storage plugin
Adds the type option when creating a snapshot
to support atomic snapshots. For now it supports atomic as value
Defaults to sequential if not used.

Signed-off-by: Demayl <denis.kanchev@storpool.com>
---
 src/PVE/API2/Qemu.pm  | 7 ++++++-
 src/PVE/QemuServer.pm | 5 +++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
index 2119e69e..8e9df22c 100644
--- a/src/PVE/API2/Qemu.pm
+++ b/src/PVE/API2/Qemu.pm
@@ -4542,7 +4542,7 @@ __PACKAGE__->register_method({
             feature => {
                 description => "Feature to check.",
                 type => 'string',
-                enum => ['snapshot', 'clone', 'copy'],
+                enum => ['snapshot', 'clone', 'copy', 'atomic_snapshot'],
             },
             snapname => get_standard_option('pve-snapshot-name', {
                     optional => 1,
@@ -6482,6 +6482,11 @@ __PACKAGE__->register_method({
                 type => 'string',
                 description => "A textual description or comment.",
             },
+            type => {
+                optional => 1,
+                type => 'string',
+                description => "Sequential or atomic snapshot of VM volumes (if supported by storage)"
+            }
         },
     },
     returns => {
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 1d665877..bdade7f5 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -2510,6 +2510,11 @@ our $vmstatus_return_properties = {
         type => 'number',
         optional => 1,
     },
+    atomic_snapshots => {
+        description => "Determines if the storage allows atomic snapshots",
+        type => 'boolean',
+        optional => 1,
+    }
 };
 
 my $last_proc_pid_stat;
-- 
2.53.0




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Add group snapshots 4/4] ui: add atomic snapshot type when creating a snapshot
  2026-12-01 14:19 [Add group snapshots 0/4] Adds support for atomic snapshots Demayl
                   ` (2 preceding siblings ...)
  2026-12-01 14:19 ` [Add group snapshots 3/4] snapshot: add atomic_snapshot Demayl
@ 2026-12-01 14:19 ` Demayl
  2026-12-01 16:19 ` [Add group snapshots 0/4] Adds support for atomic snapshots DERUMIER, Alexandre
  4 siblings, 0 replies; 6+ messages in thread
From: Demayl @ 2026-12-01 14:19 UTC (permalink / raw)
  To: pve-devel

Now we have two types of snapshots:
  1. Sequential - default every volume separately
  2. Atomic - group snapshot of all volumes

The storage must support this feature for every volume
 or the feature remains hidden

Signed-off-by: Demayl <denis.kanchev@storpool.com>
---
 www/manager6/window/Snapshot.js | 43 +++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/www/manager6/window/Snapshot.js b/www/manager6/window/Snapshot.js
index a2134bd3..ea35d072 100644
--- a/www/manager6/window/Snapshot.js
+++ b/www/manager6/window/Snapshot.js
@@ -7,12 +7,15 @@ Ext.define('PVE.window.Snapshot', {
             isCreate: undefined,
             running: false,
             guestAgentEnabled: false,
+            atomic: false,
         },
         formulas: {
             runningWithoutGuestAgent: (get) =>
                 get('type') === 'qemu' && get('running') && !get('guestAgentEnabled'),
             shouldWarnAboutFS: (get) =>
                 get('isCreate') && get('runningWithoutGuestAgent') && get('!vmstate.checked'),
+            atomicEnabled: (get) =>
+                get('atomic')
         },
     },
 
@@ -57,6 +60,16 @@ Ext.define('PVE.window.Snapshot', {
                     vm.set('guestAgentEnabled', !!PVE.Parser.parseBoolean(enabled.enabled));
                 },
             });
+            Proxmox.Utils.API2Request({
+                url: `/nodes/${me.nodename}/${me.type}/${me.vmid}/feature`,
+                params: { feature: 'atomic_snapshot' },
+                async: false,
+                method: 'GET',
+                success: function(response, options) {
+                    let res = response.result.data;
+                    vm.set('atomic', !!res.hasFeature);
+                },
+            });
         }
 
         me.items = [
@@ -87,6 +100,36 @@ Ext.define('PVE.window.Snapshot', {
                 checked: 1,
                 fieldLabel: gettext('Include RAM'),
             },
+            {
+                xtype: 'radiogroup',
+                fieldLabel: gettext('Type'),
+                vertical: true,
+                hidden: !me.isCreate || !vm.get('atomic'),
+                columns: 1,
+                reference: 'atomic',
+                items: [
+                    {
+                    xtype: 'radiofield',
+                    boxLabel: gettext('Sequential'),
+                    name: 'type',
+                    flex: 1,
+                    inputValue: 'sequential',
+                    bind: { value: 'sequential' }
+                    },
+                    {
+                    xtype: 'radiofield',
+                    boxLabel: gettext('Atomic'),
+                    name: 'type',
+                    flex: 1,
+                    inputValue: 'atomic',
+                    disabled: true,
+                    bind: {
+                        value: '',
+                        disabled: '{!atomic}',
+                    }
+                    }
+                ]
+            },
             {
                 xtype: 'textareafield',
                 grow: true,
-- 
2.53.0




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Add group snapshots 0/4] Adds support for atomic snapshots
  2026-12-01 14:19 [Add group snapshots 0/4] Adds support for atomic snapshots Demayl
                   ` (3 preceding siblings ...)
  2026-12-01 14:19 ` [Add group snapshots 4/4] ui: add atomic snapshot type when creating a snapshot Demayl
@ 2026-12-01 16:19 ` DERUMIER, Alexandre
  4 siblings, 0 replies; 6+ messages in thread
From: DERUMIER, Alexandre @ 2026-12-01 16:19 UTC (permalink / raw)
  To: pve-devel@lists.proxmox.com, denis.kanchev@storpool.com

Hi,

great future.  Ceph rbd also support group snapshot,

but it require implementation of group (create 1 group by vm, then add
the vm rbd image in the group)

(groupe create , image add could be done at the first snapshot create,
if the group don't exist yet for example)

# Consistency groups: snapshot several images at once
rbd group create <POOL>/<GROUP>
rbd group image add <POOL>/<GROUP> <POOL>/<IMAGE>
rbd group image list <POOL>/<GROUP>
rbd group snap create <POOL>/<GROUP>@<SNAP>
rbd group snap list   <POOL>/<GROUP>
rbd group snap rollback <POOL>/<GROUP>@<SNAP>
rbd group rm <POOL>/<GROUP>

Le mardi 01 décembre 2026 à 16:19 +0200, Demayl a écrit :
> This change consists patches in 4 different respositories:
> pve-manager, qemu-server, pve-guest-common and pve-storage.
> 
> Allows creating snapshots for all volumes at once.
> This feature is enabled only when the storage plugin allows it.
> Continuation of the discussion here:
> https://atpscan.global.hornetsecurity.com?d=ehnt29Y7CL58PY8iS1PJhSTI1h1rBO8S360j3n_zfzfY5P69XM1lhUZ3p8GT5DPp&f=8MhYV00whBxKzr8iaOfWKmjeo5Srny-ZnviBA5VPOOjHrTf6dphN5PHD6SiVgw_1vJrn50gOCldI_1VfuA5GIw&i=&k=QAnV&m=iSvEQQv6TSRFmtT8q9VLV0qSZFGclZMv4Gkol2AnolE55WG2G3UhmPgZnwCrAM5nmwnhgSbbgdEGp8AZsDrEPeThAp3GXx1r0e9IKQRrrO2wy8ETA_3QmUIMqc4Cq5Tc&n=IeKtPuEN8RM95Dmqk6yv7c-s_K7puFujBi_khhnstX33dJ911D_G6U9LafdFJw5v&r=faNkIJbzJQxqH52JjbURmohRsAUU-VxluL2ELKT_gAuTZ6dn34Ha8IFAK_WRWiQIujwArPvKqAWWqT0J4aBJpA&s=af82f006f19c15cc2d4b09d91b216cffe132476729659ba2145c098cdd6c6038&u=https%3A%2F%2Flists.proxmox.com%2Fpipermail%2Fpve-devel%2F2024-October%2F065549.html
> Here is how it looks in a storage plugin:
> https://atpscan.global.hornetsecurity.com?d=LpZj0ppXIwEbIxKdwfp5cWPNZKqrdSCzlaLIy5rJSr3sHq6_GRv9wZeuxbFJvxIY&f=7ehOc_GqAO96FoC6cADMdwyxhtRF-1gEf_RRdWpX1epkTtuO3FEzTnE9hJG-rEewYHt9VMpEgA9OEFU_mULp1Q&i=&k=3jMW&m=dgyuO4YGcapIWqK1ziR4CDNTFkG1a-jVCPnL2HXhkwkF122ag1bVoWdjT9PO4zRZp3pLRqlfXwQ0ZRN2m55OCo5J6XjCcRCfY_aaJgU85PJjORjAIhVGvCoyE77iyqmq&n=7t5ElPuHR61yEzq7U8f_kFf1vBuYljB3ynbm08kusrITmF7kqJ2L--rKVDmvL2lf&r=PuubL3jRtrSA4nDPJJM1ZOPfBHagb0NER2a_PWeTkN6k_q08jpeCCfP-l7fmFK83DAN3XHGdR1MixcBw_TyfYQ&s=696137699d9758c8a057fad8ddf799d1a5ed43d5dbf1ddac01bcfc563951a44f&u=https%3A%2F%2Fgithub.com%2Fstorpool%2Fpve-storpool%2Fpull%2F12
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-12-01 16:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 14:19 [Add group snapshots 0/4] Adds support for atomic snapshots Demayl
2026-12-01 14:19 ` [Add group snapshots 1/4] plugin: add volumes_atomic_snapshot Demayl
2026-12-01 14:19 ` [Add group snapshots 2/4] snapshot: add atomic snapshots Demayl
2026-12-01 14:19 ` [Add group snapshots 3/4] snapshot: add atomic_snapshot Demayl
2026-12-01 14:19 ` [Add group snapshots 4/4] ui: add atomic snapshot type when creating a snapshot Demayl
2026-12-01 16:19 ` [Add group snapshots 0/4] Adds support for atomic snapshots DERUMIER, Alexandre

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal