]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MonMap: don't crash on dup IP in mon host
authorSage Weil <sage@inktank.com>
Sun, 10 Mar 2013 06:12:00 +0000 (22:12 -0800)
committerSage Weil <sage@inktank.com>
Sun, 10 Mar 2013 06:12:00 +0000 (22:12 -0800)
If the mon_host line has an IP twice, we shouldn't crash.

Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/MonMap.cc

index 5a9d6ce96bd17fc8e4f855b8a4b0767ed13e958a..35615edeba677f7c49cbd1dd3660fb57e070b04d 100644 (file)
@@ -160,7 +160,8 @@ int MonMap::build_from_host_list(std::string hostlist, std::string prefix)
        addrs[i].set_port(CEPH_MON_PORT);
       string name = prefix;
       name += n;
-      add(name, addrs[i]);
+      if (!contains(addrs[i]))
+       add(name, addrs[i]);
     }
     if (addrs.empty())
       return -ENOENT;