# 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
<variablelist>
<varlistentry>
<term>
- <option>lxc.utsname</option>
+ <option>lxc.uts.name</option>
</term>
<listitem>
<para>
仮想ネットワークデバイスは、コンテナ内では 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
この例は、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
<variablelist>
<varlistentry>
<term>
- <option>lxc.utsname</option>
+ <option>lxc.uts.name</option>
</term>
<listitem>
<para>
이 설정은 컨테이너가 한 쪽은 (이전에 시스템에 이미 생성된) 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
아래의 예제는 복잡한 네트워크 스택, 컨트롤 그룹 사용, 호스트 이름 설정, 몇몇 장소 마운트, 루트 파일시스템 변경 등의 복잡한 설정을 보여준다.
</para>
<programlisting>
- lxc.utsname = complex
+ lxc.uts.name = complex
lxc.net.0.type = veth
lxc.net.0.flags = up
lxc.net.0.link = br0
<variablelist>
<varlistentry>
<term>
- <option>lxc.utsname</option>
+ <option>lxc.uts.name</option>
</term>
<listitem>
<para>
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
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
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")
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);
{ "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, },
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;
}
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(
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);
// 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;
}
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
## 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")
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) {
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;
}
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
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
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 \
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
# 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
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
cat <<EOF >> $path/config
lxc.tty = $num_tty
-lxc.utsname = $hostname
+lxc.uts.name = $hostname
lxc.arch = $arch
lxc.pts=1023
EOF
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
# 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
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
${conf_arch_line}
# set the hostname
-lxc.utsname = ${name}
+lxc.uts.name = ${name}
lxc.tty = ${tty}
${conf_rootfs_line}
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
# 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
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
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
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
lxc.arch = $arch
# Set hostname.
-lxc.utsname = $hostname
+lxc.uts.name = $hostname
# Include common configuration.
lxc.include = $LXC_TEMPLATE_CONFIG/sabayon.common.conf
cat <<EOF >> $path/config
-lxc.utsname = $name
+lxc.uts.name = $name
lxc.arch = $arch
lxc.mount = $rootfs/etc/fstab
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
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
[ -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
[ -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
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}"