public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Alexandre Derumier via pve-devel <pve-devel@lists.proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
Subject: [pve-devel] [PATCH FOLLOW-UP storage 14/14] storage: remove $running param from volume_snapshot
Date: Wed, 16 Jul 2025 08:31:53 +0200	[thread overview]
Message-ID: <mailman.1494.1752647555.395.pve-devel@lists.proxmox.com> (raw)
In-Reply-To: <20250716063153.1647681-1-alexandre.derumier@groupe-cyllene.com>

[-- Attachment #1: Type: message/rfc822, Size: 9983 bytes --]

From: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH FOLLOW-UP storage 14/14] storage: remove $running param from volume_snapshot
Date: Wed, 16 Jul 2025 08:31:53 +0200
Message-ID: <20250716063153.1647681-19-alexandre.derumier@groupe-cyllene.com>

not needed anymore after change in qemu-server

Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
---
 ApiChangeLog                         |  4 ----
 src/PVE/Storage.pm                   |  4 ++--
 src/PVE/Storage/ESXiPlugin.pm        |  2 +-
 src/PVE/Storage/ISCSIDirectPlugin.pm |  2 +-
 src/PVE/Storage/LVMPlugin.pm         | 11 +----------
 src/PVE/Storage/LvmThinPlugin.pm     |  2 +-
 src/PVE/Storage/PBSPlugin.pm         |  2 +-
 src/PVE/Storage/Plugin.pm            | 16 ++++++----------
 src/PVE/Storage/RBDPlugin.pm         |  2 +-
 src/PVE/Storage/ZFSPoolPlugin.pm     |  2 +-
 10 files changed, 15 insertions(+), 32 deletions(-)

diff --git a/ApiChangeLog b/ApiChangeLog
index 68e94fd..58996a9 100644
--- a/ApiChangeLog
+++ b/ApiChangeLog
@@ -22,10 +22,6 @@ Future changes should be documented in here.
   Feel free to request allowing more drivers or options on the pve-devel mailing list based on your
   needs.
 
-* Add `running` parameter to `volume_snapshot()`
-    The parameter *can* be used if some extra actions need to be done at the storage
-    layer when the snapshot has already be done at qemu level when the vm is running.
-
 * Introduce rename_snapshot() plugin method
     This method allow to rename a vm disk snapshot name to a different snapshot name.
 
diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index b3ca094..893b611 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -449,13 +449,13 @@ sub volume_rollback_is_possible {
 }
 
 sub volume_snapshot {
-    my ($cfg, $volid, $snap, $running) = @_;
+    my ($cfg, $volid, $snap) = @_;
 
     my ($storeid, $volname) = parse_volume_id($volid, 1);
     if ($storeid) {
         my $scfg = storage_config($cfg, $storeid);
         my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
-        return $plugin->volume_snapshot($scfg, $storeid, $volname, $snap, $running);
+        return $plugin->volume_snapshot($scfg, $storeid, $volname, $snap);
     } elsif ($volid =~ m|^(/.+)$| && -e $volid) {
         die "snapshot file/device '$volid' is not possible\n";
     } else {
diff --git a/src/PVE/Storage/ESXiPlugin.pm b/src/PVE/Storage/ESXiPlugin.pm
index 66ef289..eeb6a48 100644
--- a/src/PVE/Storage/ESXiPlugin.pm
+++ b/src/PVE/Storage/ESXiPlugin.pm
@@ -561,7 +561,7 @@ sub volume_size_info {
 }
 
 sub volume_snapshot {
-    my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
+    my ($class, $scfg, $storeid, $volname, $snap) = @_;
 
     die "creating snapshots is not supported for $class\n";
 }
diff --git a/src/PVE/Storage/ISCSIDirectPlugin.pm b/src/PVE/Storage/ISCSIDirectPlugin.pm
index 93cfd3c..62e9026 100644
--- a/src/PVE/Storage/ISCSIDirectPlugin.pm
+++ b/src/PVE/Storage/ISCSIDirectPlugin.pm
@@ -232,7 +232,7 @@ sub volume_resize {
 }
 
 sub volume_snapshot {
-    my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
+    my ($class, $scfg, $storeid, $volname, $snap) = @_;
     die "volume snapshot is not possible on iscsi device\n";
 }
 
diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index 1f5a5f1..35e1732 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -959,21 +959,12 @@ sub volume_size_info {
 }
 
 sub volume_snapshot {
-    my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
+    my ($class, $scfg, $storeid, $volname, $snap) = @_;
 
     my ($vmid, $format) = ($class->parse_volname($volname))[2, 6];
 
     die "can't snapshot '$format' volume\n" if $format ne 'qcow2';
 
-    if ($running) {
-        #rename with blockdev-reopen is done at qemu level when running
-        eval { alloc_snap_image($class, $storeid, $scfg, $volname, $snap) };
-        if ($@) {
-            die "can't allocate new volume $volname: $@\n";
-        }
-        return;
-    }
-
     $class->activate_volume($storeid, $scfg, $volname);
 
     #rename current volume to snap volume
diff --git a/src/PVE/Storage/LvmThinPlugin.pm b/src/PVE/Storage/LvmThinPlugin.pm
index 13c0275..6f8a92e 100644
--- a/src/PVE/Storage/LvmThinPlugin.pm
+++ b/src/PVE/Storage/LvmThinPlugin.pm
@@ -353,7 +353,7 @@ sub create_base {
 # sub volume_resize {} reuse code from parent class
 
 sub volume_snapshot {
-    my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
+    my ($class, $scfg, $storeid, $volname, $snap) = @_;
 
     my $vg = $scfg->{vgname};
     my $snapvol = "snap_${volname}_$snap";
diff --git a/src/PVE/Storage/PBSPlugin.pm b/src/PVE/Storage/PBSPlugin.pm
index 45edc46..00170f5 100644
--- a/src/PVE/Storage/PBSPlugin.pm
+++ b/src/PVE/Storage/PBSPlugin.pm
@@ -966,7 +966,7 @@ sub volume_resize {
 }
 
 sub volume_snapshot {
-    my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
+    my ($class, $scfg, $storeid, $volname, $snap) = @_;
     die "volume snapshot is not possible on pbs device";
 }
 
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 439e4c3..2e16c59 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -1272,7 +1272,7 @@ sub volume_resize {
 }
 
 sub volume_snapshot {
-    my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
+    my ($class, $scfg, $storeid, $volname, $snap) = @_;
 
     if ($scfg->{'external-snapshots'}) {
 
@@ -1280,18 +1280,14 @@ sub volume_snapshot {
 
         my $vmid = ($class->parse_volname($volname))[2];
 
-        if (!$running) {
-            #rename volume unless qemu has already done it for us
-            $class->rename_snapshot($scfg, $storeid, $volname, 'current', $snap);
-        }
+        #rename volume unless qemu has already done it for us
+        $class->rename_snapshot($scfg, $storeid, $volname, 'current', $snap);
+
         eval { alloc_backed_image($class, $storeid, $scfg, $volname, $snap) };
         if ($@) {
             warn "$@ \n";
-            #if running, the revert is done by qemu with blockdev-reopen
-            if (!$running) {
-                eval { $class->rename_snapshot($scfg, $storeid, $volname, $snap, 'current'); };
-                warn $@ if $@;
-            }
+            eval { $class->rename_snapshot($scfg, $storeid, $volname, $snap, 'current'); };
+            warn $@ if $@;
             die "can't allocate new volume $volname with $snap backing image\n";
         }
 
diff --git a/src/PVE/Storage/RBDPlugin.pm b/src/PVE/Storage/RBDPlugin.pm
index 45f8a7f..541752e 100644
--- a/src/PVE/Storage/RBDPlugin.pm
+++ b/src/PVE/Storage/RBDPlugin.pm
@@ -866,7 +866,7 @@ sub volume_resize {
 }
 
 sub volume_snapshot {
-    my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
+    my ($class, $scfg, $storeid, $volname, $snap) = @_;
 
     my ($vtype, $name, $vmid) = $class->parse_volname($volname);
 
diff --git a/src/PVE/Storage/ZFSPoolPlugin.pm b/src/PVE/Storage/ZFSPoolPlugin.pm
index 28d4795..cdf5868 100644
--- a/src/PVE/Storage/ZFSPoolPlugin.pm
+++ b/src/PVE/Storage/ZFSPoolPlugin.pm
@@ -480,7 +480,7 @@ sub volume_size_info {
 }
 
 sub volume_snapshot {
-    my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
+    my ($class, $scfg, $storeid, $volname, $snap) = @_;
 
     my $vname = ($class->parse_volname($volname))[1];
 
-- 
2.39.5



[-- 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

      parent reply	other threads:[~2025-07-16  6:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250716063153.1647681-1-alexandre.derumier@groupe-cyllene.com>
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP qemu-server 1/4] api2: move_disk: use parse_volname to find old volume format Alexandre Derumier via pve-devel
2025-07-16 13:58   ` [pve-devel] applied-series: " Wolfgang Bumiller
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP storage 01/14] helpers: make qemu_img* storage config independent Alexandre Derumier via pve-devel
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP qemu-server 2/4] blockdev_rename: remove old left-over rename() Alexandre Derumier via pve-devel
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP storage 02/14] helpers: move qemu_img* to Common module Alexandre Derumier via pve-devel
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP qemu-server 3/4] generate_backing_blockdev: use current_sub for private recursive Alexandre Derumier via pve-devel
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP storage 03/14] rename_snapshot: fix parameter checks Alexandre Derumier via pve-devel
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP qemu-server 4/4] blockdev_external_snapshot: rework to avoid $running param Alexandre Derumier via pve-devel
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP storage 04/14] lvm snapshot: activate volume Alexandre Derumier via pve-devel
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP storage 05/14] common: fix qemu_img_resize Alexandre Derumier via pve-devel
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP storage 06/14] plugin: volume_export: don't allow export of external snapshots Alexandre Derumier via pve-devel
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP storage 07/14] lvmplugin: alloc_snap_image: die if file_size_info return empty size Alexandre Derumier via pve-devel
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP storage 08/14] lvmplugin: snapshot: use relative path for backing image Alexandre Derumier via pve-devel
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP storage 09/14] plugin|lvmplugin: don't allow volume rename if external snapshots exist Alexandre Derumier via pve-devel
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP storage 10/14] lvmplugin: add volume_snapshot_info Alexandre Derumier via pve-devel
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP storage 11/14] plugin: lvmplugin: add parse_snap_name Alexandre Derumier via pve-devel
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP storage 12/14] plugin : improve parse_namedir warning Alexandre Derumier via pve-devel
2025-07-16  6:31 ` [pve-devel] [PATCH FOLLOW-UP storage 13/14] lvmplugin: add external-snapshots option && forbid creation of qcow2 volumes without it Alexandre Derumier via pve-devel
2025-07-16  6:31 ` Alexandre Derumier 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.1494.1752647555.395.pve-devel@lists.proxmox.com \
    --to=pve-devel@lists.proxmox.com \
    --cc=alexandre.derumier@groupe-cyllene.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