mirror of
https://git.proxmox.com/git/qemu-server
synced 2026-01-06 17:58:05 +00:00
fix snapshot permissions - check for VM.Snapshot
This commit is contained in:
parent
8abd398b8a
commit
f1baf1df42
@ -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);
|
||||
|
||||
@ -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",
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user