]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: print out client caps
authorKefu Chai <kchai@redhat.com>
Fri, 24 Jul 2020 15:13:37 +0000 (23:13 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 27 Jul 2020 03:29:10 +0000 (11:29 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/CMakeLists.txt
src/crimson/osd/osd.cc

index 0e85a23f37c47a63b5c632fb5c5df138eecd8415..1ee6e4f38ff1216ca397359d56d9c413b7d63532 100644 (file)
@@ -31,6 +31,7 @@ add_executable(crimson-osd
   ${PROJECT_SOURCE_DIR}/src/objclass/class_api.cc
   ${PROJECT_SOURCE_DIR}/src/osd/ClassHandler.cc
   ${PROJECT_SOURCE_DIR}/src/osd/osd_op_util.cc
+  ${PROJECT_SOURCE_DIR}/src/osd/OSDCap.cc
   ${PROJECT_SOURCE_DIR}/src/osd/PeeringState.cc
   ${PROJECT_SOURCE_DIR}/src/osd/PGPeeringEvent.cc
   ${PROJECT_SOURCE_DIR}/src/osd/PGStateUtils.cc
index 4fbe00c70d95a0ddf2dba6c62e58633e85de07bc..6985d26157db65437758e8fd25b8005480bd7532 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "os/Transaction.h"
 #include "osd/ClassHandler.h"
+#include "osd/OSDCap.h"
 #include "osd/PGPeeringEvent.h"
 #include "osd/PeeringState.h"
 
@@ -662,9 +663,29 @@ void OSD::ms_handle_remote_reset(crimson::net::ConnectionRef conn)
 }
 
 void OSD::handle_authentication(const EntityName& name,
-                               const AuthCapsInfo& caps)
+                               const AuthCapsInfo& caps_info)
 {
-  // todo
+  // TODO: store the parsed cap and associate it with the connection
+  if (caps_info.allow_all) {
+    logger().debug("{} {} has all caps", __func__, name);
+    return;
+  }
+  if (caps_info.caps.length() > 0) {
+    auto p = caps_info.caps.cbegin();
+    string str;
+    try {
+      decode(str, p);
+    } catch (ceph::buffer::error& e) {
+      logger().warn("{} {} failed to decode caps string", __func__, name);
+      return;
+    }
+    OSDCap caps;
+    if (caps.parse(str)) {
+      logger().debug("{} {} has caps {}", __func__, name, str);
+    } else {
+      logger().warn("{} {} failed to parse caps {}", __func__, name, str);
+    }
+  }
 }
 
 void OSD::update_stats()