]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: define simple-rados-client-with-blocklist profile
authorPatrick Donnelly <pdonnell@redhat.com>
Sat, 13 Mar 2021 17:41:34 +0000 (09:41 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 22 Mar 2021 17:14:01 +0000 (10:14 -0700)
A mon profile that grants the ability for rados clients to blocklist
others (similar to rbd).

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 108f486afe772dff771137a13b33887e5bc2a55e)

doc/rados/operations/user-management.rst
src/mon/MonCap.cc

index d8695effbfbc583728624164662896cc429ab8af..67897448c4e1ae8c8b64a3ec967f4184c8dcf2ea 100644 (file)
@@ -295,6 +295,13 @@ The following entries describe valid capability profiles:
 :Description: Gives a user read-only permissions for monitor, OSD, and PG data.
               Intended for use by direct librados client applications.
 
+``profile simple-rados-client-with-blocklist`` (Monitor only)
+
+:Description: Gives a user read-only permissions for monitor, OSD, and PG data.
+              Intended for use by direct librados client applications. Also
+              includes permission to add blocklist entries to build HA
+              applications.
+
 ``profile fs-client`` (Monitor only)
 
 :Description: Gives a user read-only permissions for monitor, OSD, PG, and MDS
index 2dceb5311386e4ae8d9672eb491a83b727b05471..78c1b30961ed7e94b908c9aac4e641872db11d09 100644 (file)
@@ -290,6 +290,17 @@ void MonCapGrant::expand_profile(const EntityName& name) const
     profile_grants.push_back(MonCapGrant("osd", MON_CAP_R));
     profile_grants.push_back(MonCapGrant("pg", MON_CAP_R));
   }
+  if (profile == "simple-rados-client-with-blocklist") {
+    profile_grants.push_back(MonCapGrant("mon", MON_CAP_R));
+    profile_grants.push_back(MonCapGrant("osd", MON_CAP_R));
+    profile_grants.push_back(MonCapGrant("pg", MON_CAP_R));
+    profile_grants.push_back(MonCapGrant("osd blocklist"));
+    profile_grants.back().command_args["blocklistop"] = StringConstraint(
+      StringConstraint::MATCH_TYPE_EQUAL, "add");
+    profile_grants.back().command_args["addr"] = StringConstraint(
+      StringConstraint::MATCH_TYPE_REGEX, "^[^/]+/[0-9]+$");
+
+  }
   if (boost::starts_with(profile, "rbd")) {
     profile_grants.push_back(MonCapGrant("mon", MON_CAP_R));
     profile_grants.push_back(MonCapGrant("osd", MON_CAP_R));