From 45ceb389b685a5ec7bc0b8ef9e180ce851646082 Mon Sep 17 00:00:00 2001 From: Pan Liu Date: Thu, 8 Dec 2016 20:03:30 +0800 Subject: [PATCH] rbd: --max_part and --nbds_max options for nbd map Fixes: http://tracker.ceph.com/issues/18186 Signed-off-by: Pan Liu --- src/test/cli/rbd/help.t | 3 +++ src/tools/rbd/action/Nbd.cc | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/test/cli/rbd/help.t b/src/test/cli/rbd/help.t index 750af9311c181..df8ad63f851b4 100644 --- a/src/test/cli/rbd/help.t +++ b/src/test/cli/rbd/help.t @@ -1087,6 +1087,7 @@ rbd help nbd map usage: rbd nbd map [--pool ] [--image ] [--snap ] [--read-only] [--exclusive] [--device ] + [--nbds_max ] [--max_part ] Map image to a nbd device. @@ -1102,6 +1103,8 @@ --read-only mount read-only --exclusive forbid other clients write --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 adc10110ff562..ab8db1f6f9217 100644 --- a/src/tools/rbd/action/Nbd.cc +++ b/src/tools/rbd/action/Nbd.cc @@ -101,7 +101,9 @@ void get_map_arguments(po::options_description *positional, options->add_options() ("read-only", po::bool_switch(), "mount read-only") ("exclusive", po::bool_switch(), "forbid other clients write") - ("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) @@ -141,6 +143,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); } -- 2.47.3