//------------------------------------------------------------------------------
// @file: com_proto_node.cc
// @author: Fabio Luchetti - CERN
//------------------------------------------------------------------------------
/************************************************************************
* EOS - the CERN Disk Storage System *
* Copyright (C) 2018 CERN/Switzerland *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your token) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see .*
************************************************************************/
#include "console/ConsoleMain.hh"
#include "console/commands/helpers/NodeHelper.hh"
extern int com_node(char*);
void com_node_help();
//------------------------------------------------------------------------------
// Node command entry point
//------------------------------------------------------------------------------
int com_protonode(char* arg)
{
if (wants_help(arg)) {
com_node_help();
global_retc = EINVAL;
return EINVAL;
}
NodeHelper node(gGlobalOpts);
if (!node.ParseCommand(arg)) {
com_node_help();
global_retc = EINVAL;
return EINVAL;
}
global_retc = node.Execute();
return global_retc;
}
//------------------------------------------------------------------------------
// Print help message
//------------------------------------------------------------------------------
void com_node_help()
{
std::ostringstream oss;
oss
<< " usage:\n"
<< "node ls [-s] [-b|--brief] [-m|-l|--sys|--io|--fsck] [] : list all nodes or only . is a substring match and can be a comma seperated list\n"
<< "\t -s : silent mode\n"
<< "\t -b : display host names without domain names\n"
<< "\t -m : monitoring key=value output format\n"
<< "\t -l : long output - list also file systems after each node\n"
<< "\t --io : print IO statistics\n"
<< "\t --sys : print SYS statistics (memory + threads)\n"
<< "\t --fsck : print filesystem check statistcis\n"
<< std::endl
<< "node config = : error.simulation=io_read|io_write|xs_read|xs_write|fmd_open|fake_write|close|unresponsive\n"
<< "\t If offset is given the the error will get triggered for request past the given value.\n"
<< "\t Accepted format for offset: 8B, 10M, 20G etc.\n"
<< "\t io_read[_] : simulate read errors\n"
<< "\t io_write[_] : simulate write errors\n"
<< "\t xs_read : simulate checksum errors when reading a file\n"
<< "\t xs_write : simulate checksum errors when writing a file\n"
<< "\t fmd_open : simulate a file metadata mismatch when opening a file\n"
<< "\t fake_write : do not really write data to disk\n"
<< "\t close : return an error on close\n"
<< "\t unresponsive : emulate a write/close request taking 2 minutes\n"
<< "\t : disable error simulation (every value than the previous ones are fine!)\n"
<< "\t : publish.interval= - set the filesystem state publication interval to seconds\n"
<< "\t : debug.level= - set the node into debug level [default=notice] -> see debug --help for available levels\n"
<< "\t : for other keys see help of 'fs config' for details\n"
<< std::endl
<< "node set | on|off : activate/deactivate node\n"
<< std::endl
<< "node rm | : remove a node\n"
<< std::endl
<< "node txgw | : enable (on) or disable (off) node as a transfer gateway\n"
<< std::endl
<< "node proxygroupadd | : add a node to a proxy group\n"
<< std::endl
<< "node proxygrouprm | : rm a node from a proxy group\n"
<< std::endl
<< "node proxygroupclear | : clear the list of groups a node belongs to\n"
<< std::endl
<< "node status | : print's all defined variables for a node\n"
<< std::endl;
std::cerr << oss.str() << std::endl;
}