Commit b67771bc by 0x0916

confile: rename lxc.utsname to lxc.uts.name

the legacy keys will be kept around until LXC 3.0 and then will be removed. Signed-off-by: 's avatar0x0916 <w@laoqinren.net>
parent 42e53c29
# Container with network a complex network mixing macvlan, veth and
# physical network devices
lxc.utsname = complex
lxc.uts.name = complex
lxc.net.0.type = veth
lxc.net.0.flags = up
lxc.net.0.link = br0
......
# Container with new network withtout network devices
lxc.utsname = omega
lxc.uts.name = omega
lxc.net.0.type = empty
lxc.net.0.flags = up
# Container with network virtualized using the macvlan device driver
lxc.utsname = alpha
lxc.uts.name = alpha
lxc.net.0.type = macvlan
lxc.net.0.flags = up
lxc.net.0.link = eth0
......
# Container with non-virtualized network
lxc.net.0.type = none
lxc.utsname = delta
lxc.uts.name = delta
# Container with network virtualized using a physical network device with name
# 'eth0'
lxc.utsname = gamma
lxc.uts.name = gamma
lxc.net.0.type = phys
lxc.net.0.flags = up
lxc.net.0.link = eth0
......
# Container with network virtualized using a pre-configured bridge named br0 and
# veth pair virtual network devices
lxc.utsname = beta
lxc.uts.name = beta
lxc.net.0.type = veth
lxc.net.0.flags = up
lxc.net.0.link = br0
......
# Container with network virtualized using the vlan device driver
lxc.utsname = alpha
lxc.uts.name = alpha
lxc.net.0.type = vlan
lxc.net.0.vlan.id = 1234
lxc.net.0.flags = up
......
......@@ -229,7 +229,7 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
<variablelist>
<varlistentry>
<term>
<option>lxc.utsname</option>
<option>lxc.uts.name</option>
</term>
<listitem>
<para>
......@@ -2667,7 +2667,7 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
仮想ネットワークデバイスは、コンテナ内では eth0 とリネームされます。
</para>
<programlisting>
lxc.utsname = myhostname
lxc.uts.name = myhostname
lxc.net.0.type = veth
lxc.net.0.flags = up
lxc.net.0.link = br0
......@@ -2720,7 +2720,7 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
この例は、control group を使って、複雑なネットワークスタックを作成し、新しいホスト名を指定し、いくつかの場所をマウントし、ルートファイルシステムを変更するような複雑な設定を示します。
</para>
<programlisting>
lxc.utsname = complex
lxc.uts.name = complex
lxc.net.0.type = veth
lxc.net.0.flags = up
lxc.net.0.link = br0
......
......@@ -187,7 +187,7 @@ by Sungbae Yoo <sungbae.yoo at samsung.com>
<variablelist>
<varlistentry>
<term>
<option>lxc.utsname</option>
<option>lxc.uts.name</option>
</term>
<listitem>
<para>
......@@ -2563,7 +2563,7 @@ mknod errno 0
이 설정은 컨테이너가 한 쪽은 (이전에 시스템에 이미 생성된) br0 브리지에 연결되어 있는 veth 장치 쌍을 사용하도록 세팅한다. 가상 네트워크 장치는 컨테이너 내에서 eth0라는 이름을 갖는다.
</para>
<programlisting>
lxc.utsname = myhostname
lxc.uts.name = myhostname
lxc.net.0.type = veth
lxc.net.0.flags = up
lxc.net.0.link = br0
......@@ -2613,7 +2613,7 @@ mknod errno 0
아래의 예제는 복잡한 네트워크 스택, 컨트롤 그룹 사용, 호스트 이름 설정, 몇몇 장소 마운트, 루트 파일시스템 변경 등의 복잡한 설정을 보여준다.
</para>
<programlisting>
lxc.utsname = complex
lxc.uts.name = complex
lxc.net.0.type = veth
lxc.net.0.flags = up
lxc.net.0.link = br0
......
......@@ -172,7 +172,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<variablelist>
<varlistentry>
<term>
<option>lxc.utsname</option>
<option>lxc.uts.name</option>
</term>
<listitem>
<para>
......@@ -1932,7 +1932,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
virtual network device visible in the container is renamed to
eth0.</para>
<programlisting>
lxc.utsname = myhostname
lxc.uts.name = myhostname
lxc.net.0.type = veth
lxc.net.0.flags = up
lxc.net.0.link = br0
......@@ -1975,7 +1975,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
network stack, using the control groups, setting a new hostname,
mounting some locations and a changing root file system.</para>
<programlisting>
lxc.utsname = complex
lxc.uts.name = complex
lxc.net.0.type = veth
lxc.net.0.flags = up
lxc.net.0.link = br0
......
......@@ -233,11 +233,11 @@ function test_config_items()
log(0, "Test set/clear configuration items...")
-- test setting a 'single type' item
assert(container:get_config_item("lxc.utsname") == optarg["n"])
container:set_config_item("lxc.utsname", "foobar")
assert(container:get_config_item("lxc.utsname") == "foobar")
container:set_config_item("lxc.utsname", optarg["n"])
assert(container:get_config_item("lxc.utsname") == optarg["n"])
assert(container:get_config_item("lxc.uts.name") == optarg["n"])
container:set_config_item("lxc.uts.name", "foobar")
assert(container:get_config_item("lxc.uts.name") == "foobar")
container:set_config_item("lxc.uts.name", optarg["n"])
assert(container:get_config_item("lxc.uts.name") == optarg["n"])
-- test clearing/setting a 'list type' item
container:clear_config_item("lxc.cap.drop")
......
......@@ -92,7 +92,7 @@ lxc_config_define(rootfs_mount);
lxc_config_define(rootfs_options);
lxc_config_define(rootfs_backend);
lxc_config_define(rootfs);
lxc_config_define(utsname);
lxc_config_define(uts_name);
lxc_config_define(hooks);
lxc_config_define(net_type);
lxc_config_define(net_flags);
......@@ -164,7 +164,13 @@ static struct lxc_config_t config[] = {
{ "lxc.rootfs.options", set_config_rootfs_options, get_config_rootfs_options, clr_config_rootfs_options, },
{ "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, },
{ "lxc.utsname", set_config_utsname, get_config_utsname, clr_config_utsname, },
/* REMOVE IN LXC 3.0
legacy utsname key
*/
{ "lxc.utsname", set_config_uts_name, get_config_uts_name, clr_config_uts_name, },
{ "lxc.uts.name", set_config_uts_name, get_config_uts_name, clr_config_uts_name, },
{ "lxc.hook.pre-start", set_config_hooks, get_config_hooks, clr_config_hooks, },
{ "lxc.hook.pre-mount", set_config_hooks, get_config_hooks, clr_config_hooks, },
{ "lxc.hook.mount", set_config_hooks, get_config_hooks, clr_config_hooks, },
......@@ -2059,13 +2065,13 @@ static int set_config_rootfs_backend(const char *key, const char *value,
return set_config_string_item(&lxc_conf->rootfs.bdev_type, value);
}
static int set_config_utsname(const char *key, const char *value,
static int set_config_uts_name(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data)
{
struct utsname *utsname;
if (lxc_config_value_empty(value)) {
clr_config_utsname(key, lxc_conf, NULL);
clr_config_uts_name(key, lxc_conf, NULL);
return 0;
}
......@@ -3050,7 +3056,7 @@ static int get_config_rootfs_backend(const char *key, char *retv, int inlen,
return lxc_get_conf_str(retv, inlen, c->rootfs.bdev_type);
}
static int get_config_utsname(const char *key, char *retv, int inlen,
static int get_config_uts_name(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data)
{
return lxc_get_conf_str(
......@@ -3472,7 +3478,7 @@ static inline int clr_config_rootfs_backend(const char *key, struct lxc_conf *c,
return 0;
}
static inline int clr_config_utsname(const char *key, struct lxc_conf *c,
static inline int clr_config_uts_name(const char *key, struct lxc_conf *c,
void *data)
{
free(c->utsname);
......
......@@ -3211,8 +3211,9 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
// update utsname
if (!(flags & LXC_CLONE_KEEPNAME)) {
clear_unexp_config_line(c2->lxc_conf, "lxc.utsname", false);
clear_unexp_config_line(c2->lxc_conf, "lxc.uts.name", false);
if (!set_config_item_locked(c2, "lxc.utsname", newname)) {
if (!set_config_item_locked(c2, "lxc.uts.name", newname)) {
ERROR("Error setting new hostname");
goto out;
}
......
......@@ -71,7 +71,7 @@ container.create("download", 0,
assert(container.defined)
assert(container.name == CONTAINER_NAME
== container.get_config_item("lxc.utsname"))
== container.get_config_item("lxc.uts.name"))
assert(container.name in lxc.list_containers())
## Test the config
......@@ -131,8 +131,8 @@ assert(len(ips) > 0)
## Test running config
assert(container.name == CONTAINER_NAME
== container.get_config_item("lxc.utsname")
== container.get_running_config_item("lxc.utsname"))
== container.get_config_item("lxc.uts.name")
== container.get_running_config_item("lxc.uts.name"))
## Testing cgroups a bit
print("Testing cgroup API")
......
......@@ -531,13 +531,22 @@ int main(int argc, char *argv[])
goto non_test_error;
}
/* lxc.utsname */
/* REMOVE IN LXC 3.0
legacy lxc.utsname key
*/
if (set_get_compare_clear_save_load(c, "lxc.utsname", "the-shire", tmpf,
true) < 0) {
lxc_error("%s\n", "lxc.utsname");
goto non_test_error;
}
/* lxc.uts.name */
if (set_get_compare_clear_save_load(c, "lxc.uts.name", "the-shire", tmpf,
true) < 0) {
lxc_error("%s\n", "lxc.uts.name");
goto non_test_error;
}
/* lxc.hook.pre-start */
if (set_get_compare_clear_save_load(
c, "lxc.hook.pre-start", "/some/pre-start", tmpf, false) < 0) {
......
......@@ -154,8 +154,8 @@ int main(int argc, char *argv[])
goto out;
}
if (!c->set_config_item(c, "lxc.utsname", "bobo")) {
fprintf(stderr, "%d: failed setting lxc.utsname\n", __LINE__);
if (!c->set_config_item(c, "lxc.uts.name", "bobo")) {
fprintf(stderr, "%d: failed setting lxc.uts.name\n", __LINE__);
goto out;
}
......
......@@ -388,7 +388,7 @@ configure_container() {
lxc.arch = $arch
# Set hostname.
lxc.utsname = $hostname
lxc.uts.name = $hostname
# If something doesn't work, try to comment this out.
# Dropping sys_admin disables container root from doing a lot of things
......
......@@ -267,7 +267,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
cat <<EOF >> $config_path/config
lxc.utsname = $name
lxc.uts.name = $name
lxc.tty = 4
lxc.pts = 1024
lxc.cap.drop = sys_module mac_admin mac_override sys_time
......
......@@ -148,7 +148,7 @@ EOF
copy_configuration() {
mkdir -p "${config_path}"
local config="${config_path}/config"
echo "lxc.utsname = ${name}" >> "${config}"
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 \
......
......@@ -343,7 +343,7 @@ grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >>
cat <<EOF >> $path/config
lxc.signal.halt = SIGUSR1
lxc.rebootsignal = SIGTERM
lxc.utsname = $name
lxc.uts.name = $name
lxc.tty = 1
lxc.pts = 1
lxc.cap.drop = sys_module mac_admin mac_override sys_time
......
......@@ -641,7 +641,7 @@ lxc.include = @LXCTEMPLATECONFIG@/centos.common.conf
# Append things which require expansion here...
cat <<EOF >> $config_path/config
lxc.arch = $arch
lxc.utsname = $utsname
lxc.uts.name = $utsname
# When using LXC with apparmor, uncomment the next line to run unconfined:
#lxc.aa_profile = unconfined
......
......@@ -123,7 +123,7 @@ lxc.rootfs = $rootfs
lxc.tty = 4
lxc.pts = 1024
lxc.utsname = $name
lxc.uts.name = $name
lxc.arch = $arch
lxc.cap.drop = sys_module mac_admin mac_override sys_time
......
......@@ -515,7 +515,7 @@ copy_configuration()
cat <<EOF >> $path/config
lxc.tty = $num_tty
lxc.utsname = $hostname
lxc.uts.name = $hostname
lxc.arch = $arch
lxc.pts=1023
EOF
......
......@@ -547,7 +547,7 @@ fi
if [ -e "$fstab" ]; then
echo "lxc.mount = ${LXC_PATH}/fstab" >> ${LXC_PATH}/config
fi
echo "lxc.utsname = ${LXC_NAME}" >> ${LXC_PATH}/config
echo "lxc.uts.name = ${LXC_NAME}" >> ${LXC_PATH}/config
## Re-add the previously removed network config
if [ -e "${LXC_PATH}/config-network" ]; then
......
......@@ -1127,7 +1127,7 @@ lxc.include = @LXCTEMPLATECONFIG@/fedora.common.conf
# Append things which require expansion here...
cat <<EOF >> $config_path/config
lxc.arch = $arch
lxc.utsname = $utsname
lxc.uts.name = $utsname
# When using LXC with apparmor, uncomment the next line to run unconfined:
#lxc.aa_profile = unconfined
......
......@@ -486,7 +486,7 @@ lxc.include = ${lxc_template_config}/fedora.common.conf
cat <<EOF >> "${path}/config"
# Container specific configuration
lxc.arch = ${basearch}
lxc.utsname = ${utsname}
lxc.uts.name = ${utsname}
# When using LXC with apparmor, uncomment the next line to run unconfined:
#lxc.aa_profile = unconfined
......
......@@ -705,7 +705,7 @@ container_conf()
${conf_arch_line}
# set the hostname
lxc.utsname = ${name}
lxc.uts.name = ${name}
lxc.tty = ${tty}
${conf_rootfs_line}
......
......@@ -228,7 +228,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
cat <<EOF >> $config_path/config
lxc.utsname = $name
lxc.uts.name = $name
lxc.tty = 4
lxc.pts = 1024
lxc.cap.drop = sys_module mac_admin mac_override sys_time
......
......@@ -350,7 +350,7 @@ lxc.include = @LXCTEMPLATECONFIG@/opensuse.common.conf
# Append things which require expansion here...
cat <<EOF >> $path/config
lxc.arch = $arch
lxc.utsname = $name
lxc.uts.name = $name
lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed
......
......@@ -482,7 +482,7 @@ container_config_create()
cat <<EOF >> $cfg_dir/config || die "unable to create $cfg_dir/config"
# Container configuration for Oracle Linux $container_release_major.$container_release_minor
lxc.arch = $arch
lxc.utsname = $name
lxc.uts.name = $name
EOF
grep -q "^lxc.rootfs" $cfg_dir/config 2>/dev/null || echo "lxc.rootfs = $container_rootfs" >> $cfg_dir/config
......
......@@ -233,7 +233,7 @@ configure_plamo() {
copy_configuration() {
ret=0
cat <<- EOF >> $path/config || let ret++
lxc.utsname = $name
lxc.uts.name = $name
lxc.arch = $arch
EOF
if [ -f "@LXCTEMPLATECONFIG@/plamo.common.conf" ] ; then
......
......@@ -238,7 +238,7 @@ copy_configuration()
cat <<EOF >> $config_path/config
# Most of below settings should be taken as defaults from
# lxc.include = /usr/share/lxc/config/common.conf
lxc.utsname = $utsname
lxc.uts.name = $utsname
lxc.tty = 4
lxc.pts = 1024
# Consider if below line is right for systemd container
......
......@@ -324,7 +324,7 @@ lxc.cgroup.devices.allow = c 10:229 rwm
lxc.arch = $arch
# Set hostname.
lxc.utsname = $hostname
lxc.uts.name = $hostname
# Include common configuration.
lxc.include = $LXC_TEMPLATE_CONFIG/sabayon.common.conf
......
......@@ -638,7 +638,7 @@ name=$3
cat <<EOF >> $path/config
lxc.utsname = $name
lxc.uts.name = $name
lxc.arch = $arch
lxc.mount = $rootfs/etc/fstab
......
......@@ -316,7 +316,7 @@ container_config_create()
cat <<EOF >> $cfg_dir/config || die "unable to create $cfg_dir/config"
# Container configuration for Linux for SPARC $container_release_major.$container_release_minor
lxc.arch = $arch
lxc.utsname = $name
lxc.uts.name = $name
EOF
grep -q "^lxc.rootfs" $cfg_dir/config 2>/dev/null || echo "lxc.rootfs = $container_rootfs" >> $cfg_dir/config
......
......@@ -129,7 +129,7 @@ copy_configuration()
grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config
cat <<EOF >> $path/config
lxc.utsname = $name
lxc.uts.name = $name
lxc.pts = 1024
lxc.cap.drop = sys_module mac_admin mac_override sys_time
......
......@@ -91,7 +91,7 @@ copy_configuration()
[ -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
cat <<EOF >> $path/config
lxc.utsname = $name
lxc.uts.name = $name
lxc.arch = $arch
EOF
......
......@@ -531,7 +531,7 @@ copy_configuration()
[ -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
cat <<EOF >> $path/config
lxc.utsname = $name
lxc.uts.name = $name
lxc.arch = $arch
EOF
......
......@@ -68,7 +68,7 @@ declare -a additional_packages
copy_configuration() {
mkdir -p "${config_path}"
local config="${config_path}/config"
echo "lxc.utsname = ${name}" >> "${config}"
echo "lxc.uts.name = ${name}" >> "${config}"
grep -q "^lxc.rootfs" "${config}" 2>/dev/null \
|| echo "lxc.rootfs = ${rootfs_path}" >> "${config}"
......
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