From 4eb1a518e3ed52103218616cd2d8f21463c0e8c4 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 25 Jul 2017 11:24:50 -0400 Subject: [PATCH] mon: 'config-key put' -> 'config-key set' Signed-off-by: Sage Weil --- doc/man/8/ceph.rst | 4 ++-- doc/mgr/dashboard.rst | 8 ++++---- doc/mgr/prometheus.rst | 2 +- doc/mgr/restful.rst | 16 ++++++++-------- doc/mgr/zabbix.rst | 6 +++--- qa/workunits/cephtool/test.sh | 3 ++- qa/workunits/mon/caps.py | 4 ++-- src/brag/client/ceph-brag | 4 ++-- src/mgr/PyModules.cc | 6 +++--- src/mon/ConfigKeyService.cc | 3 ++- src/mon/MonCap.cc | 2 ++ src/mon/MonCommands.h | 9 +++++++-- src/pybind/mgr/dashboard/README.rst | 2 +- src/pybind/mgr/dashboard/module.py | 2 +- src/pybind/mgr/restful/module.py | 2 +- src/pybind/mgr/zabbix/module.py | 2 +- src/test/mgr/mgr-dashboard-smoke.sh | 2 +- src/test/mon/moncap.cc | 2 ++ src/vstart.sh | 4 ++-- 19 files changed, 47 insertions(+), 36 deletions(-) diff --git a/doc/man/8/ceph.rst b/doc/man/8/ceph.rst index 01fe04f12c0..0f372d9714b 100644 --- a/doc/man/8/ceph.rst +++ b/doc/man/8/ceph.rst @@ -207,11 +207,11 @@ Usage:: ceph config-key dump -Subcommand ``put`` puts configuration key and value. +Subcommand ``set`` puts configuration key and value. Usage:: - ceph config-key put {} + ceph config-key set {} daemon diff --git a/doc/mgr/dashboard.rst b/doc/mgr/dashboard.rst index ac1b961f715..8908497003d 100644 --- a/doc/mgr/dashboard.rst +++ b/doc/mgr/dashboard.rst @@ -23,8 +23,8 @@ Since each ``ceph-mgr`` hosts its own instance of dashboard, it may also be necessary to configure them separately. The hostname and port can be changed via the configuration key facility:: - ceph config-key put mgr/dashboard/$name/server_addr $IP - ceph config-key put mgr/dashboard/$name/server_port $PORT + ceph config-key set mgr/dashboard/$name/server_addr $IP + ceph config-key set mgr/dashboard/$name/server_port $PORT where ``$name`` is the ID of the ceph-mgr who is hosting this dashboard web app. @@ -32,8 +32,8 @@ dashboard web app. These settings can also be configured cluster-wide and not manager specific. For example,:: - ceph config-key put mgr/dashboard/server_addr $IP - ceph config-key put mgr/dashboard/server_port $PORT + ceph config-key set mgr/dashboard/server_addr $IP + ceph config-key set mgr/dashboard/server_port $PORT If the port is not configured, the web app will bind to port ``7000``. If the address it not configured, the web app will bind to ``::``, diff --git a/doc/mgr/prometheus.rst b/doc/mgr/prometheus.rst index 2213156bf1a..fc84afee4b1 100644 --- a/doc/mgr/prometheus.rst +++ b/doc/mgr/prometheus.rst @@ -24,7 +24,7 @@ Configuration By default the module will accept HTTP requests on port ``9283`` on all IPv4 and IPv6 addresses on the host. The port and listen address are both -configurable with ``ceph config-key put``, with keys +configurable with ``ceph config-key set``, with keys ``mgr/prometheus/server_addr`` and ``mgr/prometheus/server_port``. This port is registered with Prometheus's `registry `_. diff --git a/doc/mgr/restful.rst b/doc/mgr/restful.rst index 4dc33d723bb..e67f2d144bd 100644 --- a/doc/mgr/restful.rst +++ b/doc/mgr/restful.rst @@ -40,15 +40,15 @@ can be generated with a command similar to:: The ``restful.crt`` should then be signed by your organization's CA (certificate authority). Once that is done, you can set it with:: - ceph config-key put mgr/restful/$name/crt -i restful.crt - ceph config-key put mgr/restful/$name/key -i restful.key + ceph config-key set mgr/restful/$name/crt -i restful.crt + ceph config-key set mgr/restful/$name/key -i restful.key where ``$name`` is the name of the ``ceph-mgr`` instance (usually the hostname). If all manager instances are to share the same certificate, you can leave off the ``$name`` portion:: - ceph config-key put mgr/restful/crt -i restful.crt - ceph config-key put mgr/restful/key -i restful.key + ceph config-key set mgr/restful/crt -i restful.crt + ceph config-key set mgr/restful/key -i restful.key Configuring IP and port @@ -62,16 +62,16 @@ Since each ``ceph-mgr`` hosts its own instance of *restful*, it may also be necessary to configure them separately. The IP and port can be changed via the configuration key facility:: - ceph config-key put mgr/restful/$name/server_addr $IP - ceph config-key put mgr/restful/$name/server_port $PORT + ceph config-key set mgr/restful/$name/server_addr $IP + ceph config-key set mgr/restful/$name/server_port $PORT where ``$name`` is the ID of the ceph-mgr daemon (usually the hostname). These settings can also be configured cluster-wide and not manager specific. For example,:: - ceph config-key put mgr/restful/server_addr $IP - ceph config-key put mgr/restful/server_port $PORT + ceph config-key set mgr/restful/server_addr $IP + ceph config-key set mgr/restful/server_port $PORT If the port is not configured, *restful* will bind to port ``8003``. If the address it not configured, the *restful* will bind to ``::``, diff --git a/doc/mgr/zabbix.rst b/doc/mgr/zabbix.rst index 70217b4ad71..d98540e8696 100644 --- a/doc/mgr/zabbix.rst +++ b/doc/mgr/zabbix.rst @@ -79,14 +79,14 @@ these are usually Monitors where the *client.admin* key is present. :: - ceph config-key put + ceph config-key set For example: :: - ceph config-key put mgr/zabbix/zabbix_host zabbix.localdomain - ceph config-key put mgr/zabbix/identifier ceph.eu-ams02.local + ceph config-key set mgr/zabbix/zabbix_host zabbix.localdomain + ceph config-key set mgr/zabbix/identifier ceph.eu-ams02.local Debugging --------- diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 8e74344c9ef..e10814543a0 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -2403,7 +2403,7 @@ function test_mon_tell_help_command() function test_mon_stdin_stdout() { - echo foo | ceph config-key put test_key -i - + echo foo | ceph config-key set test_key -i - ceph config-key get test_key -o - | grep -c foo | grep -q 1 } @@ -2476,6 +2476,7 @@ MON_TESTS+=" auth_profiles" MON_TESTS+=" mon_misc" MON_TESTS+=" mon_mon" MON_TESTS+=" mon_osd" +MON_TESTS+=" mon_config_key" MON_TESTS+=" mon_crush" MON_TESTS+=" mon_osd_create_destroy" MON_TESTS+=" mon_osd_pool" diff --git a/qa/workunits/mon/caps.py b/qa/workunits/mon/caps.py index f1d0850f36c..65a695641c6 100644 --- a/qa/workunits/mon/caps.py +++ b/qa/workunits/mon/caps.py @@ -265,11 +265,11 @@ def test_all(): ], 'config-key':[ { - 'pre':'config-key put foo bar', + 'pre':'config-key set foo bar', 'cmd':('config-key get', 'key=foo', 'r') }, { - 'pre':'config-key put foo bar', + 'pre':'config-key set foo bar', 'cmd':('config-key del', 'key=foo', 'rw') } ] diff --git a/src/brag/client/ceph-brag b/src/brag/client/ceph-brag index d5e5a2ded20..7df516740f2 100755 --- a/src/brag/client/ceph-brag +++ b/src/brag/client/ceph-brag @@ -226,10 +226,10 @@ def get_uuid(): if rc: #uuid is not yet set. uid = str(uuid.uuid4()) - (rc, o, e) = run_command(['ceph', 'config-key', 'put', + (rc, o, e) = run_command(['ceph', 'config-key', 'set', CLUSTER_UUID_NAME, uid]) if rc: - raise RuntimeError("\'ceph config-key put\' failed -" + e) + raise RuntimeError("\'ceph config-key set\' failed -" + e) return uid diff --git a/src/mgr/PyModules.cc b/src/mgr/PyModules.cc index 74628dbbf1c..05a663bca7b 100644 --- a/src/mgr/PyModules.cc +++ b/src/mgr/PyModules.cc @@ -592,7 +592,7 @@ void PyModules::set_config(const std::string &handle, JSONFormatter jf; jf.open_object_section("cmd"); - jf.dump_string("prefix", "config-key put"); + jf.dump_string("prefix", "config-key set"); jf.dump_string("key", global_key); jf.dump_string("val", val); jf.close_section(); @@ -603,10 +603,10 @@ void PyModules::set_config(const std::string &handle, set_cmd.wait(); if (set_cmd.r != 0) { - // config-key put will fail if mgr's auth key has insufficient + // config-key set will fail if mgr's auth key has insufficient // permission to set config keys // FIXME: should this somehow raise an exception back into Python land? - dout(0) << "`config-key put " << global_key << " " << val << "` failed: " + dout(0) << "`config-key set " << global_key << " " << val << "` failed: " << cpp_strerror(set_cmd.r) << dendl; dout(0) << "mon returned " << set_cmd.r << ": " << set_cmd.outs << dendl; } diff --git a/src/mon/ConfigKeyService.cc b/src/mon/ConfigKeyService.cc index f8e9e1aaf3d..29ae9d95942 100644 --- a/src/mon/ConfigKeyService.cc +++ b/src/mon/ConfigKeyService.cc @@ -184,7 +184,8 @@ bool ConfigKeyService::service_dispatch(MonOpRequestRef op) } ss << "obtained '" << key << "'"; - } else if (prefix == "config-key put") { + } else if (prefix == "config-key put" || + prefix == "config-key set") { if (!mon->is_leader()) { mon->forward_request_leader(op); // we forward the message; so return now. diff --git a/src/mon/MonCap.cc b/src/mon/MonCap.cc index f6f2b74f4ea..3096fd2b46a 100644 --- a/src/mon/MonCap.cc +++ b/src/mon/MonCap.cc @@ -201,6 +201,7 @@ void MonCapGrant::expand_profile_mon(const EntityName& name) const StringConstraint constraint(StringConstraint::MATCH_TYPE_PREFIX, "daemon-private/mgr/"); profile_grants.push_back(MonCapGrant("config-key get", "key", constraint)); + profile_grants.push_back(MonCapGrant("config-key set", "key", constraint)); profile_grants.push_back(MonCapGrant("config-key put", "key", constraint)); profile_grants.push_back(MonCapGrant("config-key exists", "key", constraint)); profile_grants.push_back(MonCapGrant("config-key delete", "key", constraint)); @@ -213,6 +214,7 @@ void MonCapGrant::expand_profile_mon(const EntityName& name) const string prefix = string("daemon-private/") + stringify(name) + string("/"); profile_grants.push_back(MonCapGrant("config-key get", "key", constraint)); profile_grants.push_back(MonCapGrant("config-key put", "key", constraint)); + profile_grants.push_back(MonCapGrant("config-key set", "key", constraint)); profile_grants.push_back(MonCapGrant("config-key exists", "key", constraint)); profile_grants.push_back(MonCapGrant("config-key delete", "key", constraint)); } diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 41e3f79f117..a6b56d9def2 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -1015,10 +1015,15 @@ COMMAND("osd tier add-cache " \ COMMAND("config-key get " \ "name=key,type=CephString", \ "get ", "config-key", "r", "cli,rest") -COMMAND("config-key put " \ +COMMAND("config-key set " \ "name=key,type=CephString " \ "name=val,type=CephString,req=false", \ - "put , value ", "config-key", "rw", "cli,rest") + "set to value ", "config-key", "rw", "cli,rest") +COMMAND_WITH_FLAG("config-key put " \ + "name=key,type=CephString " \ + "name=val,type=CephString,req=false", \ + "put , value ", "config-key", "rw", "cli,rest", + FLAG(DEPRECATED)) COMMAND("config-key del " \ "name=key,type=CephString", \ "delete ", "config-key", "rw", "cli,rest") diff --git a/src/pybind/mgr/dashboard/README.rst b/src/pybind/mgr/dashboard/README.rst index 34158849c9e..dd715b60ed8 100644 --- a/src/pybind/mgr/dashboard/README.rst +++ b/src/pybind/mgr/dashboard/README.rst @@ -39,7 +39,7 @@ IPv4 and IPv6 addresses. :: - ceph config-key put mgr/dashboard/server_addr :: + ceph config-key set mgr/dashboard/server_addr :: Restart the ceph-mgr daemon after modifying the setting to load the module. diff --git a/src/pybind/mgr/dashboard/module.py b/src/pybind/mgr/dashboard/module.py index 7e2a4260a03..3728e8d07e0 100644 --- a/src/pybind/mgr/dashboard/module.py +++ b/src/pybind/mgr/dashboard/module.py @@ -794,7 +794,7 @@ class Module(MgrModule): server_addr = self.get_localized_config('server_addr', '::') server_port = self.get_localized_config('server_port', '7000') if server_addr is None: - raise RuntimeError('no server_addr configured; try "ceph config-key put mgr/dashboard/server_addr "') + raise RuntimeError('no server_addr configured; try "ceph config-key set mgr/dashboard/server_addr "') log.info("server_addr: %s server_port: %s" % (server_addr, server_port)) cherrypy.config.update({ 'server.socket_host': server_addr, diff --git a/src/pybind/mgr/restful/module.py b/src/pybind/mgr/restful/module.py index 52455d00747..63fcae72a5a 100644 --- a/src/pybind/mgr/restful/module.py +++ b/src/pybind/mgr/restful/module.py @@ -272,7 +272,7 @@ class Module(MgrModule): server_addr = self.get_localized_config('server_addr', '::') if server_addr is None: - raise RuntimeError('no server_addr configured; try "ceph config-key put mgr/restful/server_addr "') + raise RuntimeError('no server_addr configured; try "ceph config-key set mgr/restful/server_addr "') server_port = int(self.get_localized_config('server_port', '8003')) self.log.info('server_addr: %s server_port: %d', server_addr, server_port) diff --git a/src/pybind/mgr/zabbix/module.py b/src/pybind/mgr/zabbix/module.py index 1313ede4cc7..eb2eba11a1f 100644 --- a/src/pybind/mgr/zabbix/module.py +++ b/src/pybind/mgr/zabbix/module.py @@ -87,7 +87,7 @@ class Module(MgrModule): value = self.get_localized_config(key, default) if value is None: raise RuntimeError('Configuration key {0} not set; "ceph ' - 'config-key put mgr/zabbix/{0} ' + 'config-key set mgr/zabbix/{0} ' '"'.format(key)) self.set_config_option(key, value) diff --git a/src/test/mgr/mgr-dashboard-smoke.sh b/src/test/mgr/mgr-dashboard-smoke.sh index 353c4d45a03..778b36f3520 100755 --- a/src/test/mgr/mgr-dashboard-smoke.sh +++ b/src/test/mgr/mgr-dashboard-smoke.sh @@ -33,7 +33,7 @@ function run() { timeout 360 ceph --mon-host $MON mon stat || return 1 export CEPH_ARGS="--mon_host $MON " - ceph config-key put mgr/x/dashboard/server_port 7001 + ceph config-key set mgr/x/dashboard/server_port 7001 MGR_ARGS+="--mgr_module_path=${CEPH_ROOT}/src/pybind/mgr " run_mgr $dir x ${MGR_ARGS} || return 1 diff --git a/src/test/mon/moncap.cc b/src/test/mon/moncap.cc index a3379eefc6c..126bd45dee1 100644 --- a/src/test/mon/moncap.cc +++ b/src/test/mon/moncap.cc @@ -236,6 +236,8 @@ TEST(MonCap, ProfileOSD) { name, "", "config-key get", ca, true, true, true)); ASSERT_TRUE(cap.is_capable(NULL, CEPH_ENTITY_TYPE_MON, name, "", "config-key put", ca, true, true, true)); + ASSERT_TRUE(cap.is_capable(NULL, CEPH_ENTITY_TYPE_MON, + name, "", "config-key set", ca, true, true, true)); ASSERT_TRUE(cap.is_capable(NULL, CEPH_ENTITY_TYPE_MON, name, "", "config-key exists", ca, true, true, true)); ASSERT_TRUE(cap.is_capable(NULL, CEPH_ENTITY_TYPE_MON, diff --git a/src/vstart.sh b/src/vstart.sh index 88c35d5e96f..51667a94aff 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -658,11 +658,11 @@ start_mgr() { host = $HOSTNAME EOF - ceph_adm config-key put mgr/dashboard/$name/server_port $MGR_PORT + ceph_adm config-key set mgr/dashboard/$name/server_port $MGR_PORT DASH_URLS+="http://$IP:$MGR_PORT/" MGR_PORT=$(($MGR_PORT + 1000)) - ceph_adm config-key put mgr/restful/$name/server_port $MGR_PORT + ceph_adm config-key set mgr/restful/$name/server_port $MGR_PORT RESTFUL_URLS+="https://$IP:$MGR_PORT" MGR_PORT=$(($MGR_PORT + 1000))