public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] snapshot create/delete: die early for snapshot-as-volume-chain for pre-10.0 machine version
@ 2025-08-07 10:47 Fiona Ebner
  2025-08-07 12:04 ` Hannes Laimer
  2025-08-07 12:32 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Fiona Ebner @ 2025-08-07 10:47 UTC (permalink / raw)
  To: pve-devel

As reported in the community forum [0], a running VM with pre-10.0
machine version using a storage with snapshot-as-volume-chain will run
into issues when creating a snapshot. Similarly deleting the snapshot
of such a VM would fail. Having '-blockdev' is a hard requirement for
the implementation of the snapshot-as-volume-chain feature for running
VMs, so die and suggest upgrading the machine version.

[0]: https://forum.proxmox.com/threads/lvm-thick-with-iscsi-pve-9-0-3.169319/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/QemuServer.pm | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index d42e2115..e30b27cb 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -4447,12 +4447,17 @@ sub qemu_volume_snapshot {
         print "internal qemu snapshot\n";
         mon_cmd($vmid, 'blockdev-snapshot-internal-sync', device => $deviceid, name => $snap);
     } elsif ($do_snapshots_type eq 'external') {
+        my $machine_version = PVE::QemuServer::Machine::get_current_qemu_machine($vmid);
+        if (!PVE::QemuServer::Machine::is_machine_version_at_least($machine_version, 10, 0)) {
+            die "storage for '$volid' is configured for snapshots as a volume chain - this requires"
+                . " QEMU machine version >= 10.0. See"
+                . " https://pve.proxmox.com/wiki/QEMU_Machine_Version_Upgrade\n";
+        }
         my $storeid = (PVE::Storage::parse_volume_id($volid))[0];
         my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
         print "external qemu snapshot\n";
         my $snapshots = PVE::Storage::volume_snapshot_info($storecfg, $volid);
         my $parent_snap = $snapshots->{'current'}->{parent};
-        my $machine_version = PVE::QemuServer::Machine::get_current_qemu_machine($vmid);
         PVE::QemuServer::Blockdev::blockdev_external_snapshot(
             $storecfg, $vmid, $machine_version, $deviceid, $drive, $snap, $parent_snap,
         );
@@ -4489,6 +4494,13 @@ sub qemu_volume_snapshot_delete {
             name => $snap,
         );
     } elsif ($do_snapshots_type eq 'external') {
+        my $machine_version = PVE::QemuServer::Machine::get_current_qemu_machine($vmid);
+        if (!PVE::QemuServer::Machine::is_machine_version_at_least($machine_version, 10, 0)) {
+            die "storage for '$volid' is configured for snapshots as a volume chain - this requires"
+                . " QEMU machine version >= 10.0. See"
+                . " https://pve.proxmox.com/wiki/QEMU_Machine_Version_Upgrade\n";
+        }
+
         print "delete qemu external snapshot\n";
 
         my $path = PVE::Storage::path($storecfg, $volid);
@@ -4499,7 +4511,6 @@ sub qemu_volume_snapshot_delete {
 
         my $parentsnap = $snapshots->{$snap}->{parent};
         my $childsnap = $snapshots->{$snap}->{child};
-        my $machine_version = PVE::QemuServer::Machine::get_current_qemu_machine($vmid);
 
         # if we delete the first snasphot, we commit because the first snapshot original base image, it should be big.
         # improve-me: if firstsnap > child : commit, if firstsnap < child do a stream.
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* Re: [pve-devel] [PATCH qemu-server] snapshot create/delete: die early for snapshot-as-volume-chain for pre-10.0 machine version
  2025-08-07 10:47 [pve-devel] [PATCH qemu-server] snapshot create/delete: die early for snapshot-as-volume-chain for pre-10.0 machine version Fiona Ebner
@ 2025-08-07 12:04 ` Hannes Laimer
  2025-08-07 12:32 ` [pve-devel] applied: " Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Hannes Laimer @ 2025-08-07 12:04 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fiona Ebner

Could reproduce the problem described in [0], patch works as advertised,
so consider this

Tested-by: Hannes Laimer <h.laimer@proxmox.com>

On 07.08.25 12:48, Fiona Ebner wrote:
> As reported in the community forum [0], a running VM with pre-10.0
> machine version using a storage with snapshot-as-volume-chain will run
> into issues when creating a snapshot. Similarly deleting the snapshot
> of such a VM would fail. Having '-blockdev' is a hard requirement for
> the implementation of the snapshot-as-volume-chain feature for running
> VMs, so die and suggest upgrading the machine version.
> 
> [0]: https://forum.proxmox.com/threads/lvm-thick-with-iscsi-pve-9-0-3.169319/
> 
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>   src/PVE/QemuServer.pm | 15 +++++++++++++--
>   1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
> index d42e2115..e30b27cb 100644
> --- a/src/PVE/QemuServer.pm
> +++ b/src/PVE/QemuServer.pm
> @@ -4447,12 +4447,17 @@ sub qemu_volume_snapshot {
>           print "internal qemu snapshot\n";
>           mon_cmd($vmid, 'blockdev-snapshot-internal-sync', device => $deviceid, name => $snap);
>       } elsif ($do_snapshots_type eq 'external') {
> +        my $machine_version = PVE::QemuServer::Machine::get_current_qemu_machine($vmid);
> +        if (!PVE::QemuServer::Machine::is_machine_version_at_least($machine_version, 10, 0)) {
> +            die "storage for '$volid' is configured for snapshots as a volume chain - this requires"
> +                . " QEMU machine version >= 10.0. See"
> +                . " https://pve.proxmox.com/wiki/QEMU_Machine_Version_Upgrade\n";
> +        }
>           my $storeid = (PVE::Storage::parse_volume_id($volid))[0];
>           my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
>           print "external qemu snapshot\n";
>           my $snapshots = PVE::Storage::volume_snapshot_info($storecfg, $volid);
>           my $parent_snap = $snapshots->{'current'}->{parent};
> -        my $machine_version = PVE::QemuServer::Machine::get_current_qemu_machine($vmid);
>           PVE::QemuServer::Blockdev::blockdev_external_snapshot(
>               $storecfg, $vmid, $machine_version, $deviceid, $drive, $snap, $parent_snap,
>           );
> @@ -4489,6 +4494,13 @@ sub qemu_volume_snapshot_delete {
>               name => $snap,
>           );
>       } elsif ($do_snapshots_type eq 'external') {
> +        my $machine_version = PVE::QemuServer::Machine::get_current_qemu_machine($vmid);
> +        if (!PVE::QemuServer::Machine::is_machine_version_at_least($machine_version, 10, 0)) {
> +            die "storage for '$volid' is configured for snapshots as a volume chain - this requires"
> +                . " QEMU machine version >= 10.0. See"
> +                . " https://pve.proxmox.com/wiki/QEMU_Machine_Version_Upgrade\n";
> +        }
> +
>           print "delete qemu external snapshot\n";
>   
>           my $path = PVE::Storage::path($storecfg, $volid);
> @@ -4499,7 +4511,6 @@ sub qemu_volume_snapshot_delete {
>   
>           my $parentsnap = $snapshots->{$snap}->{parent};
>           my $childsnap = $snapshots->{$snap}->{child};
> -        my $machine_version = PVE::QemuServer::Machine::get_current_qemu_machine($vmid);
>   
>           # if we delete the first snasphot, we commit because the first snapshot original base image, it should be big.
>           # improve-me: if firstsnap > child : commit, if firstsnap < child do a stream.



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* [pve-devel] applied: [PATCH qemu-server] snapshot create/delete: die early for snapshot-as-volume-chain for pre-10.0 machine version
  2025-08-07 10:47 [pve-devel] [PATCH qemu-server] snapshot create/delete: die early for snapshot-as-volume-chain for pre-10.0 machine version Fiona Ebner
  2025-08-07 12:04 ` Hannes Laimer
@ 2025-08-07 12:32 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2025-08-07 12:32 UTC (permalink / raw)
  To: pve-devel, Fiona Ebner

On Thu, 07 Aug 2025 12:47:56 +0200, Fiona Ebner wrote:
> As reported in the community forum [0], a running VM with pre-10.0
> machine version using a storage with snapshot-as-volume-chain will run
> into issues when creating a snapshot. Similarly deleting the snapshot
> of such a VM would fail. Having '-blockdev' is a hard requirement for
> the implementation of the snapshot-as-volume-chain feature for running
> VMs, so die and suggest upgrading the machine version.
> 
> [...]

Applied, thanks!

[1/1] snapshot create/delete: die early for snapshot-as-volume-chain for pre-10.0 machine version
      commit: 6b2b45fd0db94a49324a0af3ed5b1e550602099a


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

end of thread, other threads:[~2025-08-07 12:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-07 10:47 [pve-devel] [PATCH qemu-server] snapshot create/delete: die early for snapshot-as-volume-chain for pre-10.0 machine version Fiona Ebner
2025-08-07 12:04 ` Hannes Laimer
2025-08-07 12:32 ` [pve-devel] applied: " Thomas Lamprecht

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