From 253624c76fba797a69b75a13da1de21d4f50a8b4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabian=20Gr=C3=BCnbichler?= Date: Mon, 15 May 2017 14:11:56 +0200 Subject: [PATCH] config: add vmstatestorage option MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit and permission checks Signed-off-by: Fabian Grünbichler --- PVE/API2/Qemu.pm | 7 +++++++ PVE/QemuServer.pm | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 869eb8c..2c32648 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -78,6 +78,9 @@ my $check_storage_access = sub { PVE::Storage::check_volume_access($rpcenv, $authuser, $storecfg, $vmid, $volid); } }); + + $rpcenv->check($authuser, "/storage/$settings->{vmstatestorage}", ['Datastore.AllocateSpace']) + if defined($settings->{vmstatestorage}); }; my $check_storage_access_clone = sub { @@ -114,6 +117,9 @@ my $check_storage_access_clone = sub { } }); + $rpcenv->check($authuser, "/storage/$conf->{vmstatestorage}", ['Datastore.AllocateSpace']) + if defined($conf->{vmstatestorage}); + return $sharedvm; }; @@ -257,6 +263,7 @@ my $vmpoweroptions = { my $diskoptions = { 'boot' => 1, 'bootdisk' => 1, + 'vmstatestorage' => 1, }; my $check_vm_modify_config_perm = sub { diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 03e7ca4..e3169b6 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -477,6 +477,10 @@ EODESCR type => 'string', format => 'pve-volume-id', description => "Reference to a volume which stores the VM state. This is used internally for snapshots.", }, + vmstatestorage => get_standard_option('pve-storage-id', { + description => "Default storage for VM state volumes/files.", + optional => 1, + }), machine => { description => "Specific the Qemu machine type.", type => 'string', -- 2.39.2