lxccontainer: handle execute containers correctly

It doesn't make sense to error out when an app container doesn't pass explicit arguments through c->start{l}(). This is especially true since we implemented lxc.execute.cmd. However, even before we could have always relied on lxc.init.cmd and errored out after that. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 8f98ac7b
...@@ -828,10 +828,6 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a ...@@ -828,10 +828,6 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
return false; return false;
} }
/* Is this app meant to be run through lxcinit, as in lxc-execute? */
if (useinit && !argv)
return false;
if (container_mem_lock(c)) if (container_mem_lock(c))
return false; return false;
conf = c->lxc_conf; conf = c->lxc_conf;
...@@ -843,15 +839,20 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a ...@@ -843,15 +839,20 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
if (!handler) if (!handler)
return false; return false;
/* If no argv was passed in, use lxc.init_cmd if provided in the if (!argv) {
* configuration if (useinit && conf->execute_cmd)
*/ argv = init_cmd = split_init_cmd(conf->execute_cmd);
if (!argv) else
argv = init_cmd = split_init_cmd(conf->init_cmd); argv = init_cmd = split_init_cmd(conf->init_cmd);
}
/* ... otherwise use default_args. */ /* ... otherwise use default_args. */
if (!argv) if (!argv) {
argv = default_args; if (useinit)
return false;
else
argv = default_args;
}
/* I'm not sure what locks we want here.Any? Is liblxc's locking enough /* I'm not sure what locks we want here.Any? Is liblxc's locking enough
* here to protect the on disk container? We don't want to exclude * here to protect the on disk container? We don't want to exclude
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment