From: Pan Liu Date: Thu, 8 Dec 2016 12:03:30 +0000 (+0800) Subject: rbd: --max_part and --nbds_max options for nbd map X-Git-Tag: v10.2.6~61^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=26c87fd1f1d105e5aa1c4c32c73f75414ea3d04f;p=ceph.git rbd: --max_part and --nbds_max options for nbd map Fixes: http://tracker.ceph.com/issues/18186 Signed-off-by: Pan Liu (cherry picked from commit 45ceb389b685a5ec7bc0b8ef9e180ce851646082) Conflicts: src/test/cli/rbd/help.t (no --exclusive in jewel-next) src/tools/rbd/action/Nbd.cc (no --exclusive in jewel-next) --- diff --git a/src/test/cli/rbd/help.t b/src/test/cli/rbd/help.t index 6c86a413a3d5b..9c7bd9e554110 100644 --- a/src/test/cli/rbd/help.t +++ b/src/test/cli/rbd/help.t @@ -973,7 +973,8 @@ rbd help nbd map usage: rbd nbd map [--pool ] [--image ] [--snap ] - [--read-only] [--device ] + [--read-only] [--device ] [--nbds_max ] + [--max_part ] Map image to a nbd device. @@ -988,6 +989,8 @@ --snap arg snapshot name --read-only mount read-only --device arg specify nbd device + --nbds_max arg override module param nbds_max + --max_part arg override module param max_part rbd help nbd unmap usage: rbd nbd unmap diff --git a/src/tools/rbd/action/Nbd.cc b/src/tools/rbd/action/Nbd.cc index 478e42ae96489..32710969b84a9 100644 --- a/src/tools/rbd/action/Nbd.cc +++ b/src/tools/rbd/action/Nbd.cc @@ -100,7 +100,9 @@ void get_map_arguments(po::options_description *positional, at::ARGUMENT_MODIFIER_NONE); options->add_options() ("read-only", po::bool_switch(), "mount read-only") - ("device", po::value(), "specify nbd device"); + ("device", po::value(), "specify nbd device") + ("nbds_max", po::value(), "override module param nbds_max") + ("max_part", po::value(), "override module param max_part"); } int execute_map(const po::variables_map &vm) @@ -137,6 +139,14 @@ int execute_map(const po::variables_map &vm) args.push_back("--device"); args.push_back(vm["device"].as().c_str()); } + if (vm.count("nbds_max")) { + args.push_back("--nbds_max"); + args.push_back(vm["nbds_max"].as().c_str()); + } + if (vm.count("max_part")) { + args.push_back("--max_part"); + args.push_back(vm["max_part"].as().c_str()); + } return call_nbd_cmd(vm, args); }