Sometimes, a user wants to remove the 'suspended' state without
resuming the vm from that state. Since the vm is locked with
'suspended', this was not possible without help from root@pam
This patch allows to delete the vmstate and the suspended lock and
related config entries with it. The user still has to have the right
priviliges and the vm cannot be 'protected' for this to work
Inspired-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
die "checksum missmatch (file change by other user?)\n"
if $digest && $digest ne $conf->{digest};
+ # FIXME: 'suspended' lock should probabyl be a state or "weak" lock?!
+ if (scalar(@delete) && grep { $_ eq 'vmstate'} @delete) {
+ if (defined($conf->{lock}) && $conf->{lock} eq 'suspended') {
+ delete $conf->{lock}; # for check lock check, not written out
+ push @delete, 'lock'; # this is the real deal to write it out
+ }
+ push @delete, 'runningmachine' if $conf->{runningmachine};
+ }
+
PVE::QemuConfig->check_lock($conf) if !$skiplock;
foreach my $opt (keys %$revert) {