Sometimes we use: lxc-create -n xxx -f config to copy config to the default lxcpath with the rootfs already exist. But we will get error right now, so fix this.
Signed-off-by: Qiang Huang <h.huangqi...@huawei.com> --- src/lxc/lxccontainer.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 79237df..e8436cc 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -1018,9 +1018,15 @@ static bool lxcapi_create(struct lxc_container *c, const char *t, goto out; } - /* container is already created if we have a config and rootfs.path is accessible */ - if (lxcapi_is_defined(c) && c->lxc_conf && c->lxc_conf->rootfs.path && access(c->lxc_conf->rootfs.path, F_OK) == 0) + /* + * Container is already created if we have a config and rootfs.path + * is accessible. We'll conside lxc_create succeed in this condition. + */ + if (lxcapi_is_defined(c) && c->lxc_conf && c->lxc_conf->rootfs.path && + access(c->lxc_conf->rootfs.path, F_OK) == 0) { + bret = true; goto out; + } /* Mark that this container is being created */ if ((partial_fd = create_partial(c)) < 0) -- 1.8.3 ------------------------------------------------------------------------------ LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel