otherwise a user with only VM.Config.CDROM can detach a disk from a VM
by updating it to a cdrom drive

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
this is breaking api change, but fits more in line what we would
want for the permissions

 PVE/API2/Qemu.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 057b8ff..1e540f5 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -1346,6 +1346,12 @@ my $update_vm_api  = sub {
                my $arch = PVE::QemuServer::get_vm_arch($conf);
 
                if (PVE::QemuServer::is_valid_drivename($opt)) {
+                   # old drive
+                   if ($conf->{$opt}) {
+                       $check_drive_perms->($opt, $conf->{$opt});
+                   }
+
+                   # new drive
                    $check_drive_perms->($opt, $param->{$opt});
                    PVE::QemuServer::vmconfig_register_unused_drive($storecfg, 
$vmid, $conf, PVE::QemuServer::parse_drive($opt, $conf->{pending}->{$opt}))
                        if defined($conf->{pending}->{$opt});
-- 
2.20.1



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to