[lxc-users] Polling for LXD to become available
Casey Marshall
casey.marshall at canonical.com
Thu Nov 12 14:31:52 UTC 2015
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20151112/fed48725/attachment.html>
More information about the lxc-users
mailing list