Quoting Stéphane Graber (stgra...@ubuntu.com): > The introduction of the new console() python API broke > lxc-start-ephemeral's console(tty=1) call, I now changed that to > console() which does the right thing with both API versions. > > This also adds a new storage-type option, letting the user choose to use > a standard directory instead of tmpfs for the container (but still have > it ephemeral). > > Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
Great, thanks. Acked-by: Serge E. Hallyn <serge.hal...@ubuntu.com> > --- > src/lxc/lxc-start-ephemeral.in | 20 +++++++++++++++++--- > 1 file changed, 17 insertions(+), 3 deletions(-) > > diff --git a/src/lxc/lxc-start-ephemeral.in b/src/lxc/lxc-start-ephemeral.in > index 904f5ac..cb1f732 100644 > --- a/src/lxc/lxc-start-ephemeral.in > +++ b/src/lxc/lxc-start-ephemeral.in > @@ -85,13 +85,17 @@ parser.add_argument("--key", "-S", type=str, > parser.add_argument("--daemon", "-d", action="store_true", > help=_("run in the background")) > > +parser.add_argument("--storage-type", "-s", type=str, default=None, > + choices=("tmpfs", "dir"), > + help=("type of storage use by the container")) > + > parser.add_argument("--union-type", "-U", type=str, default="overlayfs", > choices=("overlayfs", "aufs"), > help=_("type of union (overlayfs or aufs), " > "defaults to overlayfs.")) > > parser.add_argument("--keep-data", "-k", action="store_true", > - help=_("Use a persistent backend instead of tmpfs.")) > + help=_("don't wipe everything clean at the end")) > > parser.add_argument("command", metavar='CMD', type=str, nargs="*", > help=_("Run specific command in container " > @@ -104,6 +108,16 @@ args = parser.parse_args() > if args.command and args.daemon: > parser.error(_("You can't use -d and a command at the same time.")) > > +## Check that -k isn't used with -s tmpfs > +if not args.storage_type: > + if args.keep_data: > + args.storage_type = "dir" > + else: > + args.storage_type = "tmpfs" > + > +if args.keep_data and args.storage_type == "tmpfs": > + parser.error(_("You can't use -k with the tmpfs storage type.")) > + > ## The user needs to be uid 0 > if not os.geteuid() == 0: > parser.error(_("You must be root to run this script. Try running: sudo > %s" > @@ -190,7 +204,7 @@ LXC_NAME="%s" > target = "%s/delta%s" % (dest_path, count) > fd.write("mkdir -p %s %s\n" % (target, entry[1])) > > - if not args.keep_data: > + if args.storage_type == "tmpfs": > fd.write("mount -n -t tmpfs none %s\n" % (target)) > > if args.union_type == "overlayfs": > @@ -254,7 +268,7 @@ if not dest.start() or not dest.wait("RUNNING", > timeout=5): > > # Deal with the case where we just attach to the container's console > if not args.command and not args.daemon: > - dest.console(tty=1) > + dest.console() > dest.shutdown(timeout=5) > sys.exit(0) > > -- > 1.8.3.2 > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > Lxc-devel mailing list > Lxc-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/lxc-devel ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel