diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 84db7702..38532362 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -1932,7 +1932,7 @@ __PACKAGE__->register_method({ proxyto => 'node', description => "Snapshot a VM.", permissions => { - check => ['perm', '/vms/{vmid}', [ 'VM.Config.Disk' ]], + check => ['perm', '/vms/{vmid}', [ 'VM.Snapshot' ]], }, parameters => { additionalProperties => 0, @@ -1973,10 +1973,6 @@ __PACKAGE__->register_method({ my $freezefs = extract_param($param, 'freezefs'); - # fixme: access rights? - # &$check_storage_access($rpcenv, $authuser, $storecfg, $vmid, $conf); - # fixme: need to implement a check to see if all storages support snapshots - my $realcmd = sub { PVE::Cluster::log_msg('info', $authuser, "snapshot VM $vmid: $snapname"); PVE::QemuServer::snapshot_create($vmid, $snapname, $vmstate, $freezefs); @@ -2027,7 +2023,7 @@ __PACKAGE__->register_method({ proxyto => 'node', description => "Rollback VM state to specified snapshot.", permissions => { - check => ['perm', '/vms/{vmid}', [ 'VM.Config.Disk' ]], + check => ['perm', '/vms/{vmid}', [ 'VM.Snapshot' ]], }, parameters => { additionalProperties => 0, @@ -2054,8 +2050,6 @@ __PACKAGE__->register_method({ my $snapname = extract_param($param, 'snapname'); - # fixme: access rights? - my $realcmd = sub { PVE::Cluster::log_msg('info', $authuser, "rollback snapshot VM $vmid: $snapname"); PVE::QemuServer::snapshot_rollback($vmid, $snapname); @@ -2072,7 +2066,7 @@ __PACKAGE__->register_method({ proxyto => 'node', description => "Delete a VM snapshot.", permissions => { - check => ['perm', '/vms/{vmid}', [ 'VM.Config.Disk' ]], + check => ['perm', '/vms/{vmid}', [ 'VM.Snapshot' ]], }, parameters => { additionalProperties => 0, @@ -2099,8 +2093,6 @@ __PACKAGE__->register_method({ my $snapname = extract_param($param, 'snapname'); - # fixme: access rights? - my $realcmd = sub { PVE::Cluster::log_msg('info', $authuser, "delete snapshot VM $vmid: $snapname"); PVE::QemuServer::snapshot_delete($vmid, $snapname); diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index e0be68f7..7e369d8e 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -3573,6 +3573,9 @@ my $snapshot_prepare = sub { die "snapshot name '$snapname' already used\n" if defined($conf->{snapshots}->{$snapname}); + # fixme: need to implement a check to see if all storages + # support snapshots + $snap = $conf->{snapshots}->{$snapname} = { snapstate => "prepare", };