[pve-devel] [RFC v6 qemu-server] VM protection mode

Dietmar Maurer dietmar at proxmox.com
Thu Sep 10 18:44:22 CEST 2015


> @@ -889,6 +897,7 @@ my $update_vm_api  = sub {
>  		$modified->{$opt} = 1;
>  		$conf = PVE::QemuServer::load_config($vmid); # update/reload
>  		if ($opt =~ m/^unused/) {
> +		    &$check_protection($conf, "can't remove VM $vmid storage");

strange error message, because you remove a 'volume' (or disk), not a 'storage'.


>  		    $rpcenv->check_vm_perm($authuser, $vmid, undef, ['VM.Config.Disk']);
>  		    my $drive = PVE::QemuServer::parse_drive($opt, $conf->{$opt});
>  		    if (PVE::QemuServer::try_deallocate_drive($storecfg, $vmid, $conf,
> $opt, $drive, $rpcenv, $authuser)) {
> @@ -896,11 +905,14 @@ my $update_vm_api  = sub {
>  			PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
>  		    }
>  		} elsif (PVE::QemuServer::valid_drivename($opt)) {
> +		    &$check_protection($conf, "can't remove VM $vmid storage");

you remove a 'disk' (or 'drive'), but not a 'storage'.

>  		    $rpcenv->check_vm_perm($authuser, $vmid, undef, ['VM.Config.Disk']);
>  		    PVE::QemuServer::vmconfig_register_unused_drive($storecfg, $vmid,
> $conf, PVE::QemuServer::parse_drive($opt, $conf->{pending}->{$opt}))
>  			if defined($conf->{pending}->{$opt});
>  		    PVE::QemuServer::vmconfig_delete_pending_option($conf, $opt, $force);
>  		    PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
> +		} elsif ($opt eq 'protection') {
> +		    &$check_protection($conf, "can't delete VM $vmid protection option");

Is this really helpful? Why do you think

# qm set <vmid> --protection 0

is better than

# qm set <vmid> --delete protection

IMHO both things are similar? 

Note: Some of our GUI widgets automatically send delete instead
of setting the default value, so that can produce unexpected
side effects.




More information about the pve-devel mailing list