One of the common feature request I've heard about LXC, especially from
people who are used to OpenVZ is having a variety of hooks where they
can run their own script at various point of the container lifetime.

I had a quick look at what was available on OpenVZ and worked on a list
of hooks that I think would be useful to our users:

 - mount: Is run after the rootfs and any fstab entry for the container
have been mounted but before the container is started
 - start: Is run after the container init is started
 - stop: Is run after the container died
 - umount: Is run before the rootfs and any fstab entry for the
container are unmounted

At least the mount and umount ones can be quite useful to implement
features like the ephemeral containers where you want to stack an
overlayfs container or setup bind mounts based on a script output.

All of these scripts run outside of the container's namespaces.

The above list is meant to make it easy for anyone coming from OpenVZ to
convert their setup to LXC.

Potential other hooks include pre-start and post-stop, running even
before LXC mounts/umounts the rootfs but I'm not sure I'm seeing a use
case for these right know (where they wouldn't work as "mount" hooks).

These would be configurable in the container as:
lxc.hook.<HOOK> = <PATH>

Does that sound good to everyone? Are there other hooks we should make
sure we implement? Anything else I missed?

Thanks

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to