mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-01 08:05:24 +00:00
api: allow to clear vmstate actively
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>
This commit is contained in:
parent
6afb679477
commit
546644e23d
@ -1091,6 +1091,15 @@ my $update_vm_api = sub {
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user