[lxc-users] Polling for LXD to become available
Stéphane Graber
stgraber at ubuntu.com
Thu Nov 12 16:17:22 UTC 2015
Yeah, what you're running into I think is the certificate generation
code taking a little while and so holding up the first LXD start.
We probably ought to have a new internal command which waits for LXD to
be ready before returning, then we could hook that up in our init
scripts, fixing this issue for you.
In the mean time, you can do something like:
while :; do
lxc finger >/dev/null 2>&1 && break
done
On Thu, Nov 12, 2015 at 08:31:52AM -0600, Casey Marshall wrote:
> Hi,
> I'm writing a Juju charm that installs LXD and sets up images in the
> install hook. When it tries to import an image after LXD is installed, I
> sometimes get an error "LXD isn't running".
>
> Retrying works, so I just need to poll or wait for LXD to come up
> completely. What would be a nice way to check for this in my install script?
>
> I'm installing LXD from ppc:ubuntu-lxc/lxd-stable:
> ii lxd
> 0.21-0ubuntu3~ubuntu14.04.1~ppa1 amd64 Container hypervisor
> based on LXC - daemon
> ii lxd-client
> 0.21-0ubuntu3~ubuntu14.04.1~ppa1 amd64 Container hypervisor
> based on LXC - client
>
> Thanks,
> Casey
>
> 2015-11-12 12:27:42 INFO install lxd start/running, process 18576
> 2015-11-12 12:27:44 INFO install Processing triggers for libc-bin
> (2.19-0ubuntu6.6) ...
> 2015-11-12 12:27:44 INFO install Processing triggers for ureadahead
> (0.100.0-16) ...
> 2015-11-12 12:27:45 INFO install Adding user ubuntu to group lxd
> 2015-11-12 12:27:46 INFO install LXD isn't running.
> 2015-11-12 12:27:46 INFO install Traceback (most recent call last):
> 2015-11-12 12:27:46 INFO install File
> "/var/lib/juju/agents/unit-juju-client-0/charm/hooks/install", line
> 14, in <module>
> 2015-11-12 12:27:46 INFO install main()
> 2015-11-12 12:27:46 INFO install File
> "lib/charms/reactive/__init__.py", line 64, in main
> 2015-11-12 12:27:46 INFO install bus.dispatch()
> 2015-11-12 12:27:46 INFO install File "lib/charms/reactive/bus.py",
> line 397, in dispatch
> 2015-11-12 12:27:46 INFO install _invoke(hook_handlers)
> 2015-11-12 12:27:46 INFO install File "lib/charms/reactive/bus.py",
> line 388, in _invoke
> 2015-11-12 12:27:46 INFO install handler.invoke()
> 2015-11-12 12:27:46 INFO install File "lib/charms/reactive/bus.py",
> line 269, in invoke
> 2015-11-12 12:27:46 INFO install self._action(*args)
> 2015-11-12 12:27:46 INFO install File
> "/var/lib/juju/agents/unit-juju-client-0/charm/reactive/juju-client.py",
> line 19, in install
> 2015-11-12 12:27:46 INFO install check_call(['lxd-images',
> 'import', 'ubuntu', '--alias', 'ubuntu'])
> 2015-11-12 12:27:46 INFO install File
> "/usr/lib/python2.7/subprocess.py", line 540, in check_call
> 2015-11-12 12:27:46 INFO install raise CalledProcessError(retcode, cmd)
> 2015-11-12 12:27:46 INFO install subprocess.CalledProcessError:
> Command '['lxd-images', 'import', 'ubuntu', '--alias', 'ubuntu']'
> returned non-zero exit status 1
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20151112/19402210/attachment.sig>
More information about the lxc-users
mailing list