]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: don't require OSD W for MRemoveSnaps 6601/head
authorJohn Spray <john.spray@redhat.com>
Mon, 16 Nov 2015 10:57:56 +0000 (10:57 +0000)
committerJohn Spray <john.spray@redhat.com>
Fri, 27 Nov 2015 16:28:58 +0000 (16:28 +0000)
Use ability to execute "osd pool rmsnap" command
as a signal that the client should be permitted
to send MRemoveSnaps too.

Note that we don't also require the W ability,
unlike Monitor::_allowed_command -- this is slightly
more permissive handling, but anyone crafting caps
that explicitly permit "osd pool rmsnap" needs to
know what they are doing.

Fixes: #13777
Signed-off-by: John Spray <john.spray@redhat.com>
src/mon/MonCap.cc
src/mon/OSDMonitor.cc

index 989893b20269ac66a6669b728eefb04c18df7a89..a2540b56411c304c0bd22fffd6a1372ca2a2b9c3 100644 (file)
@@ -134,6 +134,8 @@ void MonCapGrant::expand_profile(EntityName name) const
     profile_grants.push_back(MonCapGrant("mds", MON_CAP_ALL));
     profile_grants.push_back(MonCapGrant("mon", MON_CAP_R));
     profile_grants.push_back(MonCapGrant("osd", MON_CAP_R));
+    // This command grant is checked explicitly in MRemoveSnaps handling
+    profile_grants.push_back(MonCapGrant("osd pool rmsnap"));
     profile_grants.push_back(MonCapGrant("log", MON_CAP_W));
   }
   if (profile == "osd" || profile == "mds" || profile == "mon") {
index ca10faad6508e1c26ab5ddb4ddce2acb9ef79058..040332c823a32f41084e5510800326f13ed63de0 100644 (file)
@@ -2278,7 +2278,8 @@ bool OSDMonitor::preprocess_remove_snaps(MonOpRequestRef op)
   MonSession *session = m->get_session();
   if (!session)
     goto ignore;
-  if (!session->is_capable("osd", MON_CAP_R | MON_CAP_W)) {
+  if (!session->caps.is_capable(g_ceph_context, session->entity_name,
+        "osd", "osd pool rmsnap", {}, true, true, false)) {
     dout(0) << "got preprocess_remove_snaps from entity with insufficient caps "
            << session->caps << dendl;
     goto ignore;