This helper is used to abort any active qmshutdown/vzshutdown tasks before attempting to stop a VM/CT (if requested).
Signed-off-by: Friedrich Weber <f.we...@proxmox.com> --- src/PVE/GuestHelpers.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/PVE/GuestHelpers.pm b/src/PVE/GuestHelpers.pm index b4ccbaa..3cdf5d7 100644 --- a/src/PVE/GuestHelpers.pm +++ b/src/PVE/GuestHelpers.pm @@ -366,4 +366,22 @@ sub get_unique_tags { return !$no_join_result ? join(';', $res->@*) : $res; } +sub overrule_tasks { + my ($type, $user, $vmid) = @_; + + my $active_tasks = PVE::INotify::read_file('active'); + my $res = []; + for my $task (@$active_tasks) { + if (!$task->{saved} + && $task->{type} eq $type + && $task->{user} eq $user + && $task->{id} eq $vmid + ) { + PVE::RPCEnvironment->check_worker($task->{upid}, 1); + push @$res, $task->{upid}; + } + } + return $res; +} + 1; -- 2.30.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel