[lxc-devel] [PATCH stable-1.1 7/7] Fix container creation without a rootfs
David Ward
david.ward at ll.mit.edu
Tue Jun 23 14:57:32 UTC 2015
It is not an error to create a container without a template or rootfs.
Signed-off-by: David Ward <david.ward at ll.mit.edu>
---
src/lxc/lxccontainer.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 53aec70..ff1f403 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -1276,13 +1276,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;
--
1.7.1
More information about the lxc-devel
mailing list