From: David Ward Date: Tue, 23 Jun 2015 14:57:39 +0000 (-0400) Subject: Fix container creation without a rootfs X-Git-Tag: lxc-1.0.8~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c99596fd782f7e3e8cd002cad2263a426fe59555;p=thirdparty%2Flxc.git Fix container creation without a rootfs It is not an error to create a container without a template or rootfs. Signed-off-by: David Ward Acked-by: Serge E. Hallyn --- diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index f962fb9bd..7b6609047 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -1289,13 +1289,18 @@ static bool lxcapi_create(struct lxc_container *c, const char *t, goto free_tpath; /* - * either template or rootfs.path should be set. * if both template and rootfs.path are set, template is setup as rootfs.path. * container is already created if we have a config and rootfs.path is accessible */ - if (!c->lxc_conf->rootfs.path && !tpath) - /* no template passed in and rootfs does not exist: error */ + if (!c->lxc_conf->rootfs.path && !tpath) { + /* no template passed in and rootfs does not exist */ + if (!c->save_config(c, NULL)) { + ERROR("failed to save starting configuration for %s\n", c->name); + goto out; + } + ret = true; goto out; + } if (c->lxc_conf->rootfs.path && access(c->lxc_conf->rootfs.path, F_OK) != 0) /* rootfs passed into configuration, but does not exist: error */ goto out;