<div dir="ltr">Hi there,<div><br></div><div>I was trying to use lxc-autostart (v1.0.7, but git-master is the same) and realised containers are started in reverse order.</div><div><br></div><div>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.<br></div><div><br></div><div>Anyway, I looked into src/lxc/lxc_autostart.c, and found this:</div><div><br></div><div># in main() this is called:</div><div>qsort(&containers[0], count, sizeof(struct lxc_container *), cmporder);<br></div><div><br></div><div># in cmporder() the last comparison looks like this:</div><div>return (c1_order - c2_order) * -1;<br></div><div><br></div><div>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.</div><div><br></div><div>I've submitted a pull request on github for this: <a href="https://github.com/lxc/lxc/pull/461">https://github.com/lxc/lxc/pull/461</a></div><div><br></div><div>b.</div><div><br></div></div>