[Lxc-users] lxc-execute-ephemeral-repeatedly ?

Dan Kegel dank at kegel.com
Tue Aug 28 18:23:33 UTC 2012


While trying to write the script that will start my buildslaves,
this occurred to me as a possible appropriate building block:

lxc-execute-ephemeral-repeatedly --orig name [-d] [--log logfile] [-p
pidfile] [-- command-to-run]

This would run a new ephemeral container cloned from 'name', wait for
it to exit, and repeat forever.
Stopping the new ephemeral container is awkward; there's no one name
to pass to lxc-stop,
so to stop it, send a SIGHUP to the process with pid `cat pidfile`.

Example:
 given an image 'centos6slave' containing some custom command 'do-work.sh',
 set up two persistantly ephemeral virtual machines, one building and
one testing,
 let them run for five minutes, then shut them both down.
   lxc-execute-ephemeral-repeatedly --orig centos6slave -d -p
builder.pid -- do-work.sh --role=build
   lxc-execute-ephemeral-repeatedly --orig centos6slave -d -p
tester.pid -- do-work.sh --role=test
   sleep 600
   kill -HUP `cat builder.pid`
   kill -HUP `cat tester.pid`

I can probably build this on top of lxc-start-ephemeral.

I'll go code that now and try to use it.  (And probably come back with
something different.)

Just writing this message clarified what I want a bit, but comments
from non-imaginary readers
would also be welcome.  Especially on the crappy interface for
stopping one of these beasts.

(Alternately, I could go the libvirt approach and let buildbot manage them, but
adding the libvirt layer on top of things seems risky offhand at the moment.)




More information about the lxc-users mailing list