]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/mount/conf.cc
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / mount / conf.cc
index 014cc821c00d3991a9ab1ea52a2857353b619457..104969eefbf39830c7c58f379b44cafd2ef71e10 100644 (file)
@@ -6,16 +6,21 @@
 #include <cstring>
 #include <map>
 
+#include "common/async/context_pool.h"
 #include "common/ceph_context.h"
 #include "common/ceph_argparse.h"
-#include "global/global_init.h"
 #include "common/config.h"
+#include "global/global_init.h"
+
 #include "auth/KeyRing.h"
-#include "mount.ceph.h"
 #include "mon/MonClient.h"
 
+#include "mount.ceph.h"
+
+
 extern "C" void mount_ceph_get_config_info(const char *config_file,
                                           const char *name,
+                                          bool v2_addrs,
                                           struct ceph_config_info *cci)
 {
   int err;
@@ -40,7 +45,8 @@ extern "C" void mount_ceph_get_config_info(const char *config_file,
   conf.parse_env(cct->get_module_type()); // environment variables override
   conf.apply_changes(nullptr);
 
-  MonClient monc = MonClient(cct.get());
+  ceph::async::io_context_pool ioc(1);
+  MonClient monc = MonClient(cct.get(), ioc);
   err = monc.build_initial_monmap();
   if (err)
     goto scrape_keyring;
@@ -48,9 +54,17 @@ extern "C" void mount_ceph_get_config_info(const char *config_file,
   for (const auto& mon : monc.monmap.addr_mons) {
     auto& eaddr = mon.first;
 
-    // For now, kernel client only accepts legacy addrs
-    if (!eaddr.is_legacy())
-      continue;
+    /*
+     * Filter v1 addrs if we're running in ms_mode=legacy. Filter
+     * v2 addrs for any other ms_mode.
+     */
+    if (v2_addrs) {
+      if (!eaddr.is_msgr2())
+       continue;
+    } else {
+      if (!eaddr.is_legacy())
+       continue;
+    }
 
     std::string addr;
     addr += eaddr.ip_only_to_str();