Re: [lxc-devel] [PATCH 0/2] Create random workdir for overlay mounts
Quoting Christian Brauner (christianvanbrau...@gmail.com): > - When no explicit workdir is given we simply create a random workdir using > mkdtemp(). > - The temporary workdir is not removed when the container stops as it is not > obvious to me at this point how to do this cleanly. This means that it is > left > to the user to clean up old random workdirs. I don't know if this is > considered a dealbreaker for anyone. If someone has a nice idea how to > remove > the temporary workdirs (Serge?) do tell. Hm. Sorry, that's no good, I'm glad you caught that. We can't leave $number_of_runs * $number_of_overlays directories sitting around. We could just use workdir.$(echo $target | tr / _) so we can reuse it? > - Replace 4096 with LINELEN. > - Take the chance to avoid code duplication in > mount_entry_create_overlay_dirs() > and mount_entry_create_aufs_dirs(). > > Christian Brauner (2): > Simplify function > Create random workdir for overlay mounts > > src/lxc/conf.c | 45 ++--- > 1 file changed, 30 insertions(+), 15 deletions(-) > > -- > 2.6.2 > > ___ > lxc-devel mailing list > lxc-devel@lists.linuxcontainers.org > http://lists.linuxcontainers.org/listinfo/lxc-devel ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
Re: [lxc-devel] [PATCH 1/2] Simplify function
Quoting Christian Brauner (christianvanbrau...@gmail.com): > Instead of duplicating the cleanup-code, once for success and once for > failure, > simply keep a variable fret which is -1 in the beginning and gets set to 0 on > success or stays -1 on failure. > > Signed-off-by: Christian BraunerAcked-by: Serge E. Hallyn > --- > src/lxc/conf.c | 14 ++ > 1 file changed, 6 insertions(+), 8 deletions(-) > > diff --git a/src/lxc/conf.c b/src/lxc/conf.c > index 932d1a3..142444e 100644 > --- a/src/lxc/conf.c > +++ b/src/lxc/conf.c > @@ -1860,6 +1860,7 @@ static int mount_entry_create_overlay_dirs(const struct > mntent *mntent, > char *upperdir = NULL; > char *workdir = NULL; > char **opts = NULL; > + int fret = -1; > int ret = 0; > size_t arrlen = 0; > size_t dirlen = 0; > @@ -1907,14 +1908,12 @@ static int mount_entry_create_overlay_dirs(const > struct mntent *mntent, > WARN("Failed to create workdir"); > } > > - free(rootfsdir); > - lxc_free_array((void **)opts, free); > - return 0; > + fret = 0; > > err: > free(rootfsdir); > lxc_free_array((void **)opts, free); > - return -1; > + return fret; > } > > static int mount_entry_create_aufs_dirs(const struct mntent *mntent, > @@ -1928,6 +1927,7 @@ static int mount_entry_create_aufs_dirs(const struct > mntent *mntent, > char *tmp = NULL; > char *upperdir = NULL; > char **opts = NULL; > + int fret = -1; > int ret = 0; > size_t arrlen = 0; > size_t i; > @@ -1969,14 +1969,12 @@ static int mount_entry_create_aufs_dirs(const struct > mntent *mntent, > WARN("Failed to create upperdir"); > } > > - free(rootfsdir); > - lxc_free_array((void **)opts, free); > - return 0; > + fret = 0; > > err: > free(rootfsdir); > lxc_free_array((void **)opts, free); > - return -1; > + return fret; > } > > > -- > 2.6.2 > > ___ > lxc-devel mailing list > lxc-devel@lists.linuxcontainers.org > http://lists.linuxcontainers.org/listinfo/lxc-devel ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
Re: [lxc-devel] [PATCH 0/2] Create random workdir for overlay mounts
Quoting Christian Brauner (christianvanbrau...@gmail.com): > On Tue, Oct 27, 2015 at 05:26:53PM +, Serge Hallyn wrote: > > Quoting Christian Brauner (christianvanbrau...@gmail.com): > > > - When no explicit workdir is given we simply create a random workdir > > > using > > > mkdtemp(). > > > - The temporary workdir is not removed when the container stops as it is > > > not > > > obvious to me at this point how to do this cleanly. This means that it > > > is left > > > to the user to clean up old random workdirs. I don't know if this is > > > considered a dealbreaker for anyone. If someone has a nice idea how to > > > remove > > > the temporary workdirs (Serge?) do tell. > > > > Hm. Sorry, that's no good, I'm glad you caught that. We can't leave > > $number_of_runs * $number_of_overlays directories sitting around. > > We could just use workdir.$(echo $target | tr / _) so we can reuse > > it? > Hm, feels hackish.. I don't think this is worth it. Eh, but it should be unique :) I'm ok with dropping it. Thanks! -serge ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [PATCH] lxc-net: switch After target to network-online.target
Otherwise it may start too early and end up taking 10.0.3.1 even though eth0 was eventually going to end up on 10.0.3.x. https://bugs.launchpad.net/juju-core/+bug/1510619 Reported-by: Ryan HarperCc: Martin Pitt Signed-off-by: Serge Hallyn --- config/init/systemd/lxc-net.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/init/systemd/lxc-net.service.in b/config/init/systemd/lxc-net.service.in index 0467c0f..1b8ef99 100644 --- a/config/init/systemd/lxc-net.service.in +++ b/config/init/systemd/lxc-net.service.in @@ -1,6 +1,6 @@ [Unit] Description=LXC network bridge setup -After=network.target +After=network-online.target Before=lxc.service [Service] -- 2.5.0 ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [PATCH 0/2] Update absolute paths for overlay and aufs mounts
Changes: (1) Make updating lxc_conf->mnt_list and lxc_conf->unexpanded_config independent of each other so that users can include overlay mounts from other files. (2) Update lxc_conf->unexpanded_config by using a separate function clone_update_unexp_ovl_dir() in confile.c. (3) Move various temporary variables inside the lxc_list_for_each(iterator, _conf->mount_list) {*/ do stuff */} per Serge's request. (4) Use uniform exit strategy when the function fails or succeeds. Christian Brauner (2): Add clone_update_unexp_ovl_dir() function Update absolute paths for overlay and aufs mounts src/lxc/confile.c | 98 ++ src/lxc/confile.h | 3 ++ src/lxc/lxccontainer.c | 97 + 3 files changed, 198 insertions(+) -- 2.6.2 ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
Re: [lxc-devel] [PATCH 0/2] Create random workdir for overlay mounts
On Tue, Oct 27, 2015 at 05:26:53PM +, Serge Hallyn wrote: > Quoting Christian Brauner (christianvanbrau...@gmail.com): > > - When no explicit workdir is given we simply create a random workdir using > > mkdtemp(). > > - The temporary workdir is not removed when the container stops as it is not > > obvious to me at this point how to do this cleanly. This means that it is > > left > > to the user to clean up old random workdirs. I don't know if this is > > considered a dealbreaker for anyone. If someone has a nice idea how to > > remove > > the temporary workdirs (Serge?) do tell. > > Hm. Sorry, that's no good, I'm glad you caught that. We can't leave > $number_of_runs * $number_of_overlays directories sitting around. > We could just use workdir.$(echo $target | tr / _) so we can reuse > it? Hm, feels hackish.. I don't think this is worth it. signature.asc Description: PGP signature ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel