]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
krbd: "rbd device map" command should use msgr2 by default 64635/head
authorMiki Patel <miki.patel132@gmail.com>
Wed, 23 Jul 2025 11:41:10 +0000 (17:11 +0530)
committerMiki Patel <miki.patel132@gmail.com>
Thu, 24 Jul 2025 06:46:34 +0000 (12:16 +0530)
Making msgr2 and ms_mode=prefer-crc as default option for "rbd device
map" command

Fixes: https://tracker.ceph.com/issues/72134
Signed-off-by: Miki Patel <miki.patel132@gmail.com>
src/krbd.cc

index 5f6e32b6cff3048b26276403b9221e4f2ca30ba3..f232fdf8c3ee3028391ff98564a1a0185fb16a15 100644 (file)
@@ -192,7 +192,8 @@ static int have_minor_attr(void)
 static int build_map_buf(CephContext *cct, const krbd_spec& spec,
                          const string& options, string *pbuf)
 {
-  bool msgr2 = false;
+  bool msgr2 = true;
+  bool ms_mode_specified = false;
   std::ostringstream oss;
   int r;
 
@@ -202,6 +203,7 @@ static int build_map_buf(CephContext *cct, const krbd_spec& spec,
     if (boost::starts_with(t, "ms_mode=")) {
       /* msgr2 unless ms_mode=legacy */
       msgr2 = t.compare(8, t.npos, "legacy");
+      ms_mode_specified = true;
     }
   }
 
@@ -272,6 +274,12 @@ static int build_map_buf(CephContext *cct, const krbd_spec& spec,
 
   if (!options.empty())
     oss << "," << options;
+
+  /* setting default messenger: msgr2 in prefer-crc mode */
+  if (!ms_mode_specified) {
+    oss << ",ms_mode=prefer-crc";
+  }
+
   if (!spec.nspace_name.empty())
     oss << ",_pool_ns=" << spec.nspace_name;