[pve-devel] [PATCH v2 qemu-server 1/5] config: add vmstatestorage option

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon May 15 14:11:56 CEST 2017


and permission checks

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
changes from v1: add permission checks

 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 43a5e4a..ce80430 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -72,6 +72,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 {
@@ -108,6 +111,9 @@ my $check_storage_access_clone = sub {
 	}
     });
 
+   $rpcenv->check($authuser, "/storage/$conf->{vmstatestorage}", ['Datastore.AllocateSpace'])
+       if defined($conf->{vmstatestorage});
+
    return $sharedvm;
 };
 
@@ -269,6 +275,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 2fb419d..03957c9 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -478,6 +478,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.1.4





More information about the pve-devel mailing list