Skip to content

Commit

Permalink
curvefs_tool readme & curvefs_tool adjust
Browse files Browse the repository at this point in the history
1. add curvefs_tool readme
2. adjust some curvefs_tool output
3. fix check-copyset no output by set show = true
4. fix query-partition name show error in --example
  • Loading branch information
Cyber-SiKu authored and SeanHai committed Dec 16, 2021
1 parent 9e370f2 commit af03f70
Show file tree
Hide file tree
Showing 8 changed files with 527 additions and 22 deletions.
501 changes: 501 additions & 0 deletions curvefs/src/tools/README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions curvefs/src/tools/check/curvefs_copyset_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace check {

void CopysetCheckTool::PrintHelp() {
CurvefsToolRpc::PrintHelp();
std::cout << " -copysetsId=" << FLAGS_copysetId
<< " -poolsId=" << FLAGS_poolId
std::cout << " -copysetId=" << FLAGS_copysetId
<< " -poolId=" << FLAGS_poolId
<< " [-metaserverAddr=" << FLAGS_metaserverAddr << "]";
std::cout << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion curvefs/src/tools/check/curvefs_copyset_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CopysetCheckTool
curvefs::metaserver::copyset::CopysetService_Stub> {
public:
explicit CopysetCheckTool(const std::string& cmd = kCopysetCheckCmd,
bool show = false)
bool show = true)
: CurvefsToolRpc(cmd) {
show_ = show;
}
Expand Down
30 changes: 15 additions & 15 deletions curvefs/src/tools/curvefs_tool_define.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,22 @@ const char kConfPathHelp[] = "[-confPath=/etc/curvefs/tools.conf]";
const char kHelpStr[] =
"Usage: curvefs_tool [Command] [OPTIONS...]\n"
"COMMANDS:\n" // NOLINT
"version: show the version of cluster\n"
"build-topology: build cluster topology based on topo.json\n"
"umount-fs: umount curvefs from local and cluster\n"
"usage-metadata: show the metadata usage of cluster\n"
"status-mds: show the status of mds\n"
"version: show the version of curvefs_tool\n"
"status-mds: show the status of mds\n"
"status-metaserver: show the status of metaserver\n"
"status-etcd: show the status of etcd\n"
"status-copyset: show the status of copyset\n"
"list-fs: list all fs in cluster\n"
"list-copysetInfo: list all copysetInfo in cluster\n"
"query-copyset: query copyset by copysetId\n"
"query-partition: query copyset in partition\n"
"query-metaserver: query metaserver by metaserverId or metaserverName\n"
"query-fs: query fs by fsId or fsName\n"
"delete-fs: delete fs by fsId or fsName\n"
"check-copyset: checkout copyset status\n"
"status-etcd: show the status of etcd\n"
"status-copyset: show the status of copyset\n"
"list-fs: list all fs in cluster\n"
"list-copysetInfo: list all copysetInfo in cluster\n"
"build-topology: build cluster topology based on topo.json\n"
"umount-fs: umount curvefs from local and cluster\n"
"usage-metadata: show the metadata usage of cluster\n"
"delete-fs: delete fs by fsName\n"
"check-copyset: checkout copyset status\n"
"query-copyset: query copyset by copysetId and poolId\n"
"query-partition: query copyset in partition by partitionId\n"
"query-metaserver: query metaserver by metaserverId or metaserverName\n"
"query-fs: query fs by fsId or fsName\n"
"You can specify the config path by -confPath to avoid typing too many "
"options\n"; // NOLINT

Expand Down
5 changes: 4 additions & 1 deletion curvefs/src/tools/list/curvefs_copysetinfo_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ bool CopysetInfoListTool::AfterSendRequestToHost(const std::string& host) {
ret = false;
} else if (show_) {
for (auto const& i : response_->copysetvalues()) {
std::cout << i.DebugString() << " ";
std::cout << "copyset["
<< copyset::GetCopysetKey(i.copysetinfo().poolid(),
i.copysetinfo().copysetid())
<< "]:" << std::endl << i.DebugString() << std::endl;
}
std::cout << std::endl;
}
Expand Down
1 change: 1 addition & 0 deletions curvefs/src/tools/list/curvefs_copysetinfo_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <string>

#include "curvefs/proto/topology.pb.h"
#include "curvefs/src/tools/copyset/curvefs_copyset_base_tool.h"
#include "curvefs/src/tools/curvefs_tool.h"
#include "curvefs/src/tools/curvefs_tool_define.h"
#include "src/common/string_util.h"
Expand Down
4 changes: 2 additions & 2 deletions curvefs/src/tools/query/curvefs_copyset_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ bool CopysetQueryTool::AfterSendRequestToHost(const std::string& host) {

if (show_) {
for (auto const& i : copysetKeys_) {
std::cout << "copyset[" << i << "]:\n info:\n";
std::cout << "copyset[" << i << "]:\n-info:" << std::endl;
for (auto const& j : key2Infos_[i]) {
std::cout << j.ShortDebugString() << std::endl;
}
if (FLAGS_detail) {
std::cout << "\nstatus:" << std::endl;
std::cout << "-status:" << std::endl;
for (auto const& j : key2Status_[i]) {
std::cout << j.ShortDebugString() << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion curvefs/src/tools/query/curvefs_partition_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class PartitionQueryTool
curvefs::mds::topology::GetCopysetOfPartitionResponse,
curvefs::mds::topology::TopologyService_Stub> {
public:
explicit PartitionQueryTool(const std::string& cmd = kCopysetQueryCmd,
explicit PartitionQueryTool(const std::string& cmd = kPartitionQueryCmd,
bool show = true)
: CurvefsToolRpc(cmd) {
show_ = show;
Expand Down

0 comments on commit af03f70

Please sign in to comment.