Changes v3 (only changes in the commit message): (1) Make it explicit that the flag -e / --ephemeral starts ephemeral containers. (2) Fix missing -e flag in examples (c) and (d). (3) Fix example (d). The flag to create a non-ephemeral container is -D and not -K. (4) Add some more exampled to illustrate -D, -K, and -M flags.
Changes v2: (1) The mkdtemp() call accidently created a directory in the current working directory of the shell it was called in. This is now fixed by correctly creating the full path first and then using the offset strlen(my_args->newpath) + 1 to point my_args->newname to the name of the container: ret = snprintf(randname, MAXPATHLEN, "%s/%s_XXXXXX", my_args->newpath, my_args->name); if (ret < 0 || ret >= MAXPATHLEN) return -1; if (!mkdtemp(randname)) return -1; my_args->newname = randname + strlen(my_args->newpath) + 1; Changes in comparison to first implementation: (1) Instead of using a custom function to generate random names for ephemeral container we use mkdtemp(). This will be safer and the code considerably easier. (2) Make the whole code easily extendable by using a design centered around a struct and an enum. The current design will allow us to add further mount types should we want to: enum mnttype { LXC_MNT_BIND, LXC_MNT_AUFS, LXC_MNT_OVL, }; struct mnts { enum mnttype type; char *src; char *dest; char *options; char *upper; char *workdir; char *lower; }; (E.g. lowerdir is currently not used but we could in the future allow users to specify multiple lowerdirs on the command line. All we would have to do is to extend the corresponding parse function parse_ovl_mnt().) (3) We use getsubopt() to parse the custom mounts user can specify with the -m flag and the keys {aufs,bind,overlay}. This will avoid redundancy because users do not have to specify multiple -m flags but can rather just do -m bind=/a:/b,overlay/c:/d etc. Furthermore, it will allow us to add further keys rather easily. (4) There is a branch lxccopy on github for easier testing: https://github.com/brauner/lxc/tree/lxccopy Serge, I wonder how many bugs you will find. :) Christian Brauner (1): Add lxc-copy executable src/lxc/Makefile.am | 2 + src/lxc/arguments.h | 2 + src/lxc/lxc_copy.c | 744 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 748 insertions(+) create mode 100644 src/lxc/lxc_copy.c -- 2.6.2 _______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel