]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMap: make lookup_pg_pool_name const
authorSage Weil <sage@redhat.com>
Sun, 20 Jul 2014 17:35:38 +0000 (10:35 -0700)
committerJohn Spray <john.spray@redhat.com>
Mon, 25 Aug 2014 00:34:01 +0000 (01:34 +0100)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc
src/osd/OSDMap.h

index 2d0a563a3eabf469f156029c5746eafe6b409d6b..1cadbda10f36149b559be44038ab5dc5dfecab2a 100644 (file)
@@ -4074,7 +4074,7 @@ void TestOpsSocketHook::test_ops(OSDService *service, ObjectStore *store,
     string poolstr;
 
     cmd_getval(service->cct, cmdmap, "pool", poolstr);
-    pool = curmap->const_lookup_pg_pool_name(poolstr.c_str());
+    pool = curmap->lookup_pg_pool_name(poolstr);
     //If we can't find it by name then maybe id specified
     if (pool < 0 && isdigit(poolstr[0]))
       pool = atoll(poolstr.c_str());
index 983a44d2f3729eadbab9b09a74781b8f25e4c46b..0c48889f1f5fb9514149f2e631a7cfbb3ff2fda9 100644 (file)
@@ -689,14 +689,11 @@ public:
     return false;
   }
 
-  int64_t lookup_pg_pool_name(const string& name) {
-    if (name_pool.count(name))
-      return name_pool[name];
-    return -ENOENT;
-  }
-
-  int64_t const_lookup_pg_pool_name(const char *name) const {
-    return const_cast<OSDMap *>(this)->lookup_pg_pool_name(name);
+  int64_t lookup_pg_pool_name(const string& name) const {
+    map<string,int64_t>::const_iterator p = name_pool.find(name);
+    if (p == name_pool.end())
+      return -ENOENT;
+    return p->second;
   }
 
   int64_t get_pool_max() const {