From: David Zafman Date: Wed, 3 Jul 2013 19:32:17 +0000 (-0700) Subject: rados: Add namespace arg (--namespace, -N) to rados command X-Git-Tag: v0.67-rc1~127^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=94ccfac41e964ec85d23938131bbdca0e05189f4;p=ceph.git rados: Add namespace arg (--namespace, -N) to rados command Signed-off-by: David Zafman --- diff --git a/src/rados.cc b/src/rados.cc index 7d6f2160cb4c..dd9b4de17947 100644 --- a/src/rados.cc +++ b/src/rados.cc @@ -148,6 +148,9 @@ void usage(ostream& out) " specify input or output file (for certain commands)\n" " --create\n" " create the pool or directory that was specified\n" +" -N namespace\n" +" --namespace=namespace\n" +" specify the namespace to use for the object\n" "\n" "BENCH OPTIONS:\n" " -t N\n" @@ -1046,7 +1049,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, bool create_pool = false; const char *pool_name = NULL; const char *target_pool_name = NULL; - string oloc, target_oloc; + string oloc, target_oloc, nspace; int concurrent_ios = 16; int op_size = 1 << 22; bool cleanup = true; @@ -1178,6 +1181,10 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, return -EINVAL; } } + i = opts.find("namespace"); + if (i != opts.end()) { + nspace = i->second; + } // open rados @@ -1231,6 +1238,9 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, if (oloc.size()) { io_ctx.locator_set_key(oloc); } + if (!nspace.empty()) { + io_ctx.set_namespace(nspace); + } if (snapid != CEPH_NOSNAP) { string name; ret = io_ctx.snap_get_name(snapid, &name); @@ -2321,6 +2331,8 @@ int main(int argc, const char **argv) opts["lock-duration"] = val; } else if (ceph_argparse_witharg(args, i, &val, "--lock-type", (char*)NULL)) { opts["lock-type"] = val; + } else if (ceph_argparse_witharg(args, i, &val, "-N", "--namespace", (char*)NULL)) { + opts["namespace"] = val; } else { if (val[0] == '-') usage_exit();