From 562dce138b49af1c2a9d439bb79e49a412a34175 Mon Sep 17 00:00:00 2001 From: Marc Vef Date: Tue, 15 Sep 2020 15:50:56 +0200 Subject: [PATCH 1/2] Simplify daemon arg parsing code, using dashes for args instead of underscores --- README.md | 4 ++-- src/daemon/daemon.cpp | 15 ++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 81811f10e..d07585b86 100644 --- a/README.md +++ b/README.md @@ -170,12 +170,12 @@ Allowed options: defined, the argument is ignored. Default 'ib'. -H [ --hosts-file ] arg Shared file used by deamons to register their enpoints. (default './gkfs_hosts.txt') - -P [ --rpc_protocol ] arg Used RPC protocol for inter-node communication. + -P [ --rpc-protocol ] arg Used RPC protocol for inter-node communication. Available: {ofi+sockets, ofi+verbs, ofi+psm2} for (TCP, Infiniband, and Omni-Path, respectively. (Default ofi+sockets) Libfabric must have verbs or psm2 support enabled. - --auto_sm Enables intra-node communication (IPCs) via the + --auto-sm Enables intra-node communication (IPCs) via the `na+sm` (shared memory) protocol, instead of using the RPC protocol. (Default off) --version print version and exit diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp index e963b469e..a9901c4e8 100644 --- a/src/daemon/daemon.cpp +++ b/src/daemon/daemon.cpp @@ -312,8 +312,8 @@ void initialize_loggers() { */ void parse_input(const po::variables_map& vm) { auto rpc_protocol = string(gkfs::rpc::protocol::ofi_sockets); - if (vm.count("rpc_protocol")) { - rpc_protocol = vm["rpc_protocol"].as(); + if (vm.count("rpc-protocol")) { + rpc_protocol = vm["rpc-protocol"].as(); if (rpc_protocol != gkfs::rpc::protocol::ofi_verbs && rpc_protocol != gkfs::rpc::protocol::ofi_sockets && rpc_protocol != gkfs::rpc::protocol::ofi_psm2) { @@ -323,10 +323,7 @@ void parse_input(const po::variables_map& vm) { } } - auto use_auto_sm = false; - if (vm.count("auto_sm")) { - use_auto_sm = true; - } + auto use_auto_sm = vm.count("auto-sm") != 0; GKFS_DATA->use_auto_sm(use_auto_sm); GKFS_DATA->spdlogger()->debug("{}() Shared memory (auto_sm) for intra-node communication (IPCs) set to '{}'.", __func__, use_auto_sm); @@ -426,12 +423,12 @@ int main(int argc, const char* argv[]) { "is already defined, the argument is ignored. Default 'ib'.") ("hosts-file,H", po::value(), "Shared file used by deamons to register their " - "enpoints. (default './gkfs_hosts.txt')") - ("rpc_protocol,P", po::value(), "Used RPC protocol for inter-node communication.\n" + "endpoints. (default './gkfs_hosts.txt')") + ("rpc-protocol,P", po::value(), "Used RPC protocol for inter-node communication.\n" "Available: {ofi+sockets, ofi+verbs, ofi+psm2} for (TCP, Infiniband, " "and Omni-Path, respectively. (Default ofi+sockets)\n" "Libfabric must have enabled support verbs or psm2") - ("auto_sm", "Enables intra-node communication (IPCs) via the `na+sm` (shared memory) protocol, " + ("auto-sm", "Enables intra-node communication (IPCs) via the `na+sm` (shared memory) protocol, " "instead of using the RPC protocol. (Default off)") ("version", "print version and exit"); po::variables_map vm{}; -- GitLab From 6746bf3e4e08656e8d30b302d48528d3d02284ff Mon Sep 17 00:00:00 2001 From: Marc Vef Date: Tue, 15 Sep 2020 16:04:35 +0200 Subject: [PATCH 2/2] Refactoring daemon argument description and fixing typos --- README.md | 36 +++++++++++++++++++----------------- src/daemon/daemon.cpp | 16 +++++++++------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index d07585b86..97cb559fc 100644 --- a/README.md +++ b/README.md @@ -157,28 +157,30 @@ Further options: ```bash Allowed options: -h [ --help ] Help message - -m [ --mountdir ] arg pseudo mountdir - -r [ --rootdir ] arg data directory - -i [ --metadir ] arg metadata directory, if not set rootdir is used for - metadata - -l [ --listen ] arg Address or interface to bind the daemon on. + -m [ --mountdir ] arg Virtual mounting directory where GekkoFS is + available. + -r [ --rootdir ] arg Local data directory where GekkoFS data for this + daemon is stored. + -i [ --metadir ] arg Metadata directory where GekkoFS' RocksDB data + directory is located. If not set, rootdir is used. + -l [ --listen ] arg Address or interface to bind the daemon to. Default: local hostname. - When used with ofi+verbs the FI_VERBS_IFACE - environment variable is set accordingly which - associates the verbs device with the network - interface. In case FI_VERBS_IFACE is already + When used with ofi+verbs the FI_VERBS_IFACE + environment variable is set accordingly which + associates the verbs device with the network + interface. In case FI_VERBS_IFACE is already defined, the argument is ignored. Default 'ib'. - -H [ --hosts-file ] arg Shared file used by deamons to register their - enpoints. (default './gkfs_hosts.txt') + -H [ --hosts-file ] arg Shared file used by deamons to register their + endpoints. (default './gkfs_hosts.txt') -P [ --rpc-protocol ] arg Used RPC protocol for inter-node communication. - Available: {ofi+sockets, ofi+verbs, ofi+psm2} for - (TCP, Infiniband, and Omni-Path, respectively. + Available: {ofi+sockets, ofi+verbs, ofi+psm2} for + TCP, Infiniband, and Omni-Path, respectively. (Default ofi+sockets) - Libfabric must have verbs or psm2 support enabled. - --auto-sm Enables intra-node communication (IPCs) via the - `na+sm` (shared memory) protocol, instead of using + Libfabric must have enabled support verbs or psm2. + --auto-sm Enables intra-node communication (IPCs) via the + `na+sm` (shared memory) protocol, instead of using the RPC protocol. (Default off) - --version print version and exit + --version Print version and exit. ``` Shut it down by gracefully killing the process (SIGTERM). diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp index a9901c4e8..f8cd9d935 100644 --- a/src/daemon/daemon.cpp +++ b/src/daemon/daemon.cpp @@ -414,10 +414,12 @@ int main(int argc, const char* argv[]) { po::options_description desc("Allowed options"); desc.add_options() ("help,h", "Help message") - ("mountdir,m", po::value()->required(), "User Fuse mountdir") - ("rootdir,r", po::value()->required(), "data directory") - ("metadir,i", po::value(), "metadata directory, if not set rootdir is used for metadata ") - ("listen,l", po::value(), "Address or interface to bind the daemon on. Default: local hostname.\n" + ("mountdir,m", po::value()->required(), "Virtual mounting directory where GekkoFS is available.") + ("rootdir,r", po::value()->required(), + "Local data directory where GekkoFS data for this daemon is stored.") + ("metadir,i", po::value(), + "Metadata directory where GekkoFS' RocksDB data directory is located. If not set, rootdir is used.") + ("listen,l", po::value(), "Address or interface to bind the daemon to. Default: local hostname.\n" "When used with ofi+verbs the FI_VERBS_IFACE environment variable is set accordingly " "which associates the verbs device with the network interface. In case FI_VERBS_IFACE " "is already defined, the argument is ignored. Default 'ib'.") @@ -425,12 +427,12 @@ int main(int argc, const char* argv[]) { "Shared file used by deamons to register their " "endpoints. (default './gkfs_hosts.txt')") ("rpc-protocol,P", po::value(), "Used RPC protocol for inter-node communication.\n" - "Available: {ofi+sockets, ofi+verbs, ofi+psm2} for (TCP, Infiniband, " + "Available: {ofi+sockets, ofi+verbs, ofi+psm2} for TCP, Infiniband, " "and Omni-Path, respectively. (Default ofi+sockets)\n" - "Libfabric must have enabled support verbs or psm2") + "Libfabric must have enabled support verbs or psm2.") ("auto-sm", "Enables intra-node communication (IPCs) via the `na+sm` (shared memory) protocol, " "instead of using the RPC protocol. (Default off)") - ("version", "print version and exit"); + ("version", "Print version and exit."); po::variables_map vm{}; po::store(po::parse_command_line(argc, argv, desc), vm); -- GitLab