The -n/--name option of lxc-start-ephemeral was never implemented
even though it was documented in the manpage.

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 src/lxc/lxc-start-ephemeral.in | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/lxc/lxc-start-ephemeral.in b/src/lxc/lxc-start-ephemeral.in
index 3e2a5d3..d1bb6be 100644
--- a/src/lxc/lxc-start-ephemeral.in
+++ b/src/lxc/lxc-start-ephemeral.in
@@ -70,6 +70,9 @@ parser.add_argument("--lxcpath", "-P", dest="lxcpath", 
metavar="PATH",
 parser.add_argument("--orig", "-o", type=str, required=True,
                     help=_("name of the original container"))
 
+parser.add_argument("--name", "-n", type=str,
+                    help=_("name of the target container"))
+
 parser.add_argument("--bdir", "-b", type=str,
                     help=_("directory to bind mount into container"))
 
@@ -117,7 +120,13 @@ if not args.lxcpath:
 else:
     lxc_path = args.lxcpath
 
-dest_path = tempfile.mkdtemp(prefix="%s-" % args.orig, dir=lxc_path)
+if args.name:
+    if os.path.exists("%s/%s" % (lxc_path, args.name)):
+        parser.error(_("A container named '%s' already exists." % args.name))
+    dest_path = "%s/%s" % (lxc_path, args.name)
+    os.mkdir(dest_path)
+else:
+    dest_path = tempfile.mkdtemp(prefix="%s-" % args.orig, dir=lxc_path)
 os.mkdir(os.path.join(dest_path, "rootfs"))
 
 # Setup the new container's configuration
-- 
1.8.1.2


------------------------------------------------------------------------------
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to