Merge pull request #19439 from chardan/jfw-wip-14363-normalize-rm

rgw, mon: normalize delete/remove in admin console (cleanup 22444)

Reviewed-by: Sage Weil <sage@redhat.com>
Reviewed-by: Yehuda Sadeh <yehuda@redhat.com>
Reviewed-by: Casey Bodley <cbodley@redhat.com>
Reviewed-by: Joao Eduardo Luis <joao@suse.de>
This commit is contained in:
Nathan Cutler 2018-03-26 15:35:40 +02:00 committed by GitHub
commit b71eb01705
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 85 additions and 55 deletions

View File

@ -1,6 +1,11 @@
13.0.1
------
* *RGW, MON*:
Commands variously marked as "del", "delete", "remove" etc. should now all be
normalized as "rm". Commands already supporting alternatives to "rm" remain
backward-compatible.
* *CephFS*:
* Upgrading an MDS cluster to 12.2.3+ will result in all active MDS

View File

@ -134,8 +134,8 @@ which are as follows:
:command:`objects expire`
Run expired objects cleanup.
:command:`period delete`
Delete a period.
:command:`period rm`
Remove a period.
:command:`period get`
Get the period info.
@ -182,8 +182,8 @@ which are as follows:
:command:`realm create`
Create a new realm.
:command:`realm delete`
Delete a realm.
:command:`realm rm`
Remove a realm.
:command:`realm get`
Show the realm info.
@ -218,8 +218,8 @@ which are as follows:
:command:`zonegroup default`
Set the default zone group.
:command:`zonegroup delete`
Delete a zone group info.
:command:`zonegroup rm`
Remove a zone group info.
:command:`zonegroup get`
Show the zone group info.
@ -257,8 +257,8 @@ which are as follows:
:command:`zone create`
Create a new zone.
:command:`zone delete`
Delete a zone.
:command:`zone rm`
Remove a zone.
:command:`zone get`
Show zone cluster params.
@ -406,8 +406,8 @@ which are as follows:
:command:`replicalog update`
Update replica metadata log entry.
:command:`replicalog delete`
Delete replica metadata log entry.
:command:`replicalog rm`
Remove replica metadata log entry.
:command:`orphans find`
Init and run search for leaked rados objects
@ -421,8 +421,8 @@ which are as follows:
:command:`role create`
create a new AWS role for use with STS.
:command:`role delete`
Delete a role.
:command:`role rm`
Remove a role.
:command:`role get`
Get a role.
@ -442,8 +442,8 @@ which are as follows:
:command:`role-policy get`
Get the specified inline policy document embedded with the given role.
:command:`role-policy delete`
Delete the policy attached to a role
:command:`role-policy rm`
Remove the policy attached to a role
:command:`reshard add`
Schedule a resharding of a bucket

View File

@ -91,4 +91,15 @@ void dump_services(Formatter* f, const map<string, list<string> >& services, con
string cleanbin(bufferlist &bl, bool &b64);
string cleanbin(string &str);
namespace ceph::util {
// Returns true if s matches any parameters:
template <typename ...XS>
bool match_str(const std::string& s, const XS& ...xs)
{
return ((s == xs) || ...);
}
} // namespace ceph::util
#endif /* CEPH_UTIL_H */

View File

@ -23,6 +23,7 @@
#include "common/errno.h"
#include "include/stringify.h"
#include "include/assert.h" // re-clobber assert()
#define dout_subsys ceph_subsys_mon
#undef dout_prefix
#define dout_prefix _prefix(_dout, mon, this)

View File

@ -11,6 +11,8 @@
#include "messages/MStatfsReply.h"
#include "messages/MServiceMap.h"
#include "include/assert.h" // re-clobber assert
#define dout_subsys ceph_subsys_mon
#undef dout_prefix
#define dout_prefix _prefix(_dout, mon)

View File

@ -171,10 +171,11 @@ COMMAND("auth caps " \
"name=caps,type=CephString,n=N", \
"update caps for <name> from caps specified in the command", \
"auth", "rwx", "cli,rest")
COMMAND("auth del " \
COMMAND_WITH_FLAG("auth del " \
"name=entity,type=CephString", \
"delete all caps for <name>", \
"auth", "rwx", "cli,rest")
"auth", "rwx", "cli,rest", \
FLAG(DEPRECATED))
COMMAND("auth rm " \
"name=entity,type=CephString", \
"remove all caps for <name>", \
@ -345,10 +346,10 @@ COMMAND("mds compat rm_incompat " \
COMMAND_WITH_FLAG("mds add_data_pool " \
"name=pool,type=CephString", \
"add data pool <pool>", "mds", "rw", "cli,rest", FLAG(OBSOLETE))
COMMAND_WITH_FLAG("mds remove_data_pool " \
COMMAND_WITH_FLAG("mds rm_data_pool " \
"name=pool,type=CephString", \
"remove data pool <pool>", "mds", "rw", "cli,rest", FLAG(OBSOLETE))
COMMAND_WITH_FLAG("mds rm_data_pool " \
COMMAND_WITH_FLAG("mds remove_data_pool " \
"name=pool,type=CephString", \
"remove data pool <pool>", "mds", "rw", "cli,rest", FLAG(OBSOLETE))
COMMAND_WITH_FLAG("mds newfs " \
@ -423,12 +424,13 @@ COMMAND("mon add " \
"name=name,type=CephString " \
"name=addr,type=CephIPAddr", \
"add new monitor named <name> at <addr>", "mon", "rw", "cli,rest")
COMMAND("mon remove " \
"name=name,type=CephString", \
"remove monitor named <name>", "mon", "rw", "cli,rest")
COMMAND("mon rm " \
"name=name,type=CephString", \
"remove monitor named <name>", "mon", "rw", "cli,rest")
COMMAND_WITH_FLAG("mon remove " \
"name=name,type=CephString", \
"remove monitor named <name>", "mon", "rw", "cli,rest", \
FLAG(DEPRECATED))
COMMAND("mon feature ls " \
"name=with_value,type=CephChoices,strings=--with-value,req=false", \
"list available mon map features to be set/unset", \
@ -582,11 +584,12 @@ COMMAND("osd crush rm " \
"name=ancestor,type=CephString,req=false,goodchars=[A-Za-z0-9-_.]", \
"remove <name> from crush map (everywhere, or just at <ancestor>)",\
"osd", "rw", "cli,rest")
COMMAND("osd crush remove " \
COMMAND_WITH_FLAG("osd crush remove " \
"name=name,type=CephString,goodchars=[A-Za-z0-9-_.] " \
"name=ancestor,type=CephString,req=false,goodchars=[A-Za-z0-9-_.]", \
"remove <name> from crush map (everywhere, or just at <ancestor>)", \
"osd", "rw", "cli,rest")
"osd", "rw", "cli,rest", \
FLAG(DEPRECATED))
COMMAND("osd crush unlink " \
"name=name,type=CephString,goodchars=[A-Za-z0-9-_.] " \
"name=ancestor,type=CephString,req=false,goodchars=[A-Za-z0-9-_.]", \
@ -914,12 +917,13 @@ COMMAND("osd pool create " \
"name=rule,type=CephString,req=false " \
"name=expected_num_objects,type=CephInt,req=false", \
"create pool", "osd", "rw", "cli,rest")
COMMAND("osd pool delete " \
COMMAND_WITH_FLAG("osd pool delete " \
"name=pool,type=CephPoolname " \
"name=pool2,type=CephPoolname,req=false " \
"name=sure,type=CephString,req=false", \
"delete pool", \
"osd", "rw", "cli,rest")
"osd", "rw", "cli,rest", \
FLAG(DEPRECATED))
COMMAND("osd pool rm " \
"name=pool,type=CephPoolname " \
"name=pool2,type=CephPoolname,req=false " \
@ -994,16 +998,17 @@ COMMAND("osd tier add " \
"name=force_nonempty,type=CephChoices,strings=--force-nonempty,req=false",
"add the tier <tierpool> (the second one) to base pool <pool> (the first one)", \
"osd", "rw", "cli,rest")
COMMAND("osd tier remove " \
"name=pool,type=CephPoolname " \
"name=tierpool,type=CephPoolname",
"remove the tier <tierpool> (the second one) from base pool <pool> (the first one)", \
"osd", "rw", "cli,rest")
COMMAND("osd tier rm " \
"name=pool,type=CephPoolname " \
"name=tierpool,type=CephPoolname",
"remove the tier <tierpool> (the second one) from base pool <pool> (the first one)", \
"osd", "rw", "cli,rest")
COMMAND_WITH_FLAG("osd tier remove " \
"name=pool,type=CephPoolname " \
"name=tierpool,type=CephPoolname",
"remove the tier <tierpool> (the second one) from base pool <pool> (the first one)", \
"osd", "rw", "cli,rest", \
FLAG(DEPRECATED))
COMMAND("osd tier cache-mode " \
"name=pool,type=CephPoolname " \
"name=mode,type=CephChoices,strings=none|writeback|forward|readonly|readforward|proxy|readproxy " \
@ -1013,12 +1018,13 @@ COMMAND("osd tier set-overlay " \
"name=pool,type=CephPoolname " \
"name=overlaypool,type=CephPoolname", \
"set the overlay pool for base pool <pool> to be <overlaypool>", "osd", "rw", "cli,rest")
COMMAND("osd tier remove-overlay " \
"name=pool,type=CephPoolname ", \
"remove the overlay pool for base pool <pool>", "osd", "rw", "cli,rest")
COMMAND("osd tier rm-overlay " \
"name=pool,type=CephPoolname ", \
"remove the overlay pool for base pool <pool>", "osd", "rw", "cli,rest")
COMMAND_WITH_FLAG("osd tier remove-overlay " \
"name=pool,type=CephPoolname ", \
"remove the overlay pool for base pool <pool>", "osd", "rw", "cli,rest", \
FLAG(DEPRECATED))
COMMAND("osd tier add-cache " \
"name=pool,type=CephPoolname " \
@ -1043,9 +1049,10 @@ COMMAND_WITH_FLAG("config-key put " \
"name=val,type=CephString,req=false", \
"put <key>, value <val>", "config-key", "rw", "cli,rest",
FLAG(DEPRECATED))
COMMAND("config-key del " \
COMMAND_WITH_FLAG("config-key del " \
"name=key,type=CephString", \
"delete <key>", "config-key", "rw", "cli,rest")
"delete <key>", "config-key", "rw", "cli,rest", \
FLAG(DEPRECATED))
COMMAND("config-key rm " \
"name=key,type=CephString", \
"rm <key>", "config-key", "rw", "cli,rest")

View File

@ -19,6 +19,8 @@
#include "common/errno.h"
#include "common/safe_io.h"
#include "include/util.h"
#include "cls/rgw/cls_rgw_client.h"
#include "global/global_init.h"
@ -94,7 +96,7 @@ void usage()
cout << " object unlink unlink object from bucket index\n";
cout << " object rewrite rewrite the specified object\n";
cout << " objects expire run expired objects cleanup\n";
cout << " period delete delete a period\n";
cout << " period rm remove a period\n";
cout << " period get get period info\n";
cout << " period get-current get current period info\n";
cout << " period pull pull a period\n";
@ -110,7 +112,7 @@ void usage()
cout << " global quota enable enable a global quota\n";
cout << " global quota disable disable a global quota\n";
cout << " realm create create a new realm\n";
cout << " realm delete delete a realm\n";
cout << " realm rm remove a realm\n";
cout << " realm get show realm info\n";
cout << " realm get-default get default realm name\n";
cout << " realm list list realms\n";
@ -122,11 +124,11 @@ void usage()
cout << " zonegroup add add a zone to a zonegroup\n";
cout << " zonegroup create create a new zone group info\n";
cout << " zonegroup default set default zone group\n";
cout << " zonegroup delete delete a zone group info\n";
cout << " zonegroup rm remove a zone group info\n";
cout << " zonegroup get show zone group info\n";
cout << " zonegroup modify modify an existing zonegroup\n";
cout << " zonegroup set set zone group info (requires infile)\n";
cout << " zonegroup remove remove a zone from a zonegroup\n";
cout << " zonegroup rm remove a zone from a zonegroup\n";
cout << " zonegroup rename rename a zone group\n";
cout << " zonegroup list list all zone groups set on this cluster\n";
cout << " zonegroup placement list list zonegroup's placement targets\n";
@ -135,7 +137,7 @@ void usage()
cout << " zonegroup placement rm remove a placement target from a zonegroup\n";
cout << " zonegroup placement default set a zonegroup's default placement target\n";
cout << " zone create create a new zone\n";
cout << " zone delete delete a zone\n";
cout << " zone rm remove a zone\n";
cout << " zone get show zone cluster params\n";
cout << " zone modify modify an existing zone\n";
cout << " zone set set zone cluster params (requires infile)\n";
@ -190,19 +192,19 @@ void usage()
cout << " opstate rm remove entry (use client_id, op_id, object)\n";
cout << " replicalog get get replica metadata log entry\n";
cout << " replicalog update update replica metadata log entry\n";
cout << " replicalog delete delete replica metadata log entry\n";
cout << " replicalog rm remove replica metadata log entry\n";
cout << " orphans find init and run search for leaked rados objects (use job-id, pool)\n";
cout << " orphans finish clean up search for leaked rados objects\n";
cout << " orphans list-jobs list the current job-ids for orphans search\n";
cout << " role create create a AWS role for use with STS\n";
cout << " role delete delete a role\n";
cout << " role rm remove a role\n";
cout << " role get get a role\n";
cout << " role list list roles with specified path prefix\n";
cout << " role modify modify the assume role policy of an existing role\n";
cout << " role-policy put add/update permission policy to role\n";
cout << " role-policy list list policies attached to a role\n";
cout << " role-policy get get the specified inline policy document embedded with the given role\n";
cout << " role-policy delete delete policy attached to a role\n";
cout << " role-policy rm remove policy attached to a role\n";
cout << " reshard add schedule a resharding of a bucket\n";
cout << " reshard list list all bucket resharding or scheduled to be resharded\n";
cout << " reshard status read bucket resharding status\n";
@ -504,6 +506,8 @@ enum {
static int get_cmd(const char *cmd, const char *prev_cmd, const char *prev_prev_cmd, bool *need_more)
{
using ceph::util::match_str;
*need_more = false;
// NOTE: please keep the checks in alphabetical order !!!
if (strcmp(cmd, "bi") == 0 ||
@ -706,7 +710,7 @@ static int get_cmd(const char *cmd, const char *prev_cmd, const char *prev_prev_
if (strcmp(cmd, "disable") == 0)
return OPT_GLOBAL_QUOTA_DISABLE;
} else if (strcmp(prev_cmd, "period") == 0) {
if (strcmp(cmd, "delete") == 0)
if (match_str(cmd, "rm", "delete"))
return OPT_PERIOD_DELETE;
if (strcmp(cmd, "get") == 0)
return OPT_PERIOD_GET;
@ -725,7 +729,7 @@ static int get_cmd(const char *cmd, const char *prev_cmd, const char *prev_prev_
} else if (strcmp(prev_cmd, "realm") == 0) {
if (strcmp(cmd, "create") == 0)
return OPT_REALM_CREATE;
if (strcmp(cmd, "delete") == 0)
if (match_str(cmd, "rm", "delete"))
return OPT_REALM_DELETE;
if (strcmp(cmd, "get") == 0)
return OPT_REALM_GET;
@ -772,7 +776,7 @@ static int get_cmd(const char *cmd, const char *prev_cmd, const char *prev_prev_
return OPT_ZONEGROUP_LIST;
if (strcmp(cmd, "set") == 0)
return OPT_ZONEGROUP_SET;
if (strcmp(cmd, "remove") == 0)
if (match_str(cmd, "rm", "remove"))
return OPT_ZONEGROUP_REMOVE;
if (strcmp(cmd, "rename") == 0)
return OPT_ZONEGROUP_RENAME;
@ -937,7 +941,7 @@ static int get_cmd(const char *cmd, const char *prev_cmd, const char *prev_prev_
return OPT_ROLE_POLICY_LIST;
if (strcmp(cmd, "get") == 0)
return OPT_ROLE_POLICY_GET;
if (strcmp(cmd, "delete") == 0)
if (match_str(cmd, "rm", "delete"))
return OPT_ROLE_POLICY_DELETE;
} else if (strcmp(prev_cmd, "reshard") == 0) {
if (strcmp(cmd, "bucket") == 0)

View File

@ -37,7 +37,7 @@
object unlink unlink object from bucket index
object rewrite rewrite the specified object
objects expire run expired objects cleanup
period delete delete a period
period rm remove a period
period get get period info
period get-current get current period info
period pull pull a period
@ -53,7 +53,7 @@
global quota enable enable a global quota
global quota disable disable a global quota
realm create create a new realm
realm delete delete a realm
realm rm remove a realm
realm get show realm info
realm get-default get default realm name
realm list list realms
@ -65,11 +65,11 @@
zonegroup add add a zone to a zonegroup
zonegroup create create a new zone group info
zonegroup default set default zone group
zonegroup delete delete a zone group info
zonegroup rm remove a zone group info
zonegroup get show zone group info
zonegroup modify modify an existing zonegroup
zonegroup set set zone group info (requires infile)
zonegroup remove remove a zone from a zonegroup
zonegroup rm remove a zone from a zonegroup
zonegroup rename rename a zone group
zonegroup list list all zone groups set on this cluster
zonegroup placement list list zonegroup's placement targets
@ -78,7 +78,7 @@
zonegroup placement rm remove a placement target from a zonegroup
zonegroup placement default set a zonegroup's default placement target
zone create create a new zone
zone delete delete a zone
zone rm remove a zone
zone get show zone cluster params
zone modify modify an existing zone
zone set set zone cluster params (requires infile)
@ -133,19 +133,19 @@
opstate rm remove entry (use client_id, op_id, object)
replicalog get get replica metadata log entry
replicalog update update replica metadata log entry
replicalog delete delete replica metadata log entry
replicalog rm remove replica metadata log entry
orphans find init and run search for leaked rados objects (use job-id, pool)
orphans finish clean up search for leaked rados objects
orphans list-jobs list the current job-ids for orphans search
role create create a AWS role for use with STS
role delete delete a role
role rm remove a role
role get get a role
role list list roles with specified path prefix
role modify modify the assume role policy of an existing role
role-policy put add/update permission policy to role
role-policy list list policies attached to a role
role-policy get get the specified inline policy document embedded with the given role
role-policy delete delete policy attached to a role
role-policy rm remove policy attached to a role
reshard add schedule a resharding of a bucket
reshard list list all bucket resharding or scheduled to be resharded
reshard status read bucket resharding status