Hi. I start VMs programmatically and want to execute some commands right after they start. But create instance operation returns much earlier. When I try to execute a command inside the container it says that lxd-agent isn’t running. Is there a way to check if lxd agent is ready to accept commands except try to execute the command until it succeeds?
I believe looking for the instance PID should work, it will show -1 until the agent responds. But this is very similar to just running an
lxc exec with
/bin/true and waiting for it to return 0.
Basically, LXD doesn’t know if the agent is running or not until it tries to connect to it.
Whether you do that through
lxc exec or
lxc info doesn’t really matter.