]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/ActivePyModules: don't take unnecessary lock
authorSage Weil <sage@newdream.net>
Tue, 29 Jun 2021 22:49:52 +0000 (18:49 -0400)
committerSage Weil <sage@newdream.net>
Wed, 30 Jun 2021 15:20:11 +0000 (11:20 -0400)
This isn't needed.

Signed-off-by: Sage Weil <sage@newdream.net>
(cherry picked from commit 3ee6f97b3ed172be98dd429a4aef54de5fb689f7)

src/mgr/ActivePyModules.cc

index 51a008d8f8084dc12b0db8e36716254ac3d6b994..3d924d0ca5dcdfa61441e9bc8fb2c4fbecb9f91b 100644 (file)
@@ -487,22 +487,20 @@ PyObject *ActivePyModules::get_python(const std::string &what)
       return f.get();
     });
   } else if (what == "mgr_ips") {
-    return cluster_state.with_mgrmap([&](const MgrMap &mgr_map) {
-      with_gil_t with_gil{no_gil};
-      f.open_array_section("ips");
-      std::set<std::string> did;
-      for (auto& i : server.get_myaddrs().v) {
-       std::string ip = i.ip_only_to_str();
-       if (did.count(ip)) {
-         continue;
-       }
-       did.insert(ip);
-       f.dump_string("ip", ip);
+    entity_addrvec_t myaddrs = server.get_myaddrs();
+    with_gil_t with_gil{no_gil};
+    f.open_array_section("ips");
+    std::set<std::string> did;
+    for (auto& i : myaddrs.v) {
+      std::string ip = i.ip_only_to_str();
+      if (did.count(ip)) {
+       continue;
       }
-      f.close_section();
-      return f.get();
-    });
-
+      did.insert(ip);
+      f.dump_string("ip", ip);
+    }
+    f.close_section();
+    return f.get();
   } else if (what == "have_local_config_map") {
     with_gil_t with_gil{no_gil};
     f.dump_bool("have_local_config_map", have_local_config_map);