Open yhaliaw opened 1 year ago
I can't really comment on pylxd/ws4py, but for the LXD agent, you need to setup some kind of loop to see when the VM is connected. LXD itself doesn't know when the agent is ready as that would require frequent polling of all the VMs. Instead it just tries to interact with the agent as needed.
In shell, you'd probably want to do something like:
lxc list -cN -fcsv NAME
If you get -1
, no agent is responding, if you get a value higher than 0, then you're talking to an agent.
An alternative is a busy loop of lxc exec NAME /bin/true 2>/dev/null
@yhaliaw, are you using pylxd
package available from pip? In my case #376 all errors were caused by an ols bug with pip version of the package. Try to use latest package from GitHub repo and check if this solves your issue.
P.S. Here's the command to install latest pylxd
package
pip install git+https://github.com/lxc/pylxd
Encountering errors in the log when executing commands in virtual machine instance. Python script, env info, and sample logs is included in the end.
A virtual machine instance is created and started with
wait=True
. Executing commands withexecute
will return with return code-1
. File operations will still fail withLXD VM agent isn't currently running
.This part seems to be related to LXD VM agent. Is there a way to ensure it is running after instance is started with
wait=True
?After the LXD VM agent seems to be running as file operation no longer fails, logs such as the follow can still be observed when executing commands:
environment: ubuntu-22.04
package versions:
Script:
Sample log: