summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2012-04-29 10:10:41 -0700
committerSage Weil <sage@newdream.net>2012-04-29 10:10:41 -0700
commit4465c3ab74453c9c07849ec2934df878eba8ce29 (patch)
tree6dc7a2143c2ac0b14f631b346161d06cbe1018ad
parentbf4966cf1458a8b013070c7ff8732f5671b34461 (diff)
downloadceph-4465c3ab74453c9c07849ec2934df878eba8ce29.tar.gz
osdmap: fix identify_osd() and find_osd_on_ip()
In 313c1566d3b649ef81fcdc722678d77dccfa888f we switched to using the get_addr() accessor methods, which assert that the osd exists. Check that before calling. Fixes: #2361 Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r--src/osd/OSDMap.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc
index 8396111ceb8..fb73a83a98a 100644
--- a/src/osd/OSDMap.cc
+++ b/src/osd/OSDMap.cc
@@ -549,7 +549,7 @@ void OSDMap::adjust_osd_weights(const map<int,double>& weights, Incremental& inc
int OSDMap::identify_osd(const entity_addr_t& addr) const
{
for (int i=0; i<max_osd; i++)
- if ((get_addr(i) == addr) || (get_cluster_addr(i) == addr))
+ if (exists(i) && (get_addr(i) == addr || get_cluster_addr(i) == addr))
return i;
return -1;
}
@@ -557,7 +557,7 @@ int OSDMap::identify_osd(const entity_addr_t& addr) const
bool OSDMap::find_osd_on_ip(const entity_addr_t& ip) const
{
for (int i=0; i<max_osd; i++)
- if (get_addr(i).is_same_host(ip) || get_cluster_addr(i).is_same_host(ip))
+ if (exists(i) && (get_addr(i).is_same_host(ip) || get_cluster_addr(i).is_same_host(ip)))
return i;
return -1;
}