summaryrefslogtreecommitdiff
path: root/src/rados.cc
diff options
context:
space:
mode:
authorSamuel Just <samuel.just@dreamhost.com>2011-12-07 17:06:01 -0800
committerSamuel Just <samuel.just@dreamhost.com>2011-12-09 13:44:37 -0800
commit4ce7dd4819e17826d6845403d0f957d06ef5505b (patch)
treecb3d8d03be9230962fd16c579966f681118c6efb /src/rados.cc
parent111c12ceb9b85d221c04236dcfc946b338f46633 (diff)
downloadceph-4ce7dd4819e17826d6845403d0f957d06ef5505b.tar.gz
rados.cc: add --object-locator and object locator output to ls
--object-locator locator causes io to use the specified locator. For objects with non-empty locators, rados pool ls will output the locator as well. Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
Diffstat (limited to 'src/rados.cc')
-rw-r--r--src/rados.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/rados.cc b/src/rados.cc
index d77aa2f4da0..1ea886d7949 100644
--- a/src/rados.cc
+++ b/src/rados.cc
@@ -90,6 +90,8 @@ void usage(ostream& out)
STR(DEFAULT_NUM_RADOS_WORKER_THREADS) ")\n"
"\n"
"GLOBAL OPTIONS:\n"
+" --object_locator object_locator\n"
+" set object_locator for operation"
" -p pool\n"
" --pool=pool\n"
" select given pool by name\n"
@@ -563,6 +565,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
int ret;
bool create_pool = false;
const char *pool_name = NULL;
+ string oloc;
int concurrent_ios = 16;
int op_size = 1 << 22;
const char *snapname = NULL;
@@ -591,6 +594,10 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
if (i != opts.end()) {
pool_name = i->second.c_str();
}
+ i = opts.find("object_locator");
+ if (i != opts.end()) {
+ oloc = i->second;
+ }
i = opts.find("category");
if (i != opts.end()) {
category = i->second;
@@ -713,6 +720,9 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
return 1;
}
}
+ if (oloc.size()) {
+ io_ctx.locator_set_key(oloc);
+ }
if (snapid != CEPH_NOSNAP) {
string name;
ret = io_ctx.snap_get_name(snapid, &name);
@@ -855,7 +865,10 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
librados::ObjectIterator i = io_ctx.objects_begin();
librados::ObjectIterator i_end = io_ctx.objects_end();
for (; i != i_end; ++i) {
- *outstream << *i << std::endl;
+ if (i->second.size())
+ *outstream << i->first << "\t" << i->second << std::endl;
+ else
+ *outstream << i->first << std::endl;
}
}
if (!stdout)
@@ -1274,6 +1287,8 @@ int main(int argc, const char **argv)
opts["pretty-format"] = "true";
} else if (ceph_argparse_witharg(args, i, &val, "-p", "--pool", (char*)NULL)) {
opts["pool"] = val;
+ } else if (ceph_argparse_witharg(args, i, &val, "--object-locator" , (char *)NULL)) {
+ opts["object_locator"] = val;
} else if (ceph_argparse_witharg(args, i, &val, "--category", (char*)NULL)) {
opts["category"] = val;
} else if (ceph_argparse_witharg(args, i, &val, "-t", "--concurrent-ios", (char*)NULL)) {