Skip to content

Commit

Permalink
ceph_filestore_dump: Add list-omap object command
Browse files Browse the repository at this point in the history
Signed-off-by: David Zafman <david.zafman@inktank.com>
(cherry picked from commit 48890c7)
  • Loading branch information
David Zafman authored and dzafman committed Mar 3, 2015
1 parent 303e4ce commit fcabb81
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/tools/ceph_filestore_dump.cc
Expand Up @@ -1204,6 +1204,28 @@ int do_list_attrs(ObjectStore *store, coll_t coll, ghobject_t &ghobj)
return 0;
}

int do_list_omap(ObjectStore *store, coll_t coll, ghobject_t &ghobj)
{
ObjectMap::ObjectMapIterator iter = store->get_omap_iterator(coll, ghobj);
if (!iter) {
cerr << "omap_get_iterator: " << cpp_strerror(ENOENT) << std::endl;
return -ENOENT;
}
iter->seek_to_first();
map<string, bufferlist> oset;
while(iter->valid()) {
get_omap_batch(iter, oset);

for (map<string,bufferlist>::iterator i = oset.begin();i != oset.end(); ++i) {
string key(i->first);
if (outistty)
cleanbin(key);
cout << key << std::endl;
}
}
return 0;
}

void usage(po::options_description &desc)
{
cerr << std::endl;
Expand Down Expand Up @@ -1582,6 +1604,12 @@ int main(int argc, char **argv)
ret = 1;
}
goto out;
} else if (objcmd == "list-omap") {
int r = do_list_omap(fs, coll, ghobj);
if (r) {
ret = 1;
}
goto out;
}
cerr << "Unknown object command '" << objcmd << "'" << std::endl;
usage(desc);
Expand Down

0 comments on commit fcabb81

Please sign in to comment.