-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathibtool
executable file
·113 lines (100 loc) · 3.36 KB
/
ibtool
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/env python
# Copyright 2011 Obsidian Research Corp. GPLv2, see COPYING.
import sys;
import rdma;
from libibtool.tools import *;
# Generate the global command map
banner = """Command suite for IB management v%s"""%(rdma.__version__);
commands = {
"ibroute": None,
"dump_lfts": (".ibroute",),
"dump_lfts.sh": (".ibroute","cmd_dump_lfts",False),
"dump_mfts": (".ibroute",),
"dump_mfts.sh": (".ibroute","cmd_dump_mfts",False),
"ibfindnodesusing": (".ibroute",),
"ibfindnodesusing.pl": (".ibroute","cmd_ibfindnodesusing",False),
"perfquery": None,
"ibswportwatch": (".perfquery",),
"ibswportwatch.pl": (".perfquery","cmd_ibswportwatch",False),
"saquery": None,
"smpquery": None,
"ibtracert": None,
"ibv_devices": (".inquiry",),
"ibstat": (".inquiry",),
"ibstatus": (".inquiry",),
"ibaddr": (".inquiry",),
"sminfo": (".inquiry",),
"smpdump": (".inquiry",),
"decode_mad": (".inquiry",),
"ibportstate": (".inquiry",),
"query": (".inquiry",),
"set_nodedesc": (".inquiry",),
"set_nodedesc.sh": (".inquiry","cmd_set_nodedesc",False),
"ibhosts": (".discovery",),
"ibprintca": (".discovery",),
"ibprintca.pl": (".discovery","cmd_ibprintca",False),
"ibrouters": (".discovery",),
"ibprintrt": (".discovery",),
"ibprintrt.pl": (".discovery","cmd_ibprintrt",False),
"ibswitches": (".discovery",),
"ibprintswitch": (".discovery",),
"ibprintswitch.pl": (".discovery","cmd_ibprintswitch",False),
"ibnodes": (".discovery",),
"ibnetdiscover": (".discovery",),
"iblinkinfo": (".discovery",),
"iblinkinfo.pl": (".discovery","cmd_iblinkinfo",False),
"ibchecknode": (".errors",),
"ibcheckstate": (".errors",),
"ibcheckport": (".errors",),
"ibchecknet": (".errors",),
"ibcheckportstate": (".errors",),
"ibcheckportwidth": (".errors",),
"ibcheckwidth": (".errors",),
"ibcheckerrs": (".errors",),
"ibcheckerrors": (".errors",),
"ibclearcounters": (".errors",),
"ibclearerrors": (".errors",),
"ibdatacounters": (".errors",),
"ibdatacounts": (".errors",),
"ibidsverify": (".errors",),
"ibidsverify.pl": (".errors","cmd_ibidsverify",False),
"rdma_bw": None,
"vendstat": None,
"ibsysstat": (".vendstat",),
"ibping": (".vendstat",),
"subnet_diff": None,
"ibdiscover.pl": (".subnet_diff","cmd_subnet_diff",False),
"set_port_state": None,
"init_all_ports": (".set_port_state",),
"set_guid": (".guid",),
"help": (".tools",),
};
if __name__ == '__main__':
if len(sys.argv) == 1:
cmd_help([],MyOptParse(cmd_help));
sys.exit(0);
argv = sys.argv[2:];
cmd = sys.argv[1];
if commands.has_key(cmd):
func,shown = get_cmd_func(cmd);
o = MyOptParse(func);
try:
if not func(argv,o):
sys.exit(100);
sys.exit(0);
except CmdError as err:
print "E:",err;
if o.verbosity >= 2:
raise;
except rdma.MADError as err:
err.dump_detailed(sys.stderr,"E:",level=o.verbosity);
if o.verbosity >= 2:
raise;
except rdma.RDMAError as err:
print "E:",err;
if o.verbosity >= 2:
raise;
sys.exit(100);
else:
sys.stderr.write("Bad command %s\n"%(sys.argv[1]));
sys.exit(1);