From bcfe31d0ce38ff2e074676b7f6ba8a55a1cb0ae4 Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Mon, 19 Jan 2015 05:06:55 +0000 Subject: [PATCH] yet another problem with new overlay fs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It turns out that the new upstream overlay fs requires that the delta and work dirs be under the same mount. So create a $lxcpath/tmpfs and create delta0 and work0 under that. If the user asks for a tmpfs that'll be mounted under $lxcpath/tmpfs and workdir and delta0 both created under that. This isn't heavily tested. But if fixes mounting of 'overlay' fs for me. It's "not backward compatible", since it moves delta0, but that shouldn't matter since ephemeral containers are either destroyed on exit, or re-started with lxc-start. Signed-off-by: Serge Hallyn Acked-by: Stéphane Graber --- src/lxc/lxc-start-ephemeral.in | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/lxc/lxc-start-ephemeral.in b/src/lxc/lxc-start-ephemeral.in index 1a6480a62..fb5eaf76d 100644 --- a/src/lxc/lxc-start-ephemeral.in +++ b/src/lxc/lxc-start-ephemeral.in @@ -156,6 +156,7 @@ dest = lxc.Container(os.path.basename(dest_path), args.lxcpath) dest.load_config(orig.config_file_name) dest.set_config_item("lxc.utsname", dest.name) dest.set_config_item("lxc.rootfs", os.path.join(dest_path, "rootfs")) +print("setting rootfs to .%s.", os.path.join(dest_path, "rootfs")) for nic in dest.network: if hasattr(nic, 'hwaddr'): nic.hwaddr = randomMAC() @@ -219,29 +220,29 @@ LXC_NAME="%s" count = 0 for entry in overlay_dirs: - target = "%s/delta%s" % (dest_path, count) - workdir = "%s/work%s" % (dest_path, count) - fd.write("mkdir -p %s %s\n" % (target, entry[1])) + deltdir = "%s/delta%s" % (tmpdir, count) + workdir = "%s/work%s" % (tmpdir, count) + fd.write("mkdir -p %s %s\n" % (deltdir, entry[1])) if have_new_overlay: fd.write("mkdir -p %s\n" % workdir) if args.storage_type == "tmpfs": - fd.write("mount -n -t tmpfs -o mode=0755 none %s\n" % (target)) - if have_new_overlay: - fd.write("mount -n -t tmpfs -o mode=0755 none %s\n" % (workdir)) + fd.write("mount -n -t tmpfs -o mode=0755 none %s\n" % (tmpdir)) + fd.write("mkdir %s\n" % deltdir) + fd.write("mkdir %s\n" % workdir) if args.union_type == "overlayfs": if have_new_overlay: fd.write("mount -n -t overlay" " -oupperdir=%s,lowerdir=%s,workdir=%s none %s\n" % ( - target, + deltdir, entry[0], workdir, entry[1])) else: fd.write("mount -n -t overlayfs" " -oupperdir=%s,lowerdir=%s none %s\n" % ( - target, + deltdir, entry[0], entry[1])) elif args.union_type == "aufs": @@ -251,7 +252,7 @@ LXC_NAME="%s" fd.write("mount -n -t aufs " "-o br=%s=rw:%s=ro,noplink,xino=%s none %s\n" % ( - target, + deltdir, entry[0], xino_path, entry[1])) -- 2.47.2