mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-16 03:35:05 +00:00
Merge pull request #2155 from brauner/2018-02-10/remove_legacy_items
tree-wide: remove legacy codepaths
This commit is contained in:
commit
4d46764248
@ -25,7 +25,6 @@ noinst_HEADERS = \
|
||||
caps.h \
|
||||
conf.h \
|
||||
confile.h \
|
||||
confile_legacy.h \
|
||||
confile_utils.h \
|
||||
console.h \
|
||||
error.h \
|
||||
@ -113,7 +112,6 @@ liblxc_la_SOURCES = \
|
||||
namespace.h namespace.c \
|
||||
conf.c conf.h \
|
||||
confile.c confile.h \
|
||||
confile_legacy.c confile_legacy.h \
|
||||
confile_utils.c confile_utils.h \
|
||||
list.h \
|
||||
state.c state.h \
|
||||
|
@ -391,12 +391,6 @@ struct lxc_conf {
|
||||
/* RLIMIT_* limits */
|
||||
struct lxc_list limits;
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
* Indicator whether the current config file we're using contained any
|
||||
* legacy configuration keys.
|
||||
*/
|
||||
bool contains_legacy_key;
|
||||
|
||||
/* Contains generic info about the cgroup configuration for this
|
||||
* container. Note that struct lxc_cgroup contains a union. It is only
|
||||
* valid to access the members of the anonymous "meta" struct within
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include "conf.h"
|
||||
#include "config.h"
|
||||
#include "confile.h"
|
||||
#include "confile_legacy.h"
|
||||
#include "confile_utils.h"
|
||||
#include "log.h"
|
||||
#include "lxcseccomp.h"
|
||||
@ -128,11 +127,9 @@ lxc_config_define(net_type);
|
||||
lxc_config_define(net_veth_pair);
|
||||
lxc_config_define(net_vlan_id);
|
||||
lxc_config_define(no_new_privs);
|
||||
lxc_config_define(noop);
|
||||
lxc_config_define(personality);
|
||||
lxc_config_define(prlimit);
|
||||
lxc_config_define(pty_max);
|
||||
lxc_config_define(rootfs_backend);
|
||||
lxc_config_define(rootfs_mount);
|
||||
lxc_config_define(rootfs_options);
|
||||
lxc_config_define(rootfs_path);
|
||||
@ -149,138 +146,88 @@ lxc_config_define(sysctl);
|
||||
lxc_config_define(proc);
|
||||
|
||||
static struct lxc_config_t config[] = {
|
||||
/* REMOVE in LXC 3.0 */
|
||||
{ "lxc.arch", false, set_config_personality, get_config_personality, clr_config_personality, },
|
||||
{ "lxc.apparmor.profile", false, set_config_apparmor_profile, get_config_apparmor_profile, clr_config_apparmor_profile, },
|
||||
{ "lxc.apparmor.allow_incomplete", false, set_config_apparmor_allow_incomplete, get_config_apparmor_allow_incomplete, clr_config_apparmor_allow_incomplete, },
|
||||
{ "lxc.autodev", false, set_config_autodev, get_config_autodev, clr_config_autodev, },
|
||||
{ "lxc.cap.drop", false, set_config_cap_drop, get_config_cap_drop, clr_config_cap_drop, },
|
||||
{ "lxc.cap.keep", false, set_config_cap_keep, get_config_cap_keep, clr_config_cap_keep, },
|
||||
{ "lxc.cgroup2", false, set_config_cgroup2_controller, get_config_cgroup2_controller, clr_config_cgroup2_controller, },
|
||||
{ "lxc.cgroup.dir", false, set_config_cgroup_dir, get_config_cgroup_dir, clr_config_cgroup_dir, },
|
||||
{ "lxc.cgroup", false, set_config_cgroup_controller, get_config_cgroup_controller, clr_config_cgroup_controller, },
|
||||
{ "lxc.console.buffer.logfile", false, set_config_console_buffer_logfile, get_config_console_buffer_logfile, clr_config_console_buffer_logfile, },
|
||||
{ "lxc.console.buffer.size", false, set_config_console_buffer_size, get_config_console_buffer_size, clr_config_console_buffer_size, },
|
||||
{ "lxc.console.logfile", false, set_config_console_logfile, get_config_console_logfile, clr_config_console_logfile, },
|
||||
{ "lxc.console.path", false, set_config_console_path, get_config_console_path, clr_config_console_path, },
|
||||
{ "lxc.console.rotate", false, set_config_console_rotate, get_config_console_rotate, clr_config_console_rotate, },
|
||||
{ "lxc.environment", false, set_config_environment, get_config_environment, clr_config_environment, },
|
||||
{ "lxc.ephemeral", false, set_config_ephemeral, get_config_ephemeral, clr_config_ephemeral, },
|
||||
{ "lxc.execute.cmd", false, set_config_execute_cmd, get_config_execute_cmd, clr_config_execute_cmd, },
|
||||
{ "lxc.group", false, set_config_group, get_config_group, clr_config_group, },
|
||||
{ "lxc.hook.autodev", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.clone", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.destroy", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.mount", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.post-stop", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.pre-mount", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.pre-start", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.start", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.start-host", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.stop", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.version", false, set_config_hooks_version, get_config_hooks_version, clr_config_hooks_version, },
|
||||
{ "lxc.hook", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.idmap", false, set_config_idmaps, get_config_idmaps, clr_config_idmaps, },
|
||||
{ "lxc.include", false, set_config_includefiles, get_config_includefiles, clr_config_includefiles, },
|
||||
{ "lxc.init.cmd", false, set_config_init_cmd, get_config_init_cmd, clr_config_init_cmd, },
|
||||
{ "lxc.init.gid", false, set_config_init_gid, get_config_init_gid, clr_config_init_gid, },
|
||||
{ "lxc.init.uid", false, set_config_init_uid, get_config_init_uid, clr_config_init_uid, },
|
||||
{ "lxc.init.cwd", false, set_config_init_cwd, get_config_init_cwd, clr_config_init_cwd, },
|
||||
{ "lxc.log.file", false, set_config_log_file, get_config_log_file, clr_config_log_file, },
|
||||
{ "lxc.log.level", false, set_config_log_level, get_config_log_level, clr_config_log_level, },
|
||||
{ "lxc.log.syslog", false, set_config_log_syslog, get_config_log_syslog, clr_config_log_syslog, },
|
||||
{ "lxc.monitor.unshare", false, set_config_monitor, get_config_monitor, clr_config_monitor, },
|
||||
{ "lxc.mount.auto", false, set_config_mount_auto, get_config_mount_auto, clr_config_mount_auto, },
|
||||
{ "lxc.mount.entry", false, set_config_mount, get_config_mount, clr_config_mount, },
|
||||
{ "lxc.mount.fstab", false, set_config_mount_fstab, get_config_mount_fstab, clr_config_mount_fstab, },
|
||||
{ "lxc.namespace.clone", false, set_config_namespace_clone, get_config_namespace_clone, clr_config_namespace_clone, },
|
||||
{ "lxc.namespace.keep", false, set_config_namespace_keep, get_config_namespace_keep, clr_config_namespace_keep, },
|
||||
{ "lxc.namespace.share", false, set_config_namespace_share, get_config_namespace_share, clr_config_namespace_share, },
|
||||
|
||||
/* [START]: REMOVE IN LXC 3.0 */
|
||||
{ "lxc.network.type", true, set_config_network_legacy_type, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network.flags", true, set_config_network_legacy_flags, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network.link", true, set_config_network_legacy_link, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network.name", true, set_config_network_legacy_name, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network.macvlan.mode", true, set_config_network_legacy_macvlan_mode, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network.veth.pair", true, set_config_network_legacy_veth_pair, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network.script.up", true, set_config_network_legacy_script_up, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network.script.down", true, set_config_network_legacy_script_down, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network.hwaddr", true, set_config_network_legacy_hwaddr, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network.mtu", true, set_config_network_legacy_mtu, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network.vlan.id", true, set_config_network_legacy_vlan_id, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network.ipv4.gateway", true, set_config_network_legacy_ipv4_gateway, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network.ipv4", true, set_config_network_legacy_ipv4, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network.ipv6.gateway", true, set_config_network_legacy_ipv6_gateway, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network.ipv6", true, set_config_network_legacy_ipv6, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network.", true, set_config_network_legacy_nic, get_config_network_legacy_item, clr_config_network_legacy_item, },
|
||||
{ "lxc.network", true, set_config_network_legacy, get_config_network_legacy, clr_config_network_legacy, },
|
||||
/* [END]: REMOVE IN LXC 3.0 */
|
||||
|
||||
{ "lxc.net.flags", false, set_config_net_flags, get_config_net_flags, clr_config_net_flags, },
|
||||
{ "lxc.net.hwaddr", false, set_config_net_hwaddr, get_config_net_hwaddr, clr_config_net_hwaddr, },
|
||||
{ "lxc.net.ipv4.address", false, set_config_net_ipv4_address, get_config_net_ipv4_address, clr_config_net_ipv4_address, },
|
||||
{ "lxc.net.ipv4.gateway", false, set_config_net_ipv4_gateway, get_config_net_ipv4_gateway, clr_config_net_ipv4_gateway, },
|
||||
{ "lxc.net.ipv6.address", false, set_config_net_ipv6_address, get_config_net_ipv6_address, clr_config_net_ipv6_address, },
|
||||
{ "lxc.net.ipv6.gateway", false, set_config_net_ipv6_gateway, get_config_net_ipv6_gateway, clr_config_net_ipv6_gateway, },
|
||||
{ "lxc.net.link", false, set_config_net_link, get_config_net_link, clr_config_net_link, },
|
||||
{ "lxc.net.macvlan.mode", false, set_config_net_macvlan_mode, get_config_net_macvlan_mode, clr_config_net_macvlan_mode, },
|
||||
{ "lxc.net.mtu", false, set_config_net_mtu, get_config_net_mtu, clr_config_net_mtu, },
|
||||
{ "lxc.net.name", false, set_config_net_name, get_config_net_name, clr_config_net_name, },
|
||||
{ "lxc.net.script.down", false, set_config_net_script_down, get_config_net_script_down, clr_config_net_script_down, },
|
||||
{ "lxc.net.script.up", false, set_config_net_script_up, get_config_net_script_up, clr_config_net_script_up, },
|
||||
{ "lxc.net.type", false, set_config_net_type, get_config_net_type, clr_config_net_type, },
|
||||
{ "lxc.net.vlan.id", false, set_config_net_vlan_id, get_config_net_vlan_id, clr_config_net_vlan_id, },
|
||||
{ "lxc.net.veth.pair", false, set_config_net_veth_pair, get_config_net_veth_pair, clr_config_net_veth_pair, },
|
||||
{ "lxc.net.", false, set_config_net_nic, get_config_net_nic, clr_config_net_nic, },
|
||||
{ "lxc.net", false, set_config_net, get_config_net, clr_config_net, },
|
||||
{ "lxc.no_new_privs", false, set_config_no_new_privs, get_config_no_new_privs, clr_config_no_new_privs, },
|
||||
{ "lxc.prlimit", false, set_config_prlimit, get_config_prlimit, clr_config_prlimit, },
|
||||
{ "lxc.pty.max", false, set_config_pty_max, get_config_pty_max, clr_config_pty_max, },
|
||||
{ "lxc.rootfs.mount", false, set_config_rootfs_mount, get_config_rootfs_mount, clr_config_rootfs_mount, },
|
||||
{ "lxc.rootfs.options", false, set_config_rootfs_options, get_config_rootfs_options, clr_config_rootfs_options, },
|
||||
{ "lxc.rootfs.path", false, set_config_rootfs_path, get_config_rootfs_path, clr_config_rootfs_path, },
|
||||
{ "lxc.seccomp.profile", false, set_config_seccomp_profile, get_config_seccomp_profile, clr_config_seccomp_profile, },
|
||||
{ "lxc.selinux.context", false, set_config_selinux_context, get_config_selinux_context, clr_config_selinux_context, },
|
||||
{ "lxc.signal.halt", false, set_config_signal_halt, get_config_signal_halt, clr_config_signal_halt, },
|
||||
{ "lxc.signal.reboot", false, set_config_signal_reboot, get_config_signal_reboot, clr_config_signal_reboot, },
|
||||
{ "lxc.signal.stop", false, set_config_signal_stop, get_config_signal_stop, clr_config_signal_stop, },
|
||||
{ "lxc.start.auto", false, set_config_start, get_config_start, clr_config_start, },
|
||||
{ "lxc.start.delay", false, set_config_start, get_config_start, clr_config_start, },
|
||||
{ "lxc.start.order", false, set_config_start, get_config_start, clr_config_start, },
|
||||
{ "lxc.tty.dir", false, set_config_tty_dir, get_config_tty_dir, clr_config_tty_dir, },
|
||||
{ "lxc.tty.max", false, set_config_tty_max, get_config_tty_max, clr_config_tty_max, },
|
||||
{ "lxc.uts.name", false, set_config_uts_name, get_config_uts_name, clr_config_uts_name, },
|
||||
{ "lxc.sysctl", false, set_config_sysctl, get_config_sysctl, clr_config_sysctl, },
|
||||
{ "lxc.proc", false, set_config_proc, get_config_proc, clr_config_proc, },
|
||||
|
||||
/* [START]: REMOVE IN LXC 3.0 */
|
||||
{ "lxc.pts", true, set_config_pty_max, get_config_pty_max, clr_config_pty_max, },
|
||||
{ "lxc.devttydir", true, set_config_tty_dir, get_config_tty_dir, clr_config_tty_dir, },
|
||||
{ "lxc.tty", true, set_config_tty_max, get_config_tty_max, clr_config_tty_max, },
|
||||
{ "lxc.aa_profile", true, set_config_lsm_aa_profile, get_config_lsm_aa_profile, clr_config_lsm_aa_profile, },
|
||||
{ "lxc.aa_allow_incomplete", true, set_config_lsm_aa_incomplete, get_config_lsm_aa_incomplete, clr_config_lsm_aa_incomplete, },
|
||||
{ "lxc.se_context", true, set_config_lsm_se_context, get_config_lsm_se_context, clr_config_lsm_se_context, },
|
||||
{ "lxc.id_map", true, set_config_idmaps, get_config_idmaps, clr_config_idmaps, },
|
||||
{ "lxc.mount", true, set_config_mount_fstab, get_config_mount_fstab, clr_config_mount_fstab, },
|
||||
{ "lxc.rootfs.backend", true, set_config_rootfs_backend, get_config_rootfs_backend, clr_config_rootfs_backend, },
|
||||
{ "lxc.rootfs", true, set_config_rootfs_path, get_config_rootfs_path, clr_config_rootfs_path, },
|
||||
{ "lxc.utsname", true, set_config_uts_name, get_config_uts_name, clr_config_uts_name, },
|
||||
{ "lxc.seccomp", true, set_config_seccomp_profile, get_config_seccomp_profile, clr_config_seccomp_profile, },
|
||||
{ "lxc.console", true, set_config_console_path, get_config_console_path, clr_config_console_path, },
|
||||
{ "lxc.haltsignal", true, set_config_signal_halt, get_config_signal_halt, clr_config_signal_halt, },
|
||||
{ "lxc.rebootsignal", true, set_config_signal_reboot, get_config_signal_reboot, clr_config_signal_reboot, },
|
||||
{ "lxc.stopsignal", true, set_config_signal_stop, get_config_signal_stop, clr_config_signal_stop, },
|
||||
{ "lxc.syslog", true, set_config_log_syslog, get_config_log_syslog, clr_config_log_syslog, },
|
||||
{ "lxc.kmsg", true, set_config_noop, get_config_noop, clr_config_noop, },
|
||||
{ "lxc.loglevel", true, set_config_log_level, get_config_log_level, clr_config_log_level, },
|
||||
{ "lxc.logfile", true, set_config_log_file, get_config_log_file, clr_config_log_file, },
|
||||
{ "lxc.init_cmd", true, set_config_init_cmd, get_config_init_cmd, clr_config_init_cmd, },
|
||||
{ "lxc.init_uid", true, set_config_init_uid, get_config_init_uid, clr_config_init_uid, },
|
||||
{ "lxc.init_gid", true, set_config_init_gid, get_config_init_gid, clr_config_init_gid, },
|
||||
{ "lxc.limit", true, set_config_limit, get_config_limit, clr_config_limit, },
|
||||
{ "lxc.pivotdir", true, set_config_noop, get_config_noop, clr_config_noop, },
|
||||
/* [END]: REMOVE IN LXC 3.0 */
|
||||
{ "lxc.arch", set_config_personality, get_config_personality, clr_config_personality, },
|
||||
{ "lxc.apparmor.profile", set_config_apparmor_profile, get_config_apparmor_profile, clr_config_apparmor_profile, },
|
||||
{ "lxc.apparmor.allow_incomplete", set_config_apparmor_allow_incomplete, get_config_apparmor_allow_incomplete, clr_config_apparmor_allow_incomplete, },
|
||||
{ "lxc.autodev", set_config_autodev, get_config_autodev, clr_config_autodev, },
|
||||
{ "lxc.cap.drop", set_config_cap_drop, get_config_cap_drop, clr_config_cap_drop, },
|
||||
{ "lxc.cap.keep", set_config_cap_keep, get_config_cap_keep, clr_config_cap_keep, },
|
||||
{ "lxc.cgroup2", set_config_cgroup2_controller, get_config_cgroup2_controller, clr_config_cgroup2_controller, },
|
||||
{ "lxc.cgroup.dir", set_config_cgroup_dir, get_config_cgroup_dir, clr_config_cgroup_dir, },
|
||||
{ "lxc.cgroup", set_config_cgroup_controller, get_config_cgroup_controller, clr_config_cgroup_controller, },
|
||||
{ "lxc.console.buffer.logfile", set_config_console_buffer_logfile, get_config_console_buffer_logfile, clr_config_console_buffer_logfile, },
|
||||
{ "lxc.console.buffer.size", set_config_console_buffer_size, get_config_console_buffer_size, clr_config_console_buffer_size, },
|
||||
{ "lxc.console.logfile", set_config_console_logfile, get_config_console_logfile, clr_config_console_logfile, },
|
||||
{ "lxc.console.path", set_config_console_path, get_config_console_path, clr_config_console_path, },
|
||||
{ "lxc.console.rotate", set_config_console_rotate, get_config_console_rotate, clr_config_console_rotate, },
|
||||
{ "lxc.environment", set_config_environment, get_config_environment, clr_config_environment, },
|
||||
{ "lxc.ephemeral", set_config_ephemeral, get_config_ephemeral, clr_config_ephemeral, },
|
||||
{ "lxc.execute.cmd", set_config_execute_cmd, get_config_execute_cmd, clr_config_execute_cmd, },
|
||||
{ "lxc.group", set_config_group, get_config_group, clr_config_group, },
|
||||
{ "lxc.hook.autodev", set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.clone", set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.destroy", set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.mount", set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.post-stop", set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.pre-mount", set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.pre-start", set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.start", set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.start-host", set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.stop", set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.hook.version", set_config_hooks_version, get_config_hooks_version, clr_config_hooks_version, },
|
||||
{ "lxc.hook", set_config_hooks, get_config_hooks, clr_config_hooks, },
|
||||
{ "lxc.idmap", set_config_idmaps, get_config_idmaps, clr_config_idmaps, },
|
||||
{ "lxc.include", set_config_includefiles, get_config_includefiles, clr_config_includefiles, },
|
||||
{ "lxc.init.cmd", set_config_init_cmd, get_config_init_cmd, clr_config_init_cmd, },
|
||||
{ "lxc.init.gid", set_config_init_gid, get_config_init_gid, clr_config_init_gid, },
|
||||
{ "lxc.init.uid", set_config_init_uid, get_config_init_uid, clr_config_init_uid, },
|
||||
{ "lxc.init.cwd", set_config_init_cwd, get_config_init_cwd, clr_config_init_cwd, },
|
||||
{ "lxc.log.file", set_config_log_file, get_config_log_file, clr_config_log_file, },
|
||||
{ "lxc.log.level", set_config_log_level, get_config_log_level, clr_config_log_level, },
|
||||
{ "lxc.log.syslog", set_config_log_syslog, get_config_log_syslog, clr_config_log_syslog, },
|
||||
{ "lxc.monitor.unshare", set_config_monitor, get_config_monitor, clr_config_monitor, },
|
||||
{ "lxc.mount.auto", set_config_mount_auto, get_config_mount_auto, clr_config_mount_auto, },
|
||||
{ "lxc.mount.entry", set_config_mount, get_config_mount, clr_config_mount, },
|
||||
{ "lxc.mount.fstab", set_config_mount_fstab, get_config_mount_fstab, clr_config_mount_fstab, },
|
||||
{ "lxc.namespace.clone", set_config_namespace_clone, get_config_namespace_clone, clr_config_namespace_clone, },
|
||||
{ "lxc.namespace.keep", set_config_namespace_keep, get_config_namespace_keep, clr_config_namespace_keep, },
|
||||
{ "lxc.namespace.share", set_config_namespace_share, get_config_namespace_share, clr_config_namespace_share, },
|
||||
{ "lxc.net.flags", set_config_net_flags, get_config_net_flags, clr_config_net_flags, },
|
||||
{ "lxc.net.hwaddr", set_config_net_hwaddr, get_config_net_hwaddr, clr_config_net_hwaddr, },
|
||||
{ "lxc.net.ipv4.address", set_config_net_ipv4_address, get_config_net_ipv4_address, clr_config_net_ipv4_address, },
|
||||
{ "lxc.net.ipv4.gateway", set_config_net_ipv4_gateway, get_config_net_ipv4_gateway, clr_config_net_ipv4_gateway, },
|
||||
{ "lxc.net.ipv6.address", set_config_net_ipv6_address, get_config_net_ipv6_address, clr_config_net_ipv6_address, },
|
||||
{ "lxc.net.ipv6.gateway", set_config_net_ipv6_gateway, get_config_net_ipv6_gateway, clr_config_net_ipv6_gateway, },
|
||||
{ "lxc.net.link", set_config_net_link, get_config_net_link, clr_config_net_link, },
|
||||
{ "lxc.net.macvlan.mode", set_config_net_macvlan_mode, get_config_net_macvlan_mode, clr_config_net_macvlan_mode, },
|
||||
{ "lxc.net.mtu", set_config_net_mtu, get_config_net_mtu, clr_config_net_mtu, },
|
||||
{ "lxc.net.name", set_config_net_name, get_config_net_name, clr_config_net_name, },
|
||||
{ "lxc.net.script.down", set_config_net_script_down, get_config_net_script_down, clr_config_net_script_down, },
|
||||
{ "lxc.net.script.up", set_config_net_script_up, get_config_net_script_up, clr_config_net_script_up, },
|
||||
{ "lxc.net.type", set_config_net_type, get_config_net_type, clr_config_net_type, },
|
||||
{ "lxc.net.vlan.id", set_config_net_vlan_id, get_config_net_vlan_id, clr_config_net_vlan_id, },
|
||||
{ "lxc.net.veth.pair", set_config_net_veth_pair, get_config_net_veth_pair, clr_config_net_veth_pair, },
|
||||
{ "lxc.net.", set_config_net_nic, get_config_net_nic, clr_config_net_nic, },
|
||||
{ "lxc.net", set_config_net, get_config_net, clr_config_net, },
|
||||
{ "lxc.no_new_privs", set_config_no_new_privs, get_config_no_new_privs, clr_config_no_new_privs, },
|
||||
{ "lxc.prlimit", set_config_prlimit, get_config_prlimit, clr_config_prlimit, },
|
||||
{ "lxc.pty.max", set_config_pty_max, get_config_pty_max, clr_config_pty_max, },
|
||||
{ "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, },
|
||||
{ "lxc.seccomp.profile", set_config_seccomp_profile, get_config_seccomp_profile, clr_config_seccomp_profile, },
|
||||
{ "lxc.selinux.context", set_config_selinux_context, get_config_selinux_context, clr_config_selinux_context, },
|
||||
{ "lxc.signal.halt", set_config_signal_halt, get_config_signal_halt, clr_config_signal_halt, },
|
||||
{ "lxc.signal.reboot", set_config_signal_reboot, get_config_signal_reboot, clr_config_signal_reboot, },
|
||||
{ "lxc.signal.stop", set_config_signal_stop, get_config_signal_stop, clr_config_signal_stop, },
|
||||
{ "lxc.start.auto", set_config_start, get_config_start, clr_config_start, },
|
||||
{ "lxc.start.delay", set_config_start, get_config_start, clr_config_start, },
|
||||
{ "lxc.start.order", set_config_start, get_config_start, clr_config_start, },
|
||||
{ "lxc.tty.dir", set_config_tty_dir, get_config_tty_dir, clr_config_tty_dir, },
|
||||
{ "lxc.tty.max", set_config_tty_max, get_config_tty_max, clr_config_tty_max, },
|
||||
{ "lxc.uts.name", set_config_uts_name, get_config_uts_name, clr_config_uts_name, },
|
||||
{ "lxc.sysctl", set_config_sysctl, get_config_sysctl, clr_config_sysctl, },
|
||||
{ "lxc.proc", set_config_proc, get_config_proc, clr_config_proc, },
|
||||
};
|
||||
|
||||
struct signame {
|
||||
@ -2152,12 +2099,6 @@ static int set_config_rootfs_options(const char *key, const char *value,
|
||||
return set_config_string_item(&lxc_conf->rootfs.options, value);
|
||||
}
|
||||
|
||||
static int set_config_rootfs_backend(const char *key, const char *value,
|
||||
struct lxc_conf *lxc_conf, void *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_config_uts_name(const char *key, const char *value,
|
||||
struct lxc_conf *lxc_conf, void *data)
|
||||
{
|
||||
@ -2352,24 +2293,6 @@ static int parse_line(char *buffer, void *data)
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
/* [START]: REMOVE IN LXC 3.0 */
|
||||
if (config->is_legacy_key && !plc->conf->contains_legacy_key) {
|
||||
plc->conf->contains_legacy_key = true;
|
||||
if (getenv("LXC_UPDATE_CONFIG_FORMAT")) {
|
||||
/* Warn the user once loud and clear that there is at
|
||||
* least one legacy configuration item in the
|
||||
* configuration file and then an update is required.
|
||||
*/
|
||||
fprintf(stderr, "The configuration file contains "
|
||||
"legacy configuration keys.\nPlease "
|
||||
"update your configuration file!\nThe "
|
||||
"update script lxc-update-config -c "
|
||||
"<path-to-config> can be used for "
|
||||
"this.\n");
|
||||
}
|
||||
}
|
||||
/* [END]: REMOVE IN LXC 3.0 */
|
||||
|
||||
ret = config->set(key, value, plc->conf, NULL);
|
||||
|
||||
on_error:
|
||||
@ -2893,12 +2816,6 @@ static int set_config_no_new_privs(const char *key, const char *value,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_config_noop(const char *key, const char *value,
|
||||
struct lxc_conf *lxc_conf, void *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Callbacks to get configuration items. */
|
||||
static int get_config_personality(const char *key, char *retv, int inlen,
|
||||
struct lxc_conf *c, void *data)
|
||||
@ -3237,12 +3154,6 @@ static int get_config_rootfs_options(const char *key, char *retv, int inlen,
|
||||
return lxc_get_conf_str(retv, inlen, c->rootfs.options);
|
||||
}
|
||||
|
||||
static int get_config_rootfs_backend(const char *key, char *retv, int inlen,
|
||||
struct lxc_conf *c, void *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_config_uts_name(const char *key, char *retv, int inlen,
|
||||
struct lxc_conf *c, void *data)
|
||||
{
|
||||
@ -3643,12 +3554,6 @@ static int get_config_proc(const char *key, char *retv, int inlen,
|
||||
return fulllen;
|
||||
}
|
||||
|
||||
static int get_config_noop(const char *key, char *retv, int inlen,
|
||||
struct lxc_conf *c, void *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_config_namespace_clone(const char *key, char *retv, int inlen,
|
||||
struct lxc_conf *c, void *data)
|
||||
{
|
||||
@ -3851,12 +3756,6 @@ static inline int clr_config_rootfs_options(const char *key, struct lxc_conf *c,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int clr_config_rootfs_backend(const char *key, struct lxc_conf *c,
|
||||
void *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int clr_config_uts_name(const char *key, struct lxc_conf *c,
|
||||
void *data)
|
||||
{
|
||||
@ -4091,12 +3990,6 @@ static inline int clr_config_includefiles(const char *key, struct lxc_conf *c,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int clr_config_noop(const char *key, struct lxc_conf *c,
|
||||
void *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int clr_config_namespace_clone(const char *key,
|
||||
struct lxc_conf *lxc_conf, void *data)
|
||||
{
|
||||
|
@ -53,7 +53,6 @@ typedef int (*config_clr_cb)(const char *key, struct lxc_conf *conf,
|
||||
|
||||
struct lxc_config_t {
|
||||
char *name;
|
||||
bool is_legacy_key; /* REMOVE in LXC 3.0 */
|
||||
config_set_cb set;
|
||||
config_get_cb get;
|
||||
config_clr_cb clr;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* lxc: linux Container library
|
||||
*
|
||||
* (C) Copyright IBM Corp. 2007, 2008
|
||||
*
|
||||
* Authors:
|
||||
* Daniel Lezcano <daniel.lezcano at free.fr>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __LXC_CONFILE_LEGACY_H
|
||||
#define __LXC_CONFILE_LEGACY_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <lxc/attach_options.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
struct lxc_conf;
|
||||
struct lxc_list;
|
||||
|
||||
extern int set_config_network_legacy_type(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int set_config_network_legacy_flags(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int set_config_network_legacy_link(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int set_config_network_legacy_name(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int set_config_network_legacy_veth_pair(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int set_config_network_legacy_macvlan_mode(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int set_config_network_legacy_hwaddr(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int set_config_network_legacy_vlan_id(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int set_config_network_legacy_mtu(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int set_config_network_legacy_ipv4(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int set_config_network_legacy_ipv4_gateway(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int set_config_network_legacy_script_up(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int set_config_network_legacy_script_down(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int set_config_network_legacy_ipv6(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int set_config_network_legacy_ipv6_gateway(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int set_config_network_legacy_nic(const char *, const char *,
|
||||
struct lxc_conf *, void *);
|
||||
extern int get_config_network_legacy_item(const char *, char *, int,
|
||||
struct lxc_conf *, void *);
|
||||
extern int clr_config_network_legacy_item(const char *, struct lxc_conf *,
|
||||
void *);
|
||||
|
||||
extern int lxc_list_nicconfigs_legacy(struct lxc_conf *c, const char *key,
|
||||
char *retv, int inlen);
|
||||
extern int lxc_listconfigs(char *retv, int inlen);
|
||||
|
||||
extern bool network_new_hwaddrs(struct lxc_conf *conf);
|
||||
|
||||
#define lxc_config_legacy_define(name) \
|
||||
extern int set_config_##name(const char *, const char *, \
|
||||
struct lxc_conf *, void *); \
|
||||
extern int get_config_##name(const char *, char *, int, \
|
||||
struct lxc_conf *, void *); \
|
||||
extern int clr_config_##name(const char *, struct lxc_conf *, \
|
||||
void *);
|
||||
|
||||
lxc_config_legacy_define(network_legacy);
|
||||
lxc_config_legacy_define(lsm_aa_profile);
|
||||
lxc_config_legacy_define(lsm_aa_incomplete);
|
||||
lxc_config_legacy_define(lsm_se_context);
|
||||
lxc_config_legacy_define(limit);
|
||||
|
||||
#endif /* __LXC_CONFILE_LEGACY_H */
|
@ -46,7 +46,6 @@
|
||||
#include "commands.h"
|
||||
#include "commands_utils.h"
|
||||
#include "confile.h"
|
||||
#include "confile_legacy.h"
|
||||
#include "confile_utils.h"
|
||||
#include "console.h"
|
||||
#include "criu.h"
|
||||
@ -2380,10 +2379,8 @@ static int do_lxcapi_get_keys(struct lxc_container *c, const char *key, char *re
|
||||
* This is an intelligent result to show which keys are valid given the
|
||||
* type of nic it is.
|
||||
*/
|
||||
if (!strncmp(key, "lxc.net.", 8))
|
||||
if (strncmp(key, "lxc.net.", 8) == 0)
|
||||
ret = lxc_list_net(c->lxc_conf, key, retv, inlen);
|
||||
else if (strncmp(key, "lxc.network.", 12) == 0)
|
||||
ret = lxc_list_nicconfigs_legacy(c->lxc_conf, key, retv, inlen);
|
||||
else
|
||||
ret = lxc_list_subkeys(c->lxc_conf, key, retv, inlen);
|
||||
|
||||
@ -3192,11 +3189,6 @@ static int copy_fstab(struct lxc_container *oldc, struct lxc_container *c)
|
||||
if (!oldpath)
|
||||
return 0;
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy mount key
|
||||
*/
|
||||
clear_unexp_config_line(c->lxc_conf, "lxc.mount", false);
|
||||
|
||||
clear_unexp_config_line(c->lxc_conf, "lxc.mount.fstab", false);
|
||||
|
||||
char *p = strrchr(oldpath, '/');
|
||||
@ -3330,11 +3322,6 @@ static int copy_storage(struct lxc_container *c0, struct lxc_container *c,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
* legacy rootfs key
|
||||
*/
|
||||
clear_unexp_config_line(c->lxc_conf, "lxc.rootfs", false);
|
||||
|
||||
/* 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",
|
||||
@ -3343,11 +3330,6 @@ static int copy_storage(struct lxc_container *c0, struct lxc_container *c,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* 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)
|
||||
copy_rdepends(c, c0);
|
||||
if (need_rdep) {
|
||||
@ -3569,11 +3551,6 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
|
||||
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);
|
||||
|
@ -3014,13 +3014,6 @@ int lxc_setup_network_in_child_namespaces(const struct lxc_conf *conf,
|
||||
lxc_list_for_each(iterator, network) {
|
||||
netdev = iterator->elem;
|
||||
|
||||
/* REMOVE in LXC 3.0 */
|
||||
if (netdev->idx < 0) {
|
||||
ERROR("WARNING: using \"lxc.network.*\" keys to define "
|
||||
"networks is DEPRECATED, please switch to using "
|
||||
"\"lxc.net.[i].* keys\"");
|
||||
}
|
||||
|
||||
if (lxc_setup_netdev_in_child_namespaces(netdev)) {
|
||||
ERROR("failed to setup netdev");
|
||||
return -1;
|
||||
|
@ -291,9 +291,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
struct lxc_container *c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
|
||||
if (!c)
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -357,9 +357,6 @@ int main(int argc, char *argv[])
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
count = list_defined_containers(my_args.lxcpath[0], NULL, &containers);
|
||||
|
||||
if (count < 0)
|
||||
|
@ -86,9 +86,6 @@ int main(int argc, char *argv[])
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
state_object = my_args.argv[0];
|
||||
|
||||
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
|
||||
|
@ -251,9 +251,6 @@ int main(int argc, char *argv[])
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
|
||||
if (!c) {
|
||||
fprintf(stderr, "System error loading %s\n", my_args.name);
|
||||
|
@ -205,8 +205,6 @@ int main(int argc, char *argv[])
|
||||
usage(argv[0]);
|
||||
}
|
||||
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
c1 = lxc_container_new(orig, lxcpath);
|
||||
if (!c1)
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -60,8 +60,6 @@ int main(int argc, char *argv[])
|
||||
struct lxc_config_items *i;
|
||||
const char *value;
|
||||
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
if (argc < 2 || strcmp(argv[1], "-h") == 0 ||
|
||||
strcmp(argv[1], "--help") == 0)
|
||||
usage(argv[0]);
|
||||
|
@ -111,9 +111,6 @@ int main(int argc, char *argv[])
|
||||
if (ret)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
|
||||
if (!c) {
|
||||
fprintf(stderr, "System error loading container\n");
|
||||
|
@ -179,9 +179,6 @@ int main(int argc, char *argv[])
|
||||
if (lxc_log_init(&log))
|
||||
exit(ret);
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
if (geteuid()) {
|
||||
if (access(my_args.lxcpath[0], O_RDONLY) < 0) {
|
||||
if (!my_args.quiet)
|
||||
|
@ -241,9 +241,6 @@ int main(int argc, char *argv[])
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
if (!my_args.template) {
|
||||
fprintf(stderr, "A template must be specified.\n");
|
||||
fprintf(stderr, "Use \"none\" if you really want a container without a rootfs.\n");
|
||||
|
@ -86,9 +86,6 @@ int main(int argc, char *argv[])
|
||||
if (my_args.quiet)
|
||||
quiet = true;
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
|
||||
if (!c) {
|
||||
if (!quiet)
|
||||
|
@ -123,9 +123,6 @@ int main(int argc, char *argv[])
|
||||
if (lxc_log_init(&log))
|
||||
goto err;
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
|
||||
if (!c) {
|
||||
fprintf(stderr, "%s doesn't exist\n", my_args.name);
|
||||
|
@ -159,9 +159,6 @@ int main(int argc, char *argv[])
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
|
||||
if (!c) {
|
||||
fprintf(stderr, "Failed to create lxc_container\n");
|
||||
|
@ -73,9 +73,6 @@ int main(int argc, char *argv[])
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
|
||||
if (!c) {
|
||||
fprintf(stderr, "No such container: %s:%s\n", my_args.lxcpath[0], my_args.name);
|
||||
|
@ -409,9 +409,6 @@ int main(int argc, char *argv[])
|
||||
if (lxc_log_init(&log))
|
||||
exit(ret);
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
if (print_info(my_args.name, my_args.lxcpath[0]) == 0)
|
||||
ret = EXIT_SUCCESS;
|
||||
|
||||
|
@ -228,9 +228,6 @@ int main(int argc, char *argv[])
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
struct lengths max_len = {
|
||||
/* default header length */
|
||||
.name_length = 4, /* NAME */
|
||||
@ -559,11 +556,6 @@ static int ls_get(struct ls **m, size_t *size, const struct lxc_arguments *args,
|
||||
* problem with the ovl_mkdir() function in
|
||||
* lxcoverlay.{c,h}. */
|
||||
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;
|
||||
|
||||
|
@ -521,9 +521,6 @@ int main(int argc, char *argv[])
|
||||
if (lxc_log_init(&log))
|
||||
exit(rc_main);
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
if (quit_monitord) {
|
||||
int ret = EXIT_SUCCESS;
|
||||
for (i = 0; i < my_args.lxcpath_cnt; i++) {
|
||||
|
@ -97,9 +97,6 @@ int main(int argc, char *argv[])
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
if (geteuid()) {
|
||||
if (access(my_args.lxcpath[0], O_RDONLY) < 0) {
|
||||
fprintf(stderr, "You lack access to %s\n",
|
||||
|
@ -206,9 +206,6 @@ int main(int argc, char *argv[])
|
||||
exit(err);
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
/*
|
||||
* rcfile possibilities:
|
||||
* 1. rcfile from random path specified in cli option
|
||||
|
@ -114,9 +114,6 @@ int main(int argc, char *argv[])
|
||||
if (lxc_log_init(&log))
|
||||
exit(ret);
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
/* Set default timeout */
|
||||
if (my_args.timeout == -2) {
|
||||
if (my_args.hardstop)
|
||||
|
@ -74,9 +74,6 @@ int main(int argc, char *argv[])
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
|
||||
if (!c) {
|
||||
fprintf(stderr, "No such container: %s:%s\n", my_args.lxcpath[0], my_args.name);
|
||||
|
@ -100,9 +100,6 @@ int main(int argc, char *argv[])
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
/* REMOVE IN LXC 3.0 */
|
||||
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
|
||||
|
||||
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
|
||||
if (!c)
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -84,10 +84,8 @@ static void do_function(void *arguments)
|
||||
return;
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
if (debug)
|
||||
c->set_config_item(c, "lxc.log.level", "DEBUG");
|
||||
c->set_config_item(c, "lxc.log", name);
|
||||
}
|
||||
|
||||
if (strcmp(args->mode, "create") == 0) {
|
||||
if (!c->is_defined(c)) {
|
||||
|
@ -44,28 +44,28 @@ int main(int argc, char *argv[])
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* EXPECT SUCCESS: lxc.syslog with valid value. */
|
||||
if (!c->set_config_item(c, "lxc.syslog", "local0")) {
|
||||
lxc_error("%s\n", "Failed to set lxc.syslog.\n");
|
||||
/* EXPECT SUCCESS: lxc.log.syslog with valid value. */
|
||||
if (!c->set_config_item(c, "lxc.log.syslog", "local0")) {
|
||||
lxc_error("%s\n", "Failed to set lxc.log.syslog.\n");
|
||||
goto out;
|
||||
}
|
||||
ret = c->get_config_item(c, "lxc.syslog", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.log.syslog", v2, 255);
|
||||
if (ret < 0) {
|
||||
lxc_error("Failed to retrieve lxc.syslog: %d.\n", ret);
|
||||
lxc_error("Failed to retrieve lxc.log.syslog: %d.\n", ret);
|
||||
goto out;
|
||||
}
|
||||
if (strcmp(v2, "local0") != 0) {
|
||||
lxc_error("Expected: local0 == %s.\n", v2);
|
||||
goto out;
|
||||
}
|
||||
lxc_debug("Retrieving value for lxc.syslog correctly returned: %s.\n", v2);
|
||||
lxc_debug("Retrieving value for lxc.log.syslog correctly returned: %s.\n", v2);
|
||||
|
||||
/* EXPECT FAILURE: lxc.syslog with invalid value. */
|
||||
if (c->set_config_item(c, "lxc.syslog", "NONSENSE")) {
|
||||
lxc_error("%s\n", "Succeeded int setting lxc.syslog to invalid value \"NONSENSE\".\n");
|
||||
/* EXPECT FAILURE: lxc.log.syslog with invalid value. */
|
||||
if (c->set_config_item(c, "lxc.log.syslog", "NONSENSE")) {
|
||||
lxc_error("%s\n", "Succeeded int setting lxc.log.syslog to invalid value \"NONSENSE\".\n");
|
||||
goto out;
|
||||
}
|
||||
lxc_debug("%s\n", "Successfully failed to set lxc.syslog to invalid value.\n");
|
||||
lxc_debug("%s\n", "Successfully failed to set lxc.log.syslog to invalid value.\n");
|
||||
|
||||
if (!c->set_config_item(c, "lxc.hook.pre-start", "hi there")) {
|
||||
fprintf(stderr, "%d: failed to set hook.pre-start\n", __LINE__);
|
||||
@ -78,22 +78,18 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
fprintf(stderr, "lxc.hook.pre-start returned %d %s\n", ret, v2);
|
||||
|
||||
ret = c->get_config_item(c, "lxc.network", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.net", v2, 255);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "%d: get_config_item returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
}
|
||||
fprintf(stderr, "%d: get_config_item(lxc.network) returned %d %s\n", __LINE__, ret, v2);
|
||||
fprintf(stderr, "%d: get_config_item(lxc.net) returned %d %s\n", __LINE__, ret, v2);
|
||||
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy lxc.tty key
|
||||
*/
|
||||
if (!c->set_config_item(c, "lxc.tty", "4")) {
|
||||
if (!c->set_config_item(c, "lxc.tty.max", "4")) {
|
||||
fprintf(stderr, "%d: failed to set tty\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
ret = c->get_config_item(c, "lxc.tty", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.tty.max", v2, 255);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "%d: get_config_item(lxc.tty) returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
@ -111,22 +107,22 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
printf("lxc.arch returned %d %s\n", ret, v2);
|
||||
|
||||
if (!c->set_config_item(c, "lxc.init_uid", "100")) {
|
||||
if (!c->set_config_item(c, "lxc.init.uid", "100")) {
|
||||
fprintf(stderr, "%d: failed to set init_uid\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
ret = c->get_config_item(c, "lxc.init_uid", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.init.uid", v2, 255);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "%d: get_config_item(lxc.init_uid) returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
}
|
||||
printf("lxc.init_uid returned %d %s\n", ret, v2);
|
||||
|
||||
if (!c->set_config_item(c, "lxc.init_gid", "100")) {
|
||||
if (!c->set_config_item(c, "lxc.init.gid", "100")) {
|
||||
fprintf(stderr, "%d: failed to set init_gid\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
ret = c->get_config_item(c, "lxc.init_gid", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.init.gid", v2, 255);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "%d: get_config_item(lxc.init_gid) returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
@ -136,13 +132,13 @@ int main(int argc, char *argv[])
|
||||
#define HNAME "hostname1"
|
||||
// demonstrate proper usage:
|
||||
char *alloced;
|
||||
if (!c->set_config_item(c, "lxc.utsname", HNAME)) {
|
||||
if (!c->set_config_item(c, "lxc.uts.name", HNAME)) {
|
||||
fprintf(stderr, "%d: failed to set utsname\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
|
||||
int len;
|
||||
len = c->get_config_item(c, "lxc.utsname", NULL, 0); // query the size of the string
|
||||
len = c->get_config_item(c, "lxc.uts.name", NULL, 0); // query the size of the string
|
||||
if (len < 0) {
|
||||
fprintf(stderr, "%d: get_config_item(lxc.utsname) returned %d\n", __LINE__, len);
|
||||
goto out;
|
||||
@ -157,7 +153,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
// now pass in the malloc'd array, and pass in length of string + 1: again
|
||||
// because we need room for the trailing \0
|
||||
ret = c->get_config_item(c, "lxc.utsname", alloced, len+1);
|
||||
ret = c->get_config_item(c, "lxc.uts.name", alloced, len+1);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "%d: get_config_item(lxc.utsname) returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
@ -180,69 +176,69 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
printf("lxc.mount.entry returned %d %s\n", ret, v2);
|
||||
|
||||
ret = c->get_config_item(c, "lxc.limit", v3, 2047);
|
||||
ret = c->get_config_item(c, "lxc.prlimit", v3, 2047);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "%d: get_config_item(limit) returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!c->set_config_item(c, "lxc.limit.nofile", "1234:unlimited")) {
|
||||
if (!c->set_config_item(c, "lxc.prlimit.nofile", "1234:unlimited")) {
|
||||
fprintf(stderr, "%d: failed to set limit.nofile\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
ret = c->get_config_item(c, "lxc.limit.nofile", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.prlimit.nofile", v2, 255);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "%d: get_config_item(lxc.limit.nofile) returned %d\n", __LINE__, ret);
|
||||
fprintf(stderr, "%d: get_config_item(lxc.prlimit.nofile) returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
}
|
||||
if (strcmp(v2, "1234:unlimited")) {
|
||||
fprintf(stderr, "%d: lxc.limit.nofile returned wrong value: %d %s not 14 1234:unlimited\n", __LINE__, ret, v2);
|
||||
fprintf(stderr, "%d: lxc.prlimit.nofile returned wrong value: %d %s not 14 1234:unlimited\n", __LINE__, ret, v2);
|
||||
goto out;
|
||||
}
|
||||
printf("lxc.limit.nofile returned %d %s\n", ret, v2);
|
||||
printf("lxc.prlimit.nofile returned %d %s\n", ret, v2);
|
||||
|
||||
if (!c->set_config_item(c, "lxc.limit.stack", "unlimited")) {
|
||||
if (!c->set_config_item(c, "lxc.prlimit.stack", "unlimited")) {
|
||||
fprintf(stderr, "%d: failed to set limit.stack\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
ret = c->get_config_item(c, "lxc.limit.stack", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.prlimit.stack", v2, 255);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "%d: get_config_item(lxc.limit.stack) returned %d\n", __LINE__, ret);
|
||||
fprintf(stderr, "%d: get_config_item(lxc.prlimit.stack) returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
}
|
||||
if (strcmp(v2, "unlimited")) {
|
||||
fprintf(stderr, "%d: lxc.limit.stack returned wrong value: %d %s not 9 unlimited\n", __LINE__, ret, v2);
|
||||
fprintf(stderr, "%d: lxc.prlimit.stack returned wrong value: %d %s not 9 unlimited\n", __LINE__, ret, v2);
|
||||
goto out;
|
||||
}
|
||||
printf("lxc.limit.stack returned %d %s\n", ret, v2);
|
||||
printf("lxc.prlimit.stack returned %d %s\n", ret, v2);
|
||||
|
||||
#define LIMIT_STACK "lxc.limit.stack = unlimited\n"
|
||||
#define ALL_LIMITS "lxc.limit.nofile = 1234:unlimited\n" LIMIT_STACK
|
||||
ret = c->get_config_item(c, "lxc.limit", v3, 2047);
|
||||
#define LIMIT_STACK "lxc.prlimit.stack = unlimited\n"
|
||||
#define ALL_LIMITS "lxc.prlimit.nofile = 1234:unlimited\n" LIMIT_STACK
|
||||
ret = c->get_config_item(c, "lxc.prlimit", v3, 2047);
|
||||
if (ret != sizeof(ALL_LIMITS)-1) {
|
||||
fprintf(stderr, "%d: get_config_item(limit) returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
}
|
||||
if (strcmp(v3, ALL_LIMITS)) {
|
||||
fprintf(stderr, "%d: lxc.limit returned wrong value: %d %s not %d %s\n", __LINE__, ret, v3, (int)sizeof(ALL_LIMITS)-1, ALL_LIMITS);
|
||||
fprintf(stderr, "%d: lxc.prlimit returned wrong value: %d %s not %d %s\n", __LINE__, ret, v3, (int)sizeof(ALL_LIMITS)-1, ALL_LIMITS);
|
||||
goto out;
|
||||
}
|
||||
printf("lxc.limit returned %d %s\n", ret, v3);
|
||||
printf("lxc.prlimit returned %d %s\n", ret, v3);
|
||||
|
||||
if (!c->clear_config_item(c, "lxc.limit.nofile")) {
|
||||
if (!c->clear_config_item(c, "lxc.prlimit.nofile")) {
|
||||
fprintf(stderr, "%d: failed clearing limit.nofile\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
ret = c->get_config_item(c, "lxc.limit", v3, 2047);
|
||||
ret = c->get_config_item(c, "lxc.prlimit", v3, 2047);
|
||||
if (ret != sizeof(LIMIT_STACK)-1) {
|
||||
fprintf(stderr, "%d: get_config_item(limit) returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
}
|
||||
if (strcmp(v3, LIMIT_STACK)) {
|
||||
fprintf(stderr, "%d: lxc.limit returned wrong value: %d %s not %d %s\n", __LINE__, ret, v3, (int)sizeof(LIMIT_STACK)-1, LIMIT_STACK);
|
||||
fprintf(stderr, "%d: lxc.prlimit returned wrong value: %d %s not %d %s\n", __LINE__, ret, v3, (int)sizeof(LIMIT_STACK)-1, LIMIT_STACK);
|
||||
goto out;
|
||||
}
|
||||
printf("lxc.limit returned %d %s\n", ret, v3);
|
||||
printf("lxc.prlimit returned %d %s\n", ret, v3);
|
||||
|
||||
#define SYSCTL_SOMAXCONN "lxc.sysctl.net.core.somaxconn = 256\n"
|
||||
#define ALL_SYSCTLS "lxc.sysctl.net.ipv4.ip_forward = 1\n" SYSCTL_SOMAXCONN
|
||||
@ -376,11 +372,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
printf("lxc.proc returned %d %s\n", ret, v3);
|
||||
|
||||
if (!c->set_config_item(c, "lxc.aa_profile", "unconfined")) {
|
||||
if (!c->set_config_item(c, "lxc.apparmor.profile", "unconfined")) {
|
||||
fprintf(stderr, "%d: failed to set aa_profile\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
ret = c->get_config_item(c, "lxc.aa_profile", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.apparmor.profile", v2, 255);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "%d: get_config_item(lxc.aa_profile) returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
@ -429,87 +425,87 @@ int main(int argc, char *argv[])
|
||||
goto out;
|
||||
}
|
||||
printf("%d: get_config_item(lxc.cap.drop) returned %d %s\n", __LINE__, ret, v2);
|
||||
ret = c->get_config_item(c, "lxc.network", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.net", v2, 255);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "%d: get_config_item(lxc.network) returned %d\n", __LINE__, ret);
|
||||
fprintf(stderr, "%d: get_config_item(lxc.net) returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
}
|
||||
printf("%d: get_config_item(lxc.network) returned %d %s\n", __LINE__, ret, v2);
|
||||
printf("%d: get_config_item(lxc.net) returned %d %s\n", __LINE__, ret, v2);
|
||||
|
||||
if (!c->set_config_item(c, "lxc.network.type", "veth")) {
|
||||
fprintf(stderr, "%d: failed to set network.type\n", __LINE__);
|
||||
if (!c->set_config_item(c, "lxc.net.0.type", "veth")) {
|
||||
fprintf(stderr, "%d: failed to set lxc.net.0.type\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
if (!c->set_config_item(c, "lxc.network.link", "lxcbr0")) {
|
||||
if (!c->set_config_item(c, "lxc.net.0.link", "lxcbr0")) {
|
||||
fprintf(stderr, "%d: failed to set network.link\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
if (!c->set_config_item(c, "lxc.network.flags", "up")) {
|
||||
if (!c->set_config_item(c, "lxc.net.0.flags", "up")) {
|
||||
fprintf(stderr, "%d: failed to set network.flags\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
if (!c->set_config_item(c, "lxc.network.hwaddr", "00:16:3e:xx:xx:xx")) {
|
||||
if (!c->set_config_item(c, "lxc.net.0.hwaddr", "00:16:3e:xx:xx:xx")) {
|
||||
fprintf(stderr, "%d: failed to set network.hwaddr\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
if (!c->set_config_item(c, "lxc.network.ipv4", "10.2.3.4")) {
|
||||
if (!c->set_config_item(c, "lxc.net.0.ipv4.address", "10.2.3.4")) {
|
||||
fprintf(stderr, "%d: failed to set ipv4\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = c->get_config_item(c, "lxc.network.0.ipv4", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.net.0.ipv4.address", v2, 255);
|
||||
if (ret <= 0) {
|
||||
fprintf(stderr, "%d: lxc.network.0.ipv4 returned %d\n", __LINE__, ret);
|
||||
fprintf(stderr, "%d: lxc.net.0.ipv4 returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
}
|
||||
if (!c->clear_config_item(c, "lxc.network.0.ipv4")) {
|
||||
if (!c->clear_config_item(c, "lxc.net.0.ipv4.address")) {
|
||||
fprintf(stderr, "%d: failed clearing all ipv4 entries\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
ret = c->get_config_item(c, "lxc.network.0.ipv4", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.net.0.ipv4.address", v2, 255);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "%d: after clearing ipv4 entries get_item(lxc.network.0.ipv4 returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!c->set_config_item(c, "lxc.network.ipv4.gateway", "10.2.3.254")) {
|
||||
if (!c->set_config_item(c, "lxc.net.0.ipv4.gateway", "10.2.3.254")) {
|
||||
fprintf(stderr, "%d: failed to set ipv4.gateway\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = c->get_config_item(c, "lxc.network.0.ipv4.gateway", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.net.0.ipv4.gateway", v2, 255);
|
||||
if (ret <= 0) {
|
||||
fprintf(stderr, "%d: lxc.network.0.ipv4.gateway returned %d\n", __LINE__, ret);
|
||||
fprintf(stderr, "%d: lxc.net.0.ipv4.gateway returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
}
|
||||
if (!c->set_config_item(c, "lxc.network.0.ipv4.gateway", "")) {
|
||||
if (!c->set_config_item(c, "lxc.net.0.ipv4.gateway", "")) {
|
||||
fprintf(stderr, "%d: failed clearing ipv4.gateway\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
ret = c->get_config_item(c, "lxc.network.0.ipv4.gateway", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.net.0.ipv4.gateway", v2, 255);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "%d: after clearing ipv4.gateway get_item(lxc.network.0.ipv4.gateway returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = c->get_config_item(c, "lxc.network.0.link", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.net.0.link", v2, 255);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "%d: get_config_item returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
}
|
||||
printf("%d: get_config_item (link) returned %d %s\n", __LINE__, ret, v2);
|
||||
ret = c->get_config_item(c, "lxc.network.0.name", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.net.0.name", v2, 255);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "%d: get_config_item returned %d\n", __LINE__, ret);
|
||||
goto out;
|
||||
}
|
||||
printf("%d: get_config_item (name) returned %d %s\n", __LINE__, ret, v2);
|
||||
|
||||
if (!c->clear_config_item(c, "lxc.network")) {
|
||||
if (!c->clear_config_item(c, "lxc.net")) {
|
||||
fprintf(stderr, "%d: clear_config_item failed\n", __LINE__);
|
||||
goto out;
|
||||
}
|
||||
ret = c->get_config_item(c, "lxc.network", v2, 255);
|
||||
ret = c->get_config_item(c, "lxc.net", v2, 255);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "%d: network was not actually cleared (get_network returned %d)\n", __LINE__, ret);
|
||||
goto out;
|
||||
|
@ -43,7 +43,7 @@ int main(int argc, char *argv[])
|
||||
goto out;
|
||||
}
|
||||
|
||||
c->set_config_item(c, "lxc.network.type", "veth");
|
||||
c->set_config_item(c, "lxc.net.0.type", "veth");
|
||||
|
||||
len = c->get_keys(c, NULL, NULL, 0);
|
||||
if (len < 0) {
|
||||
@ -59,7 +59,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
printf("get_keys returned %d\n%s", ret, v3);
|
||||
|
||||
ret = c->get_keys(c, "lxc.network.0", v3, 2000);
|
||||
ret = c->get_keys(c, "lxc.net.0", v3, 2000);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "%d: failed to get nic 0 keys(%d)\n", __LINE__, ret);
|
||||
ret = 1;
|
||||
|
@ -498,10 +498,6 @@ void test_lxc_config_net_hwaddr(void)
|
||||
|
||||
if (!lxc_config_net_hwaddr("lxc.net.0.hwaddr = 00:16:3e:04:65:b8\n"))
|
||||
exit(EXIT_FAILURE);
|
||||
if (!lxc_config_net_hwaddr("lxc.network.hwaddr = 00:16:3e:04:65:b8\n"))
|
||||
exit(EXIT_FAILURE);
|
||||
if (!lxc_config_net_hwaddr("lxc.net.hwaddr = 00:16:3e:04:65:b8\n"))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
if (lxc_config_net_hwaddr("lxc.net"))
|
||||
exit(EXIT_FAILURE);
|
||||
@ -509,10 +505,6 @@ void test_lxc_config_net_hwaddr(void)
|
||||
exit(EXIT_FAILURE);
|
||||
if (lxc_config_net_hwaddr("lxc.net.0."))
|
||||
exit(EXIT_FAILURE);
|
||||
if (lxc_config_net_hwaddr("lxc.network"))
|
||||
exit(EXIT_FAILURE);
|
||||
if (lxc_config_net_hwaddr("lxc.network.0."))
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
@ -171,11 +171,6 @@ static int set_invalid_netdev(struct lxc_container *c) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (c->set_config_item(c, "lxc.network.0.", "veth")) {
|
||||
lxc_error("%s\n", "lxc.network.0. should be invalid");
|
||||
return -1;
|
||||
}
|
||||
|
||||
c->clear_config(c);
|
||||
c->lxc_conf = NULL;
|
||||
|
||||
@ -330,9 +325,9 @@ int main(int argc, char *argv[])
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy ps keys
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.pts", "1000", tmpf, true) <
|
||||
if (set_get_compare_clear_save_load(c, "lxc.pty.max", "1000", tmpf, true) <
|
||||
0) {
|
||||
lxc_error("%s\n", "lxc.pts");
|
||||
lxc_error("%s\n", "lxc.pty.max");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
@ -343,15 +338,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy tty.max keys
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.tty", "4", tmpf, true) <
|
||||
0) {
|
||||
lxc_error("%s\n", "lxc.tty");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* lxc.tty.max */
|
||||
if (set_get_compare_clear_save_load(c, "lxc.tty.max", "4", tmpf, true) <
|
||||
0) {
|
||||
@ -359,15 +345,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy devttydir keys
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.devttydir", "not-dev", tmpf,
|
||||
true) < 0) {
|
||||
lxc_error("%s\n", "lxc.devttydir");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* lxc.tty.dir */
|
||||
if (set_get_compare_clear_save_load(c, "lxc.tty.dir", "not-dev", tmpf,
|
||||
true) < 0) {
|
||||
@ -375,33 +352,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy security keys
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.aa_profile", "unconfined",
|
||||
tmpf, true) < 0) {
|
||||
lxc_error("%s\n", "lxc.aa_profile");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy security keys
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.aa_allow_incomplete", "1",
|
||||
tmpf, true) < 0) {
|
||||
lxc_error("%s\n", "lxc.aa_allow_incomplete");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy security keys
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.se_context", "system_u:system_r:lxc_t:s0:c22",
|
||||
tmpf, true) < 0) {
|
||||
lxc_error("%s\n", "lxc.se_context");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* lxc.apparmor.profile */
|
||||
if (set_get_compare_clear_save_load(c, "lxc.apparmor.profile", "unconfined",
|
||||
tmpf, true) < 0) {
|
||||
@ -454,34 +404,6 @@ int main(int argc, char *argv[])
|
||||
c->clear_config(c);
|
||||
c->lxc_conf = NULL;
|
||||
|
||||
/* lxc.id_map
|
||||
* We can't really save the config here since save_config() wants to
|
||||
* chown the container's directory but we haven't created an on-disk
|
||||
* container. So let's test set-get-clear.
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(
|
||||
c, "lxc.id_map", "u 0 100000 1000000000", NULL, false) < 0) {
|
||||
lxc_error("%s\n", "lxc.id_map");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
if (!c->set_config_item(c, "lxc.id_map", "u 1 100000 10000000")) {
|
||||
lxc_error("%s\n", "failed to set config item "
|
||||
"\"lxc.id_map\" to \"u 1 100000 10000000\"");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!c->set_config_item(c, "lxc.id_map", "g 1 100000 10000000")) {
|
||||
lxc_error("%s\n", "failed to set config item "
|
||||
"\"lxc.id_map\" to \"g 1 100000 10000000\"");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!c->get_config_item(c, "lxc.id_map", retval, sizeof(retval))) {
|
||||
lxc_error("%s\n", "failed to get config item \"lxc.id_map\"");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* lxc.idmap
|
||||
* We can't really save the config here since save_config() wants to
|
||||
* chown the container's directory but we haven't created an on-disk
|
||||
@ -513,25 +435,6 @@ int main(int argc, char *argv[])
|
||||
c->clear_config(c);
|
||||
c->lxc_conf = NULL;
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy lxc.loglevel key
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.loglevel", "DEBUG", tmpf,
|
||||
true) < 0) {
|
||||
lxc_error("%s\n", "lxc.loglevel");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy lxc.logfile key
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.logfile", "/some/path",
|
||||
tmpf, true) < 0) {
|
||||
lxc_error("%s\n", "lxc.logfile");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
|
||||
/* lxc.log.level */
|
||||
if (set_get_compare_clear_save_load(c, "lxc.log.level", "DEBUG", tmpf,
|
||||
true) < 0) {
|
||||
@ -546,15 +449,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy lxc.mount key
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.mount", "/some/path", NULL,
|
||||
true) < 0) {
|
||||
lxc_error("%s\n", "lxc.mount");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* lxc.mount.fstab */
|
||||
if (set_get_compare_clear_save_load(c, "lxc.mount.fstab", "/some/path", NULL,
|
||||
true) < 0) {
|
||||
@ -585,15 +479,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
@ -615,15 +500,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
@ -710,15 +586,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy lxc.console key
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.console", "none", tmpf,
|
||||
true) < 0) {
|
||||
lxc_error("%s\n", "lxc.console");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* lxc.console.path */
|
||||
if (set_get_compare_clear_save_load(c, "lxc.console.path", "none", tmpf,
|
||||
true) < 0) {
|
||||
@ -733,15 +600,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy seccomp key
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(
|
||||
c, "lxc.seccomp", "/some/seccomp/file", tmpf, true) < 0) {
|
||||
lxc_error("%s\n", "lxc.seccomp");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* lxc.seccomp.profile */
|
||||
if (set_get_compare_clear_save_load(
|
||||
c, "lxc.seccomp.profile", "/some/seccomp/file", tmpf, true) < 0) {
|
||||
@ -756,15 +614,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy lxc.haltsignal key
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.haltsignal", "1", tmpf,
|
||||
true) < 0) {
|
||||
lxc_error("%s\n", "lxc.haltsignal");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* lxc.signal.halt */
|
||||
if (set_get_compare_clear_save_load(c, "lxc.signal.halt", "1", tmpf,
|
||||
true) < 0) {
|
||||
@ -772,15 +621,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy lxc.rebootsignal key
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.rebootsignal", "1", tmpf,
|
||||
true) < 0) {
|
||||
lxc_error("%s\n", "lxc.rebootsignal");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* lxc.signal.reboot */
|
||||
if (set_get_compare_clear_save_load(c, "lxc.signal.reboot", "1", tmpf,
|
||||
true) < 0) {
|
||||
@ -788,15 +628,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy lxc.stopsignal key
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.stopsignal", "1", tmpf,
|
||||
true) < 0) {
|
||||
lxc_error("%s\n", "lxc.stopsignal");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* lxc.signal.stop */
|
||||
if (set_get_compare_clear_save_load(c, "lxc.signal.stop", "1", tmpf,
|
||||
true) < 0) {
|
||||
@ -832,13 +663,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* lxc.utsname */
|
||||
if (set_get_compare_clear_save_load(c, "lxc.utsname", "get-schwifty",
|
||||
tmpf, true) < 0) {
|
||||
lxc_error("%s\n", "lxc.utsname");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* lxc.monitor.unshare */
|
||||
if (set_get_compare_clear_save_load(c, "lxc.monitor.unshare", "1", tmpf,
|
||||
true) < 0) {
|
||||
@ -860,15 +684,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy lxc.init_cmd key
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.init_cmd", "/bin/bash",
|
||||
tmpf, true) < 0) {
|
||||
lxc_error("%s\n", "lxc.init_cmd");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* lxc.init.cmd */
|
||||
if (set_get_compare_clear_save_load(c, "lxc.init.cmd", "/bin/bash",
|
||||
tmpf, true) < 0) {
|
||||
@ -876,15 +691,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy lxc.init_uid key
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.init_uid", "1000", tmpf,
|
||||
true) < 0) {
|
||||
lxc_error("%s\n", "lxc.init_uid");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* lxc.init.uid */
|
||||
if (set_get_compare_clear_save_load(c, "lxc.init.uid", "1000", tmpf,
|
||||
true) < 0) {
|
||||
@ -892,15 +698,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy lxc.init_gid key
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.init_gid", "1000", tmpf,
|
||||
true) < 0) {
|
||||
lxc_error("%s\n", "lxc.init_gid");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* lxc.init.gid */
|
||||
if (set_get_compare_clear_save_load(c, "lxc.init.gid", "1000", tmpf,
|
||||
true) < 0) {
|
||||
@ -936,15 +733,6 @@ int main(int argc, char *argv[])
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* REMOVE IN LXC 3.0
|
||||
legacy lxc.limit.* key
|
||||
*/
|
||||
if (set_get_compare_clear_save_load(c, "lxc.limit.nofile", "65536",
|
||||
tmpf, true) < 0) {
|
||||
lxc_error("%s\n", "lxc.limit.nofile");
|
||||
goto non_test_error;
|
||||
}
|
||||
|
||||
/* lxc.prlimit.nofile */
|
||||
if (set_get_compare_clear_save_load(c, "lxc.prlimit.nofile", "65536",
|
||||
tmpf, true) < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user