From: Demayl via pve-devel <pve-devel@lists.proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Demayl <denis.kanchev@storpool.com>
Subject: [pve-devel] [PATCH atomic_snapshot 2/4] snapshot api: add type option when making snapshots
Date: Mon, 9 Jun 2025 10:32:10 +0300 [thread overview]
Message-ID: <mailman.300.1749454349.395.pve-devel@lists.proxmox.com> (raw)
In-Reply-To: <20250609073214.7880-1-denis.kanchev@storpool.com>
[-- Attachment #1: Type: message/rfc822, Size: 7798 bytes --]
From: Demayl <denis.kanchev@storpool.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH atomic_snapshot 2/4] snapshot api: add type option when making snapshots
Date: Mon, 9 Jun 2025 10:32:10 +0300
Message-ID: <20250609073214.7880-3-denis.kanchev@storpool.com>
Allows picking between atomic and sequential snapshots
Default sequential
Signed-off-by: Demayl <denis.kanchev@storpool.com>
---
PVE/API2/Qemu.pm | 7 ++++++-
PVE/QemuConfig.pm | 13 +++++++++++++
PVE/QemuServer.pm | 10 ++++++++++
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 626cce45..27d86438 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -5488,6 +5488,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 => {
@@ -5519,7 +5524,7 @@ __PACKAGE__->register_method({
my $realcmd = sub {
PVE::Cluster::log_msg('info', $authuser, "snapshot VM $vmid: $snapname");
PVE::QemuConfig->snapshot_create($vmid, $snapname, $param->{vmstate},
- $param->{description});
+ $param->{description}, $param->{type});
};
return $rpcenv->fork_worker('qmsnapshot', $vmid, $authuser, $realcmd);
diff --git a/PVE/QemuConfig.pm b/PVE/QemuConfig.pm
index 2609542c..7f6399c7 100644
--- a/PVE/QemuConfig.pm
+++ b/PVE/QemuConfig.pm
@@ -367,6 +367,19 @@ sub __snapshot_create_vol_snapshots_hook {
}
}
+sub get_atomic_snapshot_volumes {
+ my ($class, $conf) = @_;
+
+ my $volumes = $class->SUPER::get_atomic_snapshot_volumes($conf);
+ my $filtered = {};
+ for my $vol_name (keys %{$volumes}) {
+ if (! PVE::QemuServer::drive_is_cdrom($volumes->{$vol_name})) {
+ $filtered->{$vol_name} = $volumes->{$vol_name};
+ }
+ }
+ return $filtered;
+}
+
sub __snapshot_create_vol_snapshot {
my ($class, $vmid, $ds, $drive, $snapname) = @_;
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 577959a4..5c14ce49 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2809,6 +2809,10 @@ our $vmstatus_return_properties = {
type => 'boolean',
optional => 1,
},
+ snapshots => {
+ description => "Snapshot info.",
+ type => 'object',
+ },
};
my $last_proc_pid_stat;
@@ -2881,6 +2885,12 @@ sub vmstatus {
$d->{tags} = $conf->{tags} if defined($conf->{tags});
$res->{$vmid} = $d;
+
+ my ($can_atomic, $pref_atomic, undef) = PVE::QemuConfig->check_atomic_snapshots($conf);
+ $res->{$vmid}->{snapshots} = {
+ atomic_possible => $can_atomic,
+ atomic_preferred => $pref_atomic,
+ };
}
my $netdev = PVE::ProcFSTools::read_proc_net_dev();
--
2.43.0
[-- 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
next prev parent reply other threads:[~2025-06-09 7:32 UTC|newest]
Thread overview: 4+ 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 ` Demayl via pve-devel [this message]
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
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.300.1749454349.395.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal