]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
msg/msg_types: add a default_type param to entity_addr_t::parse()
authorKefu Chai <kchai@redhat.com>
Mon, 5 Apr 2021 02:49:22 +0000 (10:49 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 5 Apr 2021 04:32:45 +0000 (12:32 +0800)
so it can be used in more places.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mon/MonMap.cc
src/msg/msg_types.cc
src/msg/msg_types.h

index 8676443f247cad5ea306fe7208cb08f6d016bbbe..22e4e4709abd9c05627aaa63d5bd4116485443e0 100644 (file)
@@ -660,7 +660,7 @@ int MonMap::init_with_config_file(const ConfigProxy& conf,
     // there on a weird port is a v1 address, and do not handle
     // addrvecs.
     entity_addr_t addr;
-    if (!addr.parse(val.c_str(), nullptr, entity_addr_t::TYPE_LEGACY)) {
+    if (!addr.parse(val, entity_addr_t::TYPE_LEGACY)) {
       errout << "unable to parse address for mon." << mon_name
              << ": addr='" << val << "'" << std::endl;
       continue;
index e6da94ecdb0a638d0fc733399320f0f9c5a8ec69..ab4ee57177a46ae3523b4709fd4e4feacaa1503e 100644 (file)
@@ -96,11 +96,11 @@ void entity_inst_t::generate_test_instances(std::list<entity_inst_t*>& o)
   o.push_back(a);
 }
 
-bool entity_addr_t::parse(const std::string_view s)
+bool entity_addr_t::parse(const std::string_view s, int default_type)
 {
   const char* start = s.data();
   const char* end = nullptr;
-  bool got = parse(start, &end);
+  bool got = parse(start, &end, default_type);
   return got && end == start + s.size();
 }
 
index e5586e45ac9d7a530de5288755512e3009e026e3..93927632f89367e305aa04b686ebcb5621c411ea 100644 (file)
@@ -407,7 +407,7 @@ struct entity_addr_t {
     return ss.str();
   }
 
-  bool parse(const std::string_view s);
+  bool parse(const std::string_view s, int default_type=TYPE_DEFAULT);
   bool parse(const char *s, const char **end = 0, int type=0);
 
   void decode_legacy_addr_after_marker(ceph::buffer::list::const_iterator& bl)