[pve-devel] [PATCH pve-container 2/2] clone: check storage permissions

Dietmar Maurer dietmar at proxmox.com
Tue Mar 20 12:19:13 CET 2018


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 src/PVE/API2/LXC.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 128a89b..0c9ee40 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -1326,6 +1326,13 @@ __PACKAGE__->register_method({
 
 			if ($mp->{type} eq 'volume') {
 			    my $volid = $mp->{volume};
+
+			    my ($sid, $volname) = PVE::Storage::parse_volume_id($volid);
+			    $sid = $storage if defined($storage);
+			    my $scfg = PVE::Storage::storage_config($storecfg, $sid);
+
+			    $rpcenv->check($authuser, "/storage/$sid", ['Datastore.AllocateSpace']);
+
 			    if ($full) {
 				die "Cannot do full clones on a running container without snapshots\n"
 				    if $running && !defined($snapname);
-- 
2.11.0




More information about the pve-devel mailing list