From 2a2aa29d1347c73ed6813ac335818d22adc5f53c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Mon, 11 Mar 2024 02:13:19 -0400 Subject: [PATCH] resource/instance: Check PID not processes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With virtual machines that don't run our agent, Processes will remain 0 forever. As the check is really meant to make sure that the instance has started, checking for the PID should be more reliable. Signed-off-by: Stéphane Graber --- internal/instance/resource_instance.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/instance/resource_instance.go b/internal/instance/resource_instance.go index c3c94b9..50f306f 100644 --- a/internal/instance/resource_instance.go +++ b/internal/instance/resource_instance.go @@ -1080,7 +1080,7 @@ func waitForState(ctx context.Context, refreshFunc retry.StateRefreshFunc, targe // for virtual machines, which can report this metric only if the Incus agent has // started and has established a connection to the Incus server. func isInstanceOperational(s api.InstanceState) bool { - return isInstanceRunning(s) && s.Processes > 0 + return isInstanceRunning(s) && s.Pid > 0 } // isInstanceRunning returns true if its status is either "Running" or "Ready".