From: Lennart Poettering Date: Thu, 21 Jul 2022 09:28:30 +0000 (+0200) Subject: pid1: generate warnings if old obsolete cgroupsv1 settings are used X-Git-Tag: v252-rc1~355^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c1e701e2f1ecc0c86cfc546b7c92945de1a2bba1;p=thirdparty%2Fsystemd.git pid1: generate warnings if old obsolete cgroupsv1 settings are used --- diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 0a2d4d4035b..23ddbd09409 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -148,12 +148,36 @@ DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_ip_tos, ip_tos, int, -1, "Fai DEFINE_CONFIG_PARSE_PTR(config_parse_blockio_weight, cg_blkio_weight_parse, uint64_t, "Invalid block IO weight"); DEFINE_CONFIG_PARSE_PTR(config_parse_cg_weight, cg_weight_parse, uint64_t, "Invalid weight"); DEFINE_CONFIG_PARSE_PTR(config_parse_cg_cpu_weight, cg_cpu_weight_parse, uint64_t, "Invalid CPU weight"); -DEFINE_CONFIG_PARSE_PTR(config_parse_cpu_shares, cg_cpu_shares_parse, uint64_t, "Invalid CPU shares"); +static DEFINE_CONFIG_PARSE_PTR(config_parse_cpu_shares_internal, cg_cpu_shares_parse, uint64_t, "Invalid CPU shares"); DEFINE_CONFIG_PARSE_PTR(config_parse_exec_mount_flags, mount_propagation_flags_from_string, unsigned long, "Failed to parse mount flag"); DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_numa_policy, mpol, int, -1, "Invalid NUMA policy type"); DEFINE_CONFIG_PARSE_ENUM(config_parse_status_unit_format, status_unit_format, StatusUnitFormat, "Failed to parse status unit format"); DEFINE_CONFIG_PARSE_ENUM_FULL(config_parse_socket_timestamping, socket_timestamping_from_string_harder, SocketTimestamping, "Failed to parse timestamping precision"); +int config_parse_cpu_shares( + const char *unit, + const char *filename, + unsigned line, + const char *section, + unsigned section_line, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { + + assert(filename); + assert(lvalue); + assert(rvalue); + + + log_syntax(unit, LOG_WARNING, filename, line, 0, + "Unit uses %s=; please use CPUWeight= instead. Support for %s= will be removed soon.", + lvalue, lvalue); + + return config_parse_cpu_shares_internal(unit, filename, line, section, section_line, lvalue, ltype, rvalue, data, userdata); +} + bool contains_instance_specifier_superset(const char *s) { const char *p, *q; bool percent = false; @@ -3914,9 +3938,11 @@ int config_parse_memory_limit( c->memory_max = bytes; else if (streq(lvalue, "MemorySwapMax")) c->memory_swap_max = bytes; - else if (streq(lvalue, "MemoryLimit")) + else if (streq(lvalue, "MemoryLimit")) { + log_syntax(unit, LOG_WARNING, filename, line, 0, + "Unit uses MemoryLimit=; please use MemoryMax= instead. Support for MemoryLimit= will be removed soon."); c->memory_limit = bytes; - else + } else return -EINVAL; return 0; @@ -4442,6 +4468,10 @@ int config_parse_blockio_device_weight( assert(lvalue); assert(rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, + "Unit uses %s=; please use IO*= settings instead. Support for %s= will be removed soon.", + lvalue, lvalue); + if (isempty(rvalue)) { while (c->blockio_device_weights) cgroup_context_free_blockio_device_weight(c, c->blockio_device_weights); @@ -4517,6 +4547,10 @@ int config_parse_blockio_bandwidth( assert(lvalue); assert(rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, + "Unit uses %s=; please use IO*= settings instead. Support for %s= will be removed soon.", + lvalue, lvalue); + read = streq("BlockIOReadBandwidth", lvalue); if (isempty(rvalue)) {