Quoting Christian Brauner (christianvanbrau...@gmail.com): > diff --git a/src/lxc/conf.h b/src/lxc/conf.h > index dc5328a..6e75713 100644 > --- a/src/lxc/conf.h > +++ b/src/lxc/conf.h > @@ -370,6 +370,9 @@ struct lxc_conf { > * should run under when using lxc-execute */ > uid_t init_uid; > gid_t init_gid; > + > + /* transient */ > + int transient; > }; > > #ifdef HAVE_TLS > diff --git a/src/lxc/confile.c b/src/lxc/confile.c > index ca3b8d8..356d85f 100644 > --- a/src/lxc/confile.c > +++ b/src/lxc/confile.c > @@ -108,6 +108,8 @@ static int config_environment(const char *, const char *, > struct lxc_conf *); > static int config_init_cmd(const char *, const char *, struct lxc_conf *); > static int config_init_uid(const char *, const char *, struct lxc_conf *); > static int config_init_gid(const char *, const char *, struct lxc_conf *); > +static int config_transient(const char *key, const char *value, > + struct lxc_conf *lxc_conf); > > static struct lxc_config_t config[] = { > > @@ -176,6 +178,7 @@ static struct lxc_config_t config[] = { > { "lxc.init_cmd", config_init_cmd }, > { "lxc.init_uid", config_init_uid }, > { "lxc.init_gid", config_init_gid }, > + { "lxc.transient", config_transient }, > }; > > struct signame { > @@ -2490,6 +2493,8 @@ int lxc_get_config_item(struct lxc_conf *c, const char > *key, char *retv, > return lxc_get_conf_int(c, retv, inlen, c->init_uid); > else if (strcmp(key, "lxc.init_gid") == 0) > return lxc_get_conf_int(c, retv, inlen, c->init_gid); > + else if (strcmp(key, "lxc.transient") == 0) > + return lxc_get_conf_int(c, retv, inlen, c->transient); > else return -1; > > if (!v) > @@ -2759,3 +2764,14 @@ bool network_new_hwaddrs(struct lxc_conf *conf) > } > return true; > } > + > +static int config_transient(const char *key, const char *value, > + struct lxc_conf *lxc_conf) > +{ > + int v = atoi(value); > + > + lxc_conf->transient = v; > + > + return 0; > +} > + > diff --git a/src/lxc/start.c b/src/lxc/start.c > index ffb8d12..e551ca4 100644 > --- a/src/lxc/start.c > +++ b/src/lxc/start.c > @@ -495,6 +495,20 @@ void lxc_fini(const char *name, struct lxc_handler > *handler) > close(handler->ttysock[0]); > close(handler->ttysock[1]); > } > + if (handler->conf->transient > 0) { > + char *check_rootfs = handler->conf->rootfs.path; > + if (strncmp(check_rootfs, "overlayfs:", 10) == 0) { > + int ret; > + char destroy[MAXPATHLEN]; > + ret = snprintf(destroy, MAXPATHLEN, "%s/%s", > handler->lxcpath, name); > + if (ret < 0)
We probably couldn't get to this point if the name was too long, but just for completeness' sake it'd be nice to the typical if (ret < 0 || ret >= MAXPATHLEN) here. > + ERROR("Error creating string"); > + INFO(destroy); > + ret = lxc_rmdir_onedev(destroy, NULL); > + if (ret < 0) > + ERROR("Destroying container failed"); > + } > + } > cgroup_destroy(handler); > free(handler); > } > -- > 2.5.1 > _______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel