Skip to content

Commit

Permalink
ceph_filestore_dump: Add get-attr 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 55d43c0)
  • Loading branch information
David Zafman authored and dzafman committed Mar 3, 2015
1 parent 55c21b8 commit 6724da8
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/tools/ceph_filestore_dump.cc
Expand Up @@ -1307,6 +1307,26 @@ int do_set_bytes(ObjectStore *store, coll_t coll, ghobject_t &ghobj, int fd)
return 0;
}

int do_get_attr(ObjectStore *store, coll_t coll, ghobject_t &ghobj, string key)
{
bufferptr bp;

int r = store->getattr(coll, ghobj, key.c_str(), bp);
if (r < 0) {
cerr << "getattr: " << cpp_strerror(-r) << std::endl;
return r;
}

string value(bp.c_str(), bp.length());
if (outistty) {
cleanbin(value);
value.push_back('\n');
}
cout << value;

return 0;
}

void usage(po::options_description &desc)
{
cerr << std::endl;
Expand Down Expand Up @@ -1727,6 +1747,13 @@ int main(int argc, char **argv)
if (r)
ret = 1;
goto out;
} else if (objcmd == "get-attr") {
if (vm.count("arg1") == 0)
usage(desc);
r = do_get_attr(fs, coll, ghobj, arg1);
if (r)
ret = 1;
goto out;
}
cerr << "Unknown object command '" << objcmd << "'" << std::endl;
usage(desc);
Expand Down

0 comments on commit 6724da8

Please sign in to comment.