]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf{,ile}: warn user once about legacy config 1750/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 21 Aug 2017 16:06:20 +0000 (18:06 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 21 Aug 2017 16:06:20 +0000 (18:06 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.h
src/lxc/confile.c
src/lxc/confile.h

index 4d3f6d78ff65c2df9784d7679e7ec21718ecdde7..9dd16250ab636451eda3cd02a097f7ec4865b49e 100644 (file)
@@ -408,6 +408,12 @@ 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;
 };
 
 #ifdef HAVE_TLS
index ace666642900db11e2549648af7421d3a5a22e43..82de6979adcfe9328d99ab44629c51599d319599 100644 (file)
@@ -137,138 +137,139 @@ lxc_config_define(no_new_privs);
 lxc_config_define(prlimit);
 
 static struct lxc_config_t config[] = {
-       { "lxc.arch",                      set_config_personality,                 get_config_personality,                 clr_config_personality,               },
-       { "lxc.pty.max",                   set_config_pty_max,                     get_config_pty_max,                     clr_config_pty_max,                   },
-       { "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,                   },
+                                           /* REMOVE in LXC 3.0 */
+       { "lxc.arch",                      false,                  set_config_personality,                 get_config_personality,                 clr_config_personality,               },
+       { "lxc.pty.max",                   false,                  set_config_pty_max,                     get_config_pty_max,                     clr_config_pty_max,                   },
+       { "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,                   },
 
        /* [START]: REMOVE IN LXC 3.0 */
-       { "lxc.pts",                       set_config_pty_max,                     get_config_pty_max,                     clr_config_pty_max,                   },
-       { "lxc.devttydir",                 set_config_tty_dir,                     get_config_tty_dir,                     clr_config_tty_dir,                   },
-       { "lxc.tty",                       set_config_tty_max,                     get_config_tty_max,                     clr_config_tty_max,                   },
+       { "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,                   },
        /* [END]: REMOVE IN LXC 3.0 */
 
-       { "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.selinux.context",           set_config_selinux_context,             get_config_selinux_context,             clr_config_selinux_context,           },
+       { "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.selinux.context",           false,                  set_config_selinux_context,             get_config_selinux_context,             clr_config_selinux_context,           },
 
        /* [START]: REMOVE IN LXC 3.0 */
-       { "lxc.aa_profile",                set_config_lsm_aa_profile,              get_config_lsm_aa_profile,              clr_config_lsm_aa_profile,            },
-       { "lxc.aa_allow_incomplete",       set_config_lsm_aa_incomplete,           get_config_lsm_aa_incomplete,           clr_config_lsm_aa_incomplete,         },
-       { "lxc.se_context",                set_config_lsm_se_context,              get_config_lsm_se_context,              clr_config_lsm_se_context,            },
+       { "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,            },
        /* [END]: REMOVE IN LXC 3.0 */
 
-       { "lxc.cgroup",                    set_config_cgroup,                      get_config_cgroup,                      clr_config_cgroup,                    },
-       { "lxc.idmap",                     set_config_idmaps,                      get_config_idmaps,                      clr_config_idmaps,                    },
-       { "lxc.mount.entry",               set_config_mount,                       get_config_mount,                       clr_config_mount,                     },
-       { "lxc.mount.auto",                set_config_mount_auto,                  get_config_mount_auto,                  clr_config_mount_auto,                },
-       { "lxc.mount.fstab",               set_config_mount_fstab,                 get_config_mount_fstab,                 clr_config_mount_fstab,               },
-       { "lxc.rootfs.mount",              set_config_rootfs_mount,                get_config_rootfs_mount,                clr_config_rootfs_mount,              },
-       { "lxc.rootfs.options",            set_config_rootfs_options,              get_config_rootfs_options,              clr_config_rootfs_options,            },
-       { "lxc.rootfs.path",               set_config_rootfs_path,                 get_config_rootfs_path,                 clr_config_rootfs_path,               },
+       { "lxc.cgroup",                    false,                  set_config_cgroup,                      get_config_cgroup,                      clr_config_cgroup,                    },
+       { "lxc.idmap",                     false,                  set_config_idmaps,                      get_config_idmaps,                      clr_config_idmaps,                    },
+       { "lxc.mount.entry",               false,                  set_config_mount,                       get_config_mount,                       clr_config_mount,                     },
+       { "lxc.mount.auto",                false,                  set_config_mount_auto,                  get_config_mount_auto,                  clr_config_mount_auto,                },
+       { "lxc.mount.fstab",               false,                  set_config_mount_fstab,                 get_config_mount_fstab,                 clr_config_mount_fstab,               },
+       { "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,               },
 
        /* [START]: REMOVE IN LXC 3.0 */
-       { "lxc.id_map",                    set_config_idmaps,                      get_config_idmaps,                      clr_config_idmaps,                    },
-       { "lxc.mount",                     set_config_mount_fstab,                 get_config_mount_fstab,                 clr_config_mount_fstab,               },
-       { "lxc.rootfs.backend",            set_config_rootfs_backend,              get_config_rootfs_backend,              clr_config_rootfs_backend,            },
-       { "lxc.rootfs",                    set_config_rootfs_path,                 get_config_rootfs_path,                 clr_config_rootfs_path,               },
-       { "lxc.utsname",                   set_config_uts_name,                    get_config_uts_name,                    clr_config_uts_name,                  },
+       { "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,                  },
        /* [END]: REMOVE IN LXC 3.0 */
 
-       { "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,                     },
-       { "lxc.hook.autodev",              set_config_hooks,                       get_config_hooks,                       clr_config_hooks,                     },
-       { "lxc.hook.start",                set_config_hooks,                       get_config_hooks,                       clr_config_hooks,                     },
-       { "lxc.hook.stop",                 set_config_hooks,                       get_config_hooks,                       clr_config_hooks,                     },
-       { "lxc.hook.post-stop",            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",                      set_config_hooks,                       get_config_hooks,                       clr_config_hooks,                     },
+       { "lxc.uts.name",                  false,                  set_config_uts_name,                    get_config_uts_name,                    clr_config_uts_name,                  },
+       { "lxc.hook.pre-start",            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.mount",                false,                  set_config_hooks,                       get_config_hooks,                       clr_config_hooks,                     },
+       { "lxc.hook.autodev",              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.stop",                 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.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",                      false,                  set_config_hooks,                       get_config_hooks,                       clr_config_hooks,                     },
 
        /* [START]: REMOVE IN LXC 3.0 */
-       { "lxc.network.type",              set_config_network_legacy_type,         get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network.flags",             set_config_network_legacy_flags,        get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network.link",              set_config_network_legacy_link,         get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network.name",              set_config_network_legacy_name,         get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network.macvlan.mode",      set_config_network_legacy_macvlan_mode, get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network.veth.pair",         set_config_network_legacy_veth_pair,    get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network.script.up",         set_config_network_legacy_script_up,    get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network.script.down",       set_config_network_legacy_script_down,  get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network.hwaddr",            set_config_network_legacy_hwaddr,       get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network.mtu",               set_config_network_legacy_mtu,          get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network.vlan.id",           set_config_network_legacy_vlan_id,      get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network.ipv4.gateway",      set_config_network_legacy_ipv4_gateway, get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network.ipv4",              set_config_network_legacy_ipv4,         get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network.ipv6.gateway",      set_config_network_legacy_ipv6_gateway, get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network.ipv6",              set_config_network_legacy_ipv6,         get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network.",                  set_config_network_legacy_nic,          get_config_network_legacy_item,         clr_config_network_legacy_item,       },
-       { "lxc.network",                   set_config_network_legacy,              get_config_network_legacy,              clr_config_network_legacy,            },
+       { "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.type",                  set_config_net_type,                    get_config_net_type,                    clr_config_net_type,                  },
-       { "lxc.net.flags",                 set_config_net_flags,                   get_config_net_flags,                   clr_config_net_flags,                 },
-       { "lxc.net.link",                  set_config_net_link,                    get_config_net_link,                    clr_config_net_link,                  },
-       { "lxc.net.name",                  set_config_net_name,                    get_config_net_name,                    clr_config_net_name,                  },
-       { "lxc.net.macvlan.mode",          set_config_net_macvlan_mode,            get_config_net_macvlan_mode,            clr_config_net_macvlan_mode,          },
-       { "lxc.net.veth.pair",             set_config_net_veth_pair,               get_config_net_veth_pair,               clr_config_net_veth_pair,             },
-       { "lxc.net.script.up",             set_config_net_script_up,               get_config_net_script_up,               clr_config_net_script_up,             },
-       { "lxc.net.script.down",           set_config_net_script_down,             get_config_net_script_down,             clr_config_net_script_down,           },
-       { "lxc.net.hwaddr",                set_config_net_hwaddr,                  get_config_net_hwaddr,                  clr_config_net_hwaddr,                },
-       { "lxc.net.mtu",                   set_config_net_mtu,                     get_config_net_mtu,                     clr_config_net_mtu,                   },
-       { "lxc.net.vlan.id",               set_config_net_vlan_id,                 get_config_net_vlan_id,                 clr_config_net_vlan_id,               },
-       { "lxc.net.ipv4.gateway",          set_config_net_ipv4_gateway,            get_config_net_ipv4_gateway,            clr_config_net_ipv4_gateway,          },
-       { "lxc.net.ipv4.address",          set_config_net_ipv4_address,            get_config_net_ipv4_address,            clr_config_net_ipv4_address,          },
-       { "lxc.net.ipv6.gateway",          set_config_net_ipv6_gateway,            get_config_net_ipv6_gateway,            clr_config_net_ipv6_gateway,          },
-       { "lxc.net.ipv6.address",          set_config_net_ipv6_address,            get_config_net_ipv6_address,            clr_config_net_ipv6_address,          },
-       { "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.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.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.seccomp.profile",           set_config_seccomp_profile,             get_config_seccomp_profile,             clr_config_seccomp_profile,           },
-       { "lxc.include",                   set_config_includefiles,                get_config_includefiles,                clr_config_includefiles,              },
-       { "lxc.autodev",                   set_config_autodev,                     get_config_autodev,                     clr_config_autodev,                   },
+       { "lxc.net.type",                  false,                  set_config_net_type,                    get_config_net_type,                    clr_config_net_type,                  },
+       { "lxc.net.flags",                 false,                  set_config_net_flags,                   get_config_net_flags,                   clr_config_net_flags,                 },
+       { "lxc.net.link",                  false,                  set_config_net_link,                    get_config_net_link,                    clr_config_net_link,                  },
+       { "lxc.net.name",                  false,                  set_config_net_name,                    get_config_net_name,                    clr_config_net_name,                  },
+       { "lxc.net.macvlan.mode",          false,                  set_config_net_macvlan_mode,            get_config_net_macvlan_mode,            clr_config_net_macvlan_mode,          },
+       { "lxc.net.veth.pair",             false,                  set_config_net_veth_pair,               get_config_net_veth_pair,               clr_config_net_veth_pair,             },
+       { "lxc.net.script.up",             false,                  set_config_net_script_up,               get_config_net_script_up,               clr_config_net_script_up,             },
+       { "lxc.net.script.down",           false,                  set_config_net_script_down,             get_config_net_script_down,             clr_config_net_script_down,           },
+       { "lxc.net.hwaddr",                false,                  set_config_net_hwaddr,                  get_config_net_hwaddr,                  clr_config_net_hwaddr,                },
+       { "lxc.net.mtu",                   false,                  set_config_net_mtu,                     get_config_net_mtu,                     clr_config_net_mtu,                   },
+       { "lxc.net.vlan.id",               false,                  set_config_net_vlan_id,                 get_config_net_vlan_id,                 clr_config_net_vlan_id,               },
+       { "lxc.net.ipv4.gateway",          false,                  set_config_net_ipv4_gateway,            get_config_net_ipv4_gateway,            clr_config_net_ipv4_gateway,          },
+       { "lxc.net.ipv4.address",          false,                  set_config_net_ipv4_address,            get_config_net_ipv4_address,            clr_config_net_ipv4_address,          },
+       { "lxc.net.ipv6.gateway",          false,                  set_config_net_ipv6_gateway,            get_config_net_ipv6_gateway,            clr_config_net_ipv6_gateway,          },
+       { "lxc.net.ipv6.address",          false,                  set_config_net_ipv6_address,            get_config_net_ipv6_address,            clr_config_net_ipv6_address,          },
+       { "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.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.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.seccomp.profile",           false,                  set_config_seccomp_profile,             get_config_seccomp_profile,             clr_config_seccomp_profile,           },
+       { "lxc.include",                   false,                  set_config_includefiles,                get_config_includefiles,                clr_config_includefiles,              },
+       { "lxc.autodev",                   false,                  set_config_autodev,                     get_config_autodev,                     clr_config_autodev,                   },
 
        /* [START]: REMOVE IN LXC 3.0 */
-       { "lxc.seccomp",                   set_config_seccomp_profile,             get_config_seccomp_profile,             clr_config_seccomp_profile,           },
-       { "lxc.console",                   set_config_console_path,                get_config_console_path,                clr_config_console_path,              },
-       { "lxc.haltsignal",                set_config_signal_halt,                 get_config_signal_halt,                 clr_config_signal_halt,               },
-       { "lxc.rebootsignal",              set_config_signal_reboot,               get_config_signal_reboot,               clr_config_signal_reboot,             },
-       { "lxc.stopsignal",                set_config_signal_stop,                 get_config_signal_stop,                 clr_config_signal_stop,               },
+       { "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,               },
        /* [END]: REMOVE IN LXC 3.0 */
 
-       { "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.monitor.unshare",           set_config_monitor,                     get_config_monitor,                     clr_config_monitor,                   },
-       { "lxc.group",                     set_config_group,                       get_config_group,                       clr_config_group,                     },
-       { "lxc.environment",               set_config_environment,                 get_config_environment,                 clr_config_environment,               },
-       { "lxc.ephemeral",                 set_config_ephemeral,                   get_config_ephemeral,                   clr_config_ephemeral,                 },
-       { "lxc.no_new_privs",              set_config_no_new_privs,                get_config_no_new_privs,                clr_config_no_new_privs,              },
+       { "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.monitor.unshare",           false,                  set_config_monitor,                     get_config_monitor,                     clr_config_monitor,                   },
+       { "lxc.group",                     false,                  set_config_group,                       get_config_group,                       clr_config_group,                     },
+       { "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.no_new_privs",              false,                  set_config_no_new_privs,                get_config_no_new_privs,                clr_config_no_new_privs,              },
 
        /* [START]: REMOVE IN LXC 3.0 */
-       { "lxc.syslog",                    set_config_log_syslog,                  get_config_log_syslog,                  clr_config_log_syslog,                },
-       { "lxc.loglevel",                  set_config_log_level,                   get_config_log_level,                   clr_config_log_level,                 },
-       { "lxc.logfile",                   set_config_log_file,                    get_config_log_file,                    clr_config_log_file,                  },
-       { "lxc.init_cmd",                  set_config_init_cmd,                    get_config_init_cmd,                    clr_config_init_cmd,                  },
-       { "lxc.init_uid",                  set_config_init_uid,                    get_config_init_uid,                    clr_config_init_uid,                  },
-       { "lxc.init_gid",                  set_config_init_gid,                    get_config_init_gid,                    clr_config_init_gid,                  },
-       { "lxc.limit",                     set_config_limit,                       get_config_limit,                       clr_config_limit,                     },
+       { "lxc.syslog",                    true,                   set_config_log_syslog,                  get_config_log_syslog,                  clr_config_log_syslog,                },
+       { "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,                     },
        /* [END]: REMOVE IN LXC 3.0 */
 
-       { "lxc.log.syslog",                set_config_log_syslog,                  get_config_log_syslog,                  clr_config_log_syslog,                },
-       { "lxc.log.level",                 set_config_log_level,                   get_config_log_level,                   clr_config_log_level,                 },
-       { "lxc.log.file",                  set_config_log_file,                    get_config_log_file,                    clr_config_log_file,                  },
-       { "lxc.init.cmd",                  set_config_init_cmd,                    get_config_init_cmd,                    clr_config_init_cmd,                  },
-       { "lxc.init.uid",                  set_config_init_uid,                    get_config_init_uid,                    clr_config_init_uid,                  },
-       { "lxc.init.gid",                  set_config_init_gid,                    get_config_init_gid,                    clr_config_init_gid,                  },
-       { "lxc.prlimit",                   set_config_prlimit,                     get_config_prlimit,                     clr_config_prlimit,                   },
+       { "lxc.log.syslog",                false,                  set_config_log_syslog,                  get_config_log_syslog,                  clr_config_log_syslog,                },
+       { "lxc.log.level",                 false,                  set_config_log_level,                   get_config_log_level,                   clr_config_log_level,                 },
+       { "lxc.log.file",                  false,                  set_config_log_file,                    get_config_log_file,                    clr_config_log_file,                  },
+       { "lxc.init.cmd",                  false,                  set_config_init_cmd,                    get_config_init_cmd,                    clr_config_init_cmd,                  },
+       { "lxc.init.uid",                  false,                  set_config_init_uid,                    get_config_init_uid,                    clr_config_init_uid,                  },
+       { "lxc.init.gid",                  false,                  set_config_init_gid,                    get_config_init_gid,                    clr_config_init_gid,                  },
+       { "lxc.prlimit",                   false,                  set_config_prlimit,                     get_config_prlimit,                     clr_config_prlimit,                   },
 };
 
 struct signame {
@@ -2046,6 +2047,18 @@ static int parse_line(char *buffer, void *data)
                goto out;
        }
 
+       /* [START]: REMOVE IN LXC 3.0 */
+       if (config->is_legacy_key && !plc->conf->contains_legacy_key) {
+               plc->conf->contains_legacy_key = true;
+               /* 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.\n"
+                               "Please update your configuration file!\n");
+       }
+       /* [END]: REMOVE IN LXC 3.0 */
+
        ret = config->set(key, value, plc->conf, NULL);
 
 out:
index 50c09ba2951e3da047777bea72c1b7787532df35..f939c61c9c1a2458fa2e2277574b5003cabb3c3d 100644 (file)
@@ -53,6 +53,7 @@ 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;