Unverified Commit 594426ca by Christian Brauner Committed by Stéphane Graber

conf: expand shmounts lxc.mount.auto option

Allow users to specify a path in the container they want to use. This will help LXD. Needed-by: https://github.com/lxc/lxd/issues/5227Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 007ef61a
...@@ -1788,18 +1788,24 @@ static int set_config_mount_auto(const char *key, const char *value, ...@@ -1788,18 +1788,24 @@ static int set_config_mount_auto(const char *key, const char *value,
lxc_conf->auto_mounts |= allowed_auto_mounts[i].flag; lxc_conf->auto_mounts |= allowed_auto_mounts[i].flag;
if (is_shmounts) { if (is_shmounts) {
lxc_conf->shmount.path_host = strdup(token + STRLITERALLEN("shmounts:")); char *slide = token + STRLITERALLEN("shmounts:");
if (!lxc_conf->shmount.path_host) {
if (*slide == '\0') {
SYSERROR("Failed to copy shmounts host path"); SYSERROR("Failed to copy shmounts host path");
goto on_error; goto on_error;
} }
if (strcmp(lxc_conf->shmount.path_host, "") == 0) { lxc_conf->shmount.path_host = strdup(slide);
ERROR("Invalid shmounts path: empty"); if (!lxc_conf->shmount.path_host) {
SYSERROR("Failed to copy shmounts host path");
goto on_error; goto on_error;
} }
lxc_conf->shmount.path_cont = strdup("/dev/.lxc-mounts"); slide = strchr(slide, ':');
if (!slide || *(++slide) == '\0')
slide = "/dev/.lxc-mounts";
lxc_conf->shmount.path_cont = strdup(slide);
if(!lxc_conf->shmount.path_cont) { if(!lxc_conf->shmount.path_cont) {
SYSERROR("Failed to copy shmounts container path"); SYSERROR("Failed to copy shmounts container path");
goto on_error; goto on_error;
......
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