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> --- Notes: no changes v1 -> v2 src/PVE/GuestHelpers.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/PVE/GuestHelpers.pm b/src/PVE/GuestHelpers.pm index 961a7b8..bd94ed2 100644 --- a/src/PVE/GuestHelpers.pm +++ b/src/PVE/GuestHelpers.pm @@ -416,4 +416,22 @@ sub check_vnet_access { if !($tag || $trunks); } +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.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel