]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_objectstore_tool: Check that pool exists before allowing import
authorDavid Zafman <dzafman@redhat.com>
Wed, 19 Nov 2014 19:41:39 +0000 (11:41 -0800)
committerDavid Zafman <dzafman@redhat.com>
Tue, 3 Mar 2015 19:20:59 +0000 (11:20 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit f24f646d870703b7b79563cdbc20920248be6142)

Conflicts:
src/tools/ceph_objectstore_tool.cc

src/tools/ceph_objectstore_tool.cc

index 3c90c3cb41f24a2b47121e802edea83da3b4a2e1..bc98b615c16d8dc60e7c88ee50e1275365cf282b 100644 (file)
@@ -1608,6 +1608,18 @@ int do_import(ObjectStore *store, OSDSuperblock& sb)
     return 1;
   }
 
+  // Don't import if pool no longer exists
+  OSDMap curmap;
+  ret = get_osdmap(store, sb.current_epoch, curmap);
+  if (ret) {
+    cerr << "Can't find local OSDMap" << std::endl;
+    return ret;
+  }
+  if (!curmap.have_pg_pool(pgid.pgid.m_pool)) {
+    cerr << "Pool " << pgid.pgid.m_pool << " no longer exists" << std::endl;
+    return 1;
+  }
+
   log_oid = OSD::make_pg_log_oid(pgid);
   biginfo_oid = OSD::make_pg_biginfo_oid(pgid);