[lxc-devel] lxc.start.order bug - containers started in reverse order
stgraber at ubuntu.com
Mon Apr 6 15:46:19 UTC 2015
On Wed, Mar 04, 2015 at 08:18:08PM +0100, Bostjan Skufca wrote:
> Hi there,
> I was trying to use lxc-autostart (v1.0.7, but git-master is the same) and
> realised containers are started in reverse order.
> As configuration parameter is called lxc.start.ORDER, one expects that
> container with order setting "1" will start before container with order
> setting set to "2", but this is not the case. Containers start in reverse
> order. If that is the desired behaviour, then I believe "order" should be
> called "priority" or sth.
> Anyway, I looked into src/lxc/lxc_autostart.c, and found this:
> # in main() this is called:
> qsort(&containers, count, sizeof(struct lxc_container *), cmporder);
> # in cmporder() the last comparison looks like this:
> return (c1_order - c2_order) * -1;
> qsort() sorts elements from lower to higher value, using callback
> cmporder(). Therefore cmporder() should return negative value if container
> c1 should be started before c2. That "* -1" achieves exactly the oposite
> result, as it causes containers to be sorted in descending order regarding
> to their order setting.
> I've submitted a pull request on github for this:
As nobody complained, I've now merged the change.
Note that I will not be pushing this to earlier releases as that'd be a
clear change of behavior for existing setups (even though the new order
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: Digital signature
More information about the lxc-devel