[pve-devel] [PATCH qemu-server] fix #2367: disallow 'PENDING' as snapshot name

Dominik Csapak d.csapak at proxmox.com
Wed Sep 11 12:14:48 CEST 2019


this conflicts with our syntax of pending changes, so we have to forbid it
the check must be case-insensitive since we parse it that way from the config

this may be reverted again sometime with 7.0 if we decide to change the
name of the pending section

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Qemu.pm  | 3 +++
 PVE/QemuServer.pm | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 9db8967..9a73d04 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -3683,6 +3683,9 @@ __PACKAGE__->register_method({
 	die "unable to use snapshot name 'current' (reserved name)\n"
 	    if $snapname eq 'current';
 
+	die "unable to use snapshot name '$snapname' (reserved name)\n"
+	    if $snapname =~ m/^pending$/i;
+
 	my $realcmd = sub {
 	    PVE::Cluster::log_msg('info', $authuser, "snapshot VM $vmid: $snapname");
 	    PVE::QemuConfig->snapshot_create($vmid, $snapname, $param->{vmstate},
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 7128723..5295c22 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2834,7 +2834,7 @@ sub write_vm_config {
     &$cleanup_config($conf->{pending}, 1);
 
     foreach my $snapname (keys %{$conf->{snapshots}}) {
-	die "internal error" if $snapname eq 'pending';
+	die "internal error" if $snapname =~ m/^pending$/i;
 	&$cleanup_config($conf->{snapshots}->{$snapname}, undef, $snapname);
     }
 
-- 
2.20.1





More information about the pve-devel mailing list