From 7a96a068f82e0661bb2b39712b7ac735eeda38c1 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Sun, 2 Jul 2017 02:21:08 +0200 Subject: [PATCH] confile: lxc.rootfs --> lxc.rootfs.path Signed-off-by: Christian Brauner --- README.md | 2 +- doc/lxc.container.conf.sgml.in | 10 +++++----- src/lxc/confile.c | 20 ++++++++++++-------- src/lxc/lxccontainer.c | 23 ++++++++++++++++++----- src/lxc/tools/lxc_ls.c | 7 ++++++- src/tests/lxc-test-autostart | 2 +- src/tests/lxc-test-cloneconfig | 2 +- src/tests/parse_config_file.c | 11 ++++++++++- templates/lxc-alpine.in | 2 +- templates/lxc-altlinux.in | 8 ++++---- templates/lxc-archlinux.in | 4 ++-- templates/lxc-busybox.in | 6 +++--- templates/lxc-centos.in | 12 ++++++------ templates/lxc-cirros.in | 2 +- templates/lxc-debian.in | 6 +++--- templates/lxc-fedora-legacy.in | 12 ++++++------ templates/lxc-fedora.in | 10 +++++----- templates/lxc-gentoo.in | 8 ++++---- templates/lxc-openmandriva.in | 8 ++++---- templates/lxc-opensuse.in | 8 ++++---- templates/lxc-oracle.in | 2 +- templates/lxc-plamo.in | 4 ++-- templates/lxc-pld.in | 8 ++++---- templates/lxc-slackware.in | 4 ++-- templates/lxc-sparclinux.in | 2 +- templates/lxc-sshd.in | 6 +++--- templates/lxc-ubuntu-cloud.in | 6 +++--- templates/lxc-ubuntu.in | 6 +++--- templates/lxc-voidlinux.in | 4 ++-- 29 files changed, 118 insertions(+), 87 deletions(-) diff --git a/README.md b/README.md index 52c1ba456..dd03a298b 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ quite restricted. Just to highlight the two most common problems: LXC is configured via a simple set of keys. For example, -- `lxc.rootfs` +- `lxc.rootfs.path` - `lxc.mount.entry` LXC namespaces configuration keys by using single dots. This means complex diff --git a/doc/lxc.container.conf.sgml.in b/doc/lxc.container.conf.sgml.in index 4a8e0b9e6..9b9b210d4 100644 --- a/doc/lxc.container.conf.sgml.in +++ b/doc/lxc.container.conf.sgml.in @@ -1042,7 +1042,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - + @@ -1076,7 +1076,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - where to recursively bind + where to recursively bind before pivoting. This is to ensure success of the pivot_root @@ -1426,7 +1426,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA LXC_ROOTFS_MOUNT: the path to the mounted root filesystem. LXC_CONFIG_FILE: the path to the container configuration file. LXC_SRC_NAME: in the case of the clone hook, this is the original container's name. - LXC_ROOTFS_PATH: this is the lxc.rootfs entry for the container. Note this is likely not where the mounted rootfs is to be found, use LXC_ROOTFS_MOUNT for that. + LXC_ROOTFS_PATH: this is the lxc.rootfs.path entry for the container. Note this is likely not where the mounted rootfs is to be found, use LXC_ROOTFS_MOUNT for that. @@ -1662,7 +1662,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA The host relative path to the container root which has been mounted to the rootfs.mount location. - [] + [] @@ -1989,7 +1989,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA lxc.cgroup.devices.allow = b 8:0 rw lxc.mount = /etc/fstab.complex lxc.mount.entry = /lib /root/myrootfs/lib none ro,bind 0 0 - lxc.rootfs = /mnt/rootfs.complex + lxc.rootfs.path = dir:/mnt/rootfs.complex lxc.cap.drop = sys_module mknod setuid net_raw lxc.cap.drop = mac_override diff --git a/src/lxc/confile.c b/src/lxc/confile.c index 7fc97f386..d79c03793 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -91,7 +91,7 @@ lxc_config_define(fstab); lxc_config_define(rootfs_mount); lxc_config_define(rootfs_options); lxc_config_define(rootfs_backend); -lxc_config_define(rootfs); +lxc_config_define(rootfs_path); lxc_config_define(uts_name); lxc_config_define(hooks); lxc_config_define(net_type); @@ -162,13 +162,17 @@ static struct lxc_config_t config[] = { { "lxc.mount", set_config_fstab, get_config_fstab, clr_config_fstab, }, { "lxc.rootfs.mount", set_config_rootfs_mount, get_config_rootfs_mount, clr_config_rootfs_mount, }, { "lxc.rootfs.options", set_config_rootfs_options, get_config_rootfs_options, clr_config_rootfs_options, }, + { "lxc.rootfs.path", set_config_rootfs_path, get_config_rootfs_path, clr_config_rootfs_path, }, /* REMOVE IN LXC 3.0 legacy rootfs.backend key */ { "lxc.rootfs.backend", set_config_rootfs_backend, get_config_rootfs_backend, clr_config_rootfs_backend, }, - { "lxc.rootfs", set_config_rootfs, get_config_rootfs, clr_config_rootfs, }, + /* REMOVE IN LXC 3.0 + legacy rootfs key + */ + { "lxc.rootfs", set_config_rootfs_path, get_config_rootfs_path, clr_config_rootfs_path, }, /* REMOVE IN LXC 3.0 legacy utsname key @@ -2035,8 +2039,8 @@ static int set_config_includefiles(const char *key, const char *value, return lxc_config_read(value, lxc_conf, true); } -static int set_config_rootfs(const char *key, const char *value, - struct lxc_conf *lxc_conf, void *data) +static int set_config_rootfs_path(const char *key, const char *value, + struct lxc_conf *lxc_conf, void *data) { return set_config_path_item(&lxc_conf->rootfs.path, value); } @@ -3026,8 +3030,8 @@ static int get_config_mount(const char *key, char *retv, int inlen, return fulllen; } -static int get_config_rootfs(const char *key, char *retv, int inlen, - struct lxc_conf *c, void *data) +static int get_config_rootfs_path(const char *key, char *retv, int inlen, + struct lxc_conf *c, void *data) { return lxc_get_conf_str(retv, inlen, c->rootfs.path); } @@ -3440,8 +3444,8 @@ static inline int clr_config_fstab(const char *key, struct lxc_conf *c, return 0; } -static inline int clr_config_rootfs(const char *key, struct lxc_conf *c, - void *data) +static inline int clr_config_rootfs_path(const char *key, struct lxc_conf *c, + void *data) { free(c->rootfs.path); c->rootfs.path = NULL; diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 56a34941d..b0d890e83 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -1071,8 +1071,8 @@ static struct bdev *do_bdev_create(struct lxc_container *c, const char *type, return NULL; } - if (!c->set_config_item(c, "lxc.rootfs", bdev->src)) { - ERROR("Failed to set config item \"lxc.rootfs\" to \"%s\"", + if (!c->set_config_item(c, "lxc.rootfs.path", bdev->src)) { + ERROR("Failed to set config item \"lxc.rootfs.path\" to \"%s\"", bdev->src); return NULL; } @@ -2936,15 +2936,22 @@ static int copy_storage(struct lxc_container *c0, struct lxc_container *c, return -1; } - /* Append a new lxc.rootfs entry to the unexpanded config. */ + /* REMOVE IN LXC 3.0 + * legacy rootfs key + */ clear_unexp_config_line(c->lxc_conf, "lxc.rootfs", false); - if (!do_append_unexp_config_line(c->lxc_conf, "lxc.rootfs", + + /* Append a new lxc.rootfs.path entry to the unexpanded config. */ + clear_unexp_config_line(c->lxc_conf, "lxc.rootfs.path", false); + if (!do_append_unexp_config_line(c->lxc_conf, "lxc.rootfs.path", c->lxc_conf->rootfs.path)) { ERROR("Error saving new rootfs to cloned config."); return -1; } - /* Append a new lxc.rootfs.backend entry to the unexpanded config. */ + /* REMOVE IN LXC 3.0 + * legacy rootfs.backend key + */ clear_unexp_config_line(c->lxc_conf, "lxc.rootfs.backend", false); if (flags & LXC_CLONE_SNAPSHOT) @@ -3165,7 +3172,13 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char fclose(fout); goto out; } + + /* REMOVE IN LXC 3.0 + * legacy rootfs key + */ clear_unexp_config_line(c->lxc_conf, "lxc.rootfs", false); + + clear_unexp_config_line(c->lxc_conf, "lxc.rootfs.path", false); write_config(fout, c->lxc_conf); fclose(fout); c->lxc_conf->rootfs.path = origroot; diff --git a/src/lxc/tools/lxc_ls.c b/src/lxc/tools/lxc_ls.c index c8176571e..ad102886b 100644 --- a/src/lxc/tools/lxc_ls.c +++ b/src/lxc/tools/lxc_ls.c @@ -546,7 +546,12 @@ static int ls_get(struct ls **m, size_t *size, const struct lxc_arguments *args, * need a path-extractor function. We face the same * problem with the ovl_mkdir() function in * lxcoverlay.{c,h}. */ - char *curr_path = ls_get_config_item(c, "lxc.rootfs", running); + char *curr_path = ls_get_config_item(c, "lxc.rootfs.path", running); + /* REMOVE IN LXC 3.0 + legacy rootfs key + */ + if (!curr_path) + curr_path = ls_get_config_item(c, "lxc.rootfs", running); if (!curr_path) goto put_and_next; diff --git a/src/tests/lxc-test-autostart b/src/tests/lxc-test-autostart index 0d45bc70e..e5b651b3d 100755 --- a/src/tests/lxc-test-autostart +++ b/src/tests/lxc-test-autostart @@ -56,7 +56,7 @@ if [ -f /etc/lsb-release ]; then fi lxc-create -t download -n $CONTAINER_NAME -B dir -- -d ubuntu -r $release -a $ARCH -CONTAINER_PATH=$(dirname $(lxc-info -n $CONTAINER_NAME -c lxc.rootfs -H) | sed -e 's/dir://') +CONTAINER_PATH=$(dirname $(lxc-info -n $CONTAINER_NAME -c lxc.rootfs.path -H) | sed -e 's/dir://') cp $CONTAINER_PATH/config $CONTAINER_PATH/config.bak # Ensure it's not in lxc-autostart diff --git a/src/tests/lxc-test-cloneconfig b/src/tests/lxc-test-cloneconfig index 5692c170b..84e2fee97 100755 --- a/src/tests/lxc-test-cloneconfig +++ b/src/tests/lxc-test-cloneconfig @@ -109,7 +109,7 @@ EOF # We need this in 5.conf lxc-destroy -n lxctestb || true lxc-create -t busybox -n lxctestb -B dir -CONTAINER_PATH=$(dirname $(lxc-info -n lxctestb -c lxc.rootfs -H) | sed 's/dir://') +CONTAINER_PATH=$(dirname $(lxc-info -n lxctestb -c lxc.rootfs.path -H) | sed 's/dir://') lxc-destroy -n lxctestb # No nics, one clone hook in $container diff --git a/src/tests/parse_config_file.c b/src/tests/parse_config_file.c index 9239b42fa..bc69b3a16 100644 --- a/src/tests/parse_config_file.c +++ b/src/tests/parse_config_file.c @@ -503,13 +503,22 @@ int main(int argc, char *argv[]) goto non_test_error; } - /* lxc.rootfs */ + /* REMOVE IN LXC 3.0 + legacy lxc.rootfs key + */ if (set_get_compare_clear_save_load(c, "lxc.rootfs", "/some/path", tmpf, true) < 0) { lxc_error("%s\n", "lxc.rootfs"); goto non_test_error; } + /* lxc.rootfs.path */ + if (set_get_compare_clear_save_load(c, "lxc.rootfs.path", "/some/path", tmpf, + true) < 0) { + lxc_error("%s\n", "lxc.rootfs.path"); + goto non_test_error; + } + /* lxc.rootfs.mount */ if (set_get_compare_clear_save_load(c, "lxc.rootfs.mount", "/some/path", tmpf, true) < 0) { diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in index 2d6a1b9ff..359f02875 100644 --- a/templates/lxc-alpine.in +++ b/templates/lxc-alpine.in @@ -483,7 +483,7 @@ readonly MIRROR_URL="${mirror_url:-$DEFAULT_MIRROR_URL}" [ -n "$path" ] || die 1 'Missing required option --path' if [ -z "$rootfs" ] && [ -f "$path/config" ]; then - rootfs="$(sed -nE 's/^lxc.rootfs\s*=\s*(.*)$/\1/p' "$path/config")" + rootfs="$(sed -nE 's/^lxc.rootfs.path\s*=\s*(.*)$/\1/p' "$path/config")" fi if [ -z "$rootfs" ]; then rootfs="$path/rootfs" diff --git a/templates/lxc-altlinux.in b/templates/lxc-altlinux.in index ffc59373d..fe57f3262 100644 --- a/templates/lxc-altlinux.in +++ b/templates/lxc-altlinux.in @@ -274,7 +274,7 @@ copy_configuration() { mkdir -p $config_path - grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo "lxc.rootfs = $rootfs_path" >> $config_path/config + grep -q "^lxc.rootfs.path" $config_path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs_path" >> $config_path/config cat <> $config_path/config lxc.uts.name = $name lxc.tty = 4 @@ -460,10 +460,10 @@ if [ "$(id -u)" != "0" ]; then exit 1 fi -# check for 'lxc.rootfs' passed in through default config by lxc-create +# check for 'lxc.rootfs.path' passed in through default config by lxc-create if [ -z "$rootfs_path" ]; then - if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then - rootfs_path=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $path/config) + if grep -q '^lxc.rootfs.path' $path/config 2>/dev/null ; then + rootfs_path=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $path/config) else rootfs_path=$path/rootfs fi diff --git a/templates/lxc-archlinux.in b/templates/lxc-archlinux.in index 46c422083..defea748a 100644 --- a/templates/lxc-archlinux.in +++ b/templates/lxc-archlinux.in @@ -151,8 +151,8 @@ copy_configuration() { echo "lxc.uts.name = ${name}" >> "${config}" grep -q "^lxc.arch" "${config}" 2>/dev/null \ || echo "lxc.arch = ${arch}" >> "${config}" - grep -q "^lxc.rootfs" "${config}" 2>/dev/null \ - || echo "lxc.rootfs = ${rootfs_path}" >> "${config}" + grep -q "^lxc.rootfs.path" "${config}" 2>/dev/null \ + || echo "lxc.rootfs.path = ${rootfs_path}" >> "${config}" [ -e "${shared_config}" ] \ && echo "lxc.include = ${shared_config}" >> "${config}" if [ $? -ne 0 ]; then diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in index ac0fcd43d..e93c9e59d 100644 --- a/templates/lxc-busybox.in +++ b/templates/lxc-busybox.in @@ -339,7 +339,7 @@ copy_configuration() rootfs=$2 name=$3 -grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config +grep -q "^lxc.rootfs.path" $path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs" >> $path/config cat <> $path/config lxc.signal.halt = SIGUSR1 lxc.rebootsignal = SIGTERM @@ -427,8 +427,8 @@ fi # detect rootfs config="$path/config" if [ -z "$rootfs" ]; then - if grep -q '^lxc.rootfs' $config 2>/dev/null ; then - rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config) + if grep -q '^lxc.rootfs.path' $config 2>/dev/null ; then + rootfs=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $config) else rootfs=$path/rootfs fi diff --git a/templates/lxc-centos.in b/templates/lxc-centos.in index 23bc739fb..f816517ee 100644 --- a/templates/lxc-centos.in +++ b/templates/lxc-centos.in @@ -598,8 +598,8 @@ copy_configuration() { mkdir -p $config_path - grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo " -lxc.rootfs = $rootfs_path + grep -q "^lxc.rootfs.path" $config_path/config 2>/dev/null || echo " +lxc.rootfs.path = $rootfs_path " >> $config_path/config # The following code is to create static MAC addresses for each @@ -861,10 +861,10 @@ fi if [ -z "$rootfs_path" ]; then rootfs_path=$path/rootfs - # check for 'lxc.rootfs' passed in through default config by lxc-create - if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then - rootfs_path=$(sed -e '/^lxc.rootfs\s*=/!d' -e 's/\s*#.*//' \ - -e 's/^lxc.rootfs\s*=\s*//' -e q $path/config) + # check for 'lxc.rootfs.path' passed in through default config by lxc-create + if grep -q '^lxc.rootfs.path' $path/config 2>/dev/null ; then + rootfs_path=$(sed -e '/^lxc.rootfs.path\s*=/!d' -e 's/\s*#.*//' \ + -e 's/^lxc.rootfs.path\s*=\s*//' -e q $path/config) fi fi config_path=$path diff --git a/templates/lxc-cirros.in b/templates/lxc-cirros.in index b9c94d91d..c5e864c24 100644 --- a/templates/lxc-cirros.in +++ b/templates/lxc-cirros.in @@ -118,7 +118,7 @@ copy_configuration() cat >> "$path/config" <> "$path/config" echo "# Container specific configuration" >> "$path/config" - grep -q "^lxc.rootfs" "$path/config" 2> /dev/null || echo "lxc.rootfs = $rootfs" >> "$path/config" + grep -q "^lxc.rootfs.path" "$path/config" 2> /dev/null || echo "lxc.rootfs.path = $rootfs" >> "$path/config" cat <> $path/config lxc.tty = $num_tty @@ -787,8 +787,8 @@ fi # detect rootfs config="$path/config" if [ -z "$rootfs" ]; then - if grep -q '^lxc.rootfs' "$config" 2> /dev/null ; then - rootfs=$(awk -F= '/^lxc.rootfs[ \t]+=/{ print $2 }' "$config") + if grep -q '^lxc.rootfs.path' "$config" 2> /dev/null ; then + rootfs=$(awk -F= '/^lxc.rootfs.path[ \t]+=/{ print $2 }' "$config") else rootfs=$path/rootfs fi diff --git a/templates/lxc-fedora-legacy.in b/templates/lxc-fedora-legacy.in index 815f74c53..60d83afc6 100644 --- a/templates/lxc-fedora-legacy.in +++ b/templates/lxc-fedora-legacy.in @@ -1082,8 +1082,8 @@ copy_configuration() { mkdir -p $config_path - grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo " -lxc.rootfs = $rootfs_path + grep -q "^lxc.rootfs.path" $config_path/config 2>/dev/null || echo " +lxc.rootfs.path = $rootfs_path " >> $config_path/config # The following code is to create static MAC addresses for each @@ -1367,10 +1367,10 @@ fi if [ -z "$rootfs_path" ]; then rootfs_path=$path/rootfs - # check for 'lxc.rootfs' passed in through default config by lxc-create - if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then - rootfs_path=$(sed -e '/^lxc.rootfs\s*=/!d' -e 's/\s*#.*//' \ - -e 's/^lxc.rootfs\s*=\s*//' -e q $path/config) + # check for 'lxc.rootfs.path' passed in through default config by lxc-create + if grep -q '^lxc.rootfs.path' $path/config 2>/dev/null ; then + rootfs_path=$(sed -e '/^lxc.rootfs.path\s*=/!d' -e 's/\s*#.*//' \ + -e 's/^lxc.rootfs.path\s*=\s*//' -e q $path/config) fi fi config_path=$path diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in index 46a9b918c..3191757ec 100644 --- a/templates/lxc-fedora.in +++ b/templates/lxc-fedora.in @@ -439,8 +439,8 @@ copy_configuration() # include configuration from default.conf if available grep -q "^lxc." "${lxc_default_conf}" > "${config}" 2>/dev/null - grep -q "^lxc.rootfs" "${config}" 2>/dev/null || echo " -lxc.rootfs = ${rootfs} + grep -q "^lxc.rootfs.path" "${config}" 2>/dev/null || echo " +lxc.rootfs.path = ${rootfs} " >> "${config}" # The following code is to create static MAC addresses for each @@ -1185,10 +1185,10 @@ fi config="${path}/config" if [ -z "${rootfs}" ] then - # check for 'lxc.rootfs' passed in through default config by lxc-create - if grep -q '^lxc.rootfs' "${config}" 2>/dev/null + # check for 'lxc.rootfs.path' passed in through default config by lxc-create + if grep -q '^lxc.rootfs.path' "${config}" 2>/dev/null then - rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' "${config}") + rootfs=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' "${config}") else rootfs="${path}/rootfs" fi diff --git a/templates/lxc-gentoo.in b/templates/lxc-gentoo.in index 8f68f1757..e16366603 100644 --- a/templates/lxc-gentoo.in +++ b/templates/lxc-gentoo.in @@ -282,9 +282,9 @@ container_setup() { echo '### lxc-gentoo template stuff starts here' >> "$path/config" #Determine rootfs - #If backingstore was specified, lxc.rootfs should be present or --rootfs did the rootfs var creation + #If backingstore was specified, lxc.rootfs.path should be present or --rootfs did the rootfs var creation if [ -z "${rootfs}" ]; then - rootfs=`awk -F= '$1 ~ /^lxc.rootfs/ { print $2 }' "$path/config" 2>/dev/null` + rootfs=`awk -F= '$1 ~ /^lxc.rootfs.path/ { print $2 }' "$path/config" 2>/dev/null` if [ -z "${rootfs}" ]; then #OK it's default rootfs="${path}/rootfs" @@ -686,11 +686,11 @@ container_conf() grep -q "^lxc.net.0.hwaddr" ${conf_file} || sed -i -e "/^lxc\.net\.0\.type[ \t]*=[ \t]*veth/a lxc.net.0.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" ${conf_file} fi - if grep -q "^lxc.rootfs" "${conf_file}" ; then + if grep -q "^lxc.rootfs.path" "${conf_file}" ; then #lxc-create already provided one conf_rootfs_line="" else - conf_rootfs_line="lxc.rootfs = $(readlink -f "${rootfs}")" + conf_rootfs_line="lxc.rootfs.path = $(readlink -f "${rootfs}")" fi if [[ "${arch}" == "x86" || "${arch}" == "amd64" ]]; then local conf_arch_line="lxc.arch = ${arch}" diff --git a/templates/lxc-openmandriva.in b/templates/lxc-openmandriva.in index fbc7c7866..8845e617e 100644 --- a/templates/lxc-openmandriva.in +++ b/templates/lxc-openmandriva.in @@ -226,7 +226,7 @@ copy_configuration() { mkdir -p $config_path - grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo "lxc.rootfs = $rootfs_path" >> $config_path/config + grep -q "^lxc.rootfs.path" $config_path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs_path" >> $config_path/config cat <> $config_path/config lxc.uts.name = $name lxc.tty = 4 @@ -424,10 +424,10 @@ if [ "$(id -u)" != "0" ]; then exit 1 fi -# check for 'lxc.rootfs' passed in through default config by lxc-create +# check for 'lxc.rootfs.path' passed in through default config by lxc-create if [ -z "$rootfs_path" ]; then - if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then - rootfs_path=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $path/config) + if grep -q '^lxc.rootfs.path' $path/config 2>/dev/null ; then + rootfs_path=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $path/config) else rootfs_path=$path/$name/rootfs fi diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in index 380b3c028..25b59edad 100644 --- a/templates/lxc-opensuse.in +++ b/templates/lxc-opensuse.in @@ -303,8 +303,8 @@ copy_configuration() rootfs=$2 name=$3 - grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo " -lxc.rootfs = $rootfs_path + grep -q "^lxc.rootfs.path" $path/config 2>/dev/null || echo " +lxc.rootfs.path = $rootfs_path " >> $path/config # The following code is to create static MAC addresses for each @@ -504,8 +504,8 @@ fi # detect rootfs config="$path/config" if [ -z "$rootfs" ]; then - if grep -q '^lxc.rootfs' $config 2>/dev/null ; then - rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config) + if grep -q '^lxc.rootfs.path' $config 2>/dev/null ; then + rootfs=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $config) else rootfs=$path/rootfs fi diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in index eeb7e7448..afb690210 100644 --- a/templates/lxc-oracle.in +++ b/templates/lxc-oracle.in @@ -484,7 +484,7 @@ container_config_create() lxc.arch = $arch lxc.uts.name = $name EOF - grep -q "^lxc.rootfs" $cfg_dir/config 2>/dev/null || echo "lxc.rootfs = $container_rootfs" >> $cfg_dir/config + grep -q "^lxc.rootfs.path" $cfg_dir/config 2>/dev/null || echo "lxc.rootfs.path = $container_rootfs" >> $cfg_dir/config if [ $container_release_major != "4" ]; then echo "lxc.cap.drop = sys_resource" >>$cfg_dir/config diff --git a/templates/lxc-plamo.in b/templates/lxc-plamo.in index 9c17f77be..d59c49bfc 100644 --- a/templates/lxc-plamo.in +++ b/templates/lxc-plamo.in @@ -346,8 +346,8 @@ ptcache=$cache/partial-${prog##*-}-$release-$arch dlcache=$cache/cache-${prog##*-}-$release-$arch rtcache=$cache/rootfs-${prog##*-}-$release-$arch if [ -z "$rootfs" ] ; then - if grep -q "^lxc.rootfs" $path/config ; then - rootfs=`awk -F= '/^lxc.rootfs =/{ print $2 }' $path/config` + if grep -q "^lxc.rootfs.path" $path/config ; then + rootfs=`awk -F= '/^lxc.rootfs.path =/{ print $2 }' $path/config` else rootfs=$path/rootfs fi diff --git a/templates/lxc-pld.in b/templates/lxc-pld.in index 60c75ca00..f50f3fb83 100644 --- a/templates/lxc-pld.in +++ b/templates/lxc-pld.in @@ -234,7 +234,7 @@ copy_configuration() { mkdir -p $config_path - grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo "lxc.rootfs = $rootfs_path" >> $config_path/config + grep -q "^lxc.rootfs.path" $config_path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs_path" >> $config_path/config cat <> $config_path/config # Most of below settings should be taken as defaults from # lxc.include = /usr/share/lxc/config/common.conf @@ -423,10 +423,10 @@ fi if [ -z "$rootfs" ]; then rootfs_path=$path/rootfs - # check for 'lxc.rootfs' passed in through default config by lxc-create + # check for 'lxc.rootfs.path' passed in through default config by lxc-create # TODO: should be lxc.rootfs.mount used instead? - if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then - rootfs_path=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $path/config) + if grep -q '^lxc.rootfs.path' $path/config 2>/dev/null ; then + rootfs_path=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $path/config) fi else rootfs_path=$rootfs diff --git a/templates/lxc-slackware.in b/templates/lxc-slackware.in index f36e150a7..2c80351e5 100644 --- a/templates/lxc-slackware.in +++ b/templates/lxc-slackware.in @@ -743,8 +743,8 @@ fi # detect rootfs config="$path/config" if [ -z "$rootfs" ]; then - if grep -q '^lxc.rootfs' $config 2>/dev/null ; then - rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config) + if grep -q '^lxc.rootfs.path' $config 2>/dev/null ; then + rootfs=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $config) else rootfs=$path/rootfs fi diff --git a/templates/lxc-sparclinux.in b/templates/lxc-sparclinux.in index 087c54552..e5e686f8e 100644 --- a/templates/lxc-sparclinux.in +++ b/templates/lxc-sparclinux.in @@ -318,7 +318,7 @@ container_config_create() lxc.arch = $arch lxc.uts.name = $name EOF - grep -q "^lxc.rootfs" $cfg_dir/config 2>/dev/null || echo "lxc.rootfs = $container_rootfs" >> $cfg_dir/config + grep -q "^lxc.rootfs.path" $cfg_dir/config 2>/dev/null || echo "lxc.rootfs.path = $container_rootfs" >> $cfg_dir/config echo "lxc.cap.drop = sys_resource" >>$cfg_dir/config diff --git a/templates/lxc-sshd.in b/templates/lxc-sshd.in index 08b303de9..8cf4d6ae7 100644 --- a/templates/lxc-sshd.in +++ b/templates/lxc-sshd.in @@ -127,7 +127,7 @@ copy_configuration() init_path=$(realpath --relative-to=/ $(readlink -f /sbin/init)) - grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config + grep -q "^lxc.rootfs.path" $path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs" >> $path/config cat <> $path/config lxc.uts.name = $name lxc.pts = 1024 @@ -250,8 +250,8 @@ fi # detect rootfs config="$path/config" if [ -z "$rootfs" ]; then - if grep -q '^lxc.rootfs' $config 2>/dev/null ; then - rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config) + if grep -q '^lxc.rootfs.path' $config 2>/dev/null ; then + rootfs=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $config) else rootfs=$path/rootfs fi diff --git a/templates/lxc-ubuntu-cloud.in b/templates/lxc-ubuntu-cloud.in index 9717fa874..2bf534ab8 100644 --- a/templates/lxc-ubuntu-cloud.in +++ b/templates/lxc-ubuntu-cloud.in @@ -89,7 +89,7 @@ copy_configuration() echo "" >> $path/config echo "# Container specific configuration" >> $path/config [ -e "$path/config-auto" ] && cat $path/config-auto >> $path/config && rm $path/config-auto - grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config + grep -q "^lxc.rootfs.path" $path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs" >> $path/config cat <> $path/config lxc.uts.name = $name lxc.arch = $arch @@ -263,8 +263,8 @@ fi # detect rootfs config="$path/config" if [ -z "$rootfs" ]; then - if grep -q '^lxc.rootfs' $config 2>/dev/null ; then - rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config) + if grep -q '^lxc.rootfs.path' $config 2>/dev/null ; then + rootfs=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $config) else rootfs=$path/rootfs fi diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in index 81d6b6ca2..8077b319c 100644 --- a/templates/lxc-ubuntu.in +++ b/templates/lxc-ubuntu.in @@ -529,7 +529,7 @@ copy_configuration() echo "" >> $path/config echo "# Container specific configuration" >> $path/config [ -e "$path/config-auto" ] && cat $path/config-auto >> $path/config && rm $path/config-auto - grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config + grep -q "^lxc.rootfs.path" $path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs" >> $path/config cat <> $path/config lxc.uts.name = $name lxc.arch = $arch @@ -809,8 +809,8 @@ fi config="$path/config" # if $rootfs exists here, it was passed in with --rootfs if [ -z "$rootfs" ]; then - if grep -q '^lxc.rootfs' $config 2>/dev/null ; then - rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config) + if grep -q '^lxc.rootfs.path' $config 2>/dev/null ; then + rootfs=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $config) else rootfs=$path/rootfs fi diff --git a/templates/lxc-voidlinux.in b/templates/lxc-voidlinux.in index 6a4e91923..d74da385a 100644 --- a/templates/lxc-voidlinux.in +++ b/templates/lxc-voidlinux.in @@ -69,8 +69,8 @@ copy_configuration() { mkdir -p "${config_path}" local config="${config_path}/config" echo "lxc.uts.name = ${name}" >> "${config}" - grep -q "^lxc.rootfs" "${config}" 2>/dev/null \ - || echo "lxc.rootfs = ${rootfs_path}" >> "${config}" + grep -q "^lxc.rootfs.path" "${config}" 2>/dev/null \ + || echo "lxc.rootfs.path = ${rootfs_path}" >> "${config}" # Detect if were in a UserNS and include the right config if [ -z "${LXC_MAPPED_GID+x}" ] || [ -z "${LXC_MAPPED_UID+x}" ]; then -- 2.39.5