[pve-devel] [PATCH access-control 2/4] allow setting stoptime via active_workers

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Jul 28 15:32:42 CEST 2016


---
 PVE/RPCEnvironment.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/PVE/RPCEnvironment.pm b/PVE/RPCEnvironment.pm
index ece0745..95bb83f 100644
--- a/PVE/RPCEnvironment.pm
+++ b/PVE/RPCEnvironment.pm
@@ -624,8 +624,9 @@ sub is_worker {
 # but keep aktive and most recent task in the active file.
 # $nocheck ... consider $new_upid still running (avoid that
 # we try to read the reult to early.
+# $stoptime ... record (first) stop attempt for $new_upid
 sub active_workers  {
-    my ($new_upid, $nocheck) = @_;
+    my ($new_upid, $nocheck, $stoptime) = @_;
 
     my $lkfn = "/var/log/pve/tasks/.active.lock";
 
@@ -665,6 +666,11 @@ sub active_workers  {
 	    &$check_task($task, $nocheck);
 	}
 
+	if ($new_upid && $stoptime) {
+	    my $task = $thash->{$new_upid};
+	    $task->{stoptime} = $stoptime
+		if $task && !$task->{stoptime};
+	}
 
 	@ta = sort { $b->{starttime} cmp $a->{starttime} } @ta;
 
-- 
2.1.4




More information about the pve-devel mailing list