1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2002 Cluster File Systems, Inc.
5 * Author: Peter J. Braam <braam@clusterfs.com>
6 * Author: Phil Schwan <phil@clusterfs.com>
7 * Author: Robert Read <rread@clusterfs.com>
9 * This file is part of Lustre, http://www.lustre.org.
11 * Lustre is free software; you can redistribute it and/or
12 * modify it under the terms of version 2 of the GNU General Public
13 * License as published by the Free Software Foundation.
15 * Lustre is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with Lustre; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #include <portals/ptlctl.h>
33 static int jt_quit(int argc, char **argv) {
34 Parser_quit(argc, argv);
38 static int jt_noop(int argc, char **argv) {
42 command_t cmdlist[] = {
44 {"--device", jt_opt_device, 0, "--device <devno> <command [args ...]>"},
45 {"--threads", jt_opt_threads, 0,
46 "--threads <threads> <devno> <command [args ...]>"},
48 /* Network configuration commands */
49 {"==== network config ====", jt_noop, 0, "network config"},
50 {"network", jt_ptl_setup, 0, "commands that follow apply to net\n"
51 "usage: network <tcp/elan/myrinet>"},
52 {"connect", jt_ptl_connect, 0, "connect to a remote nid\n"
53 "usage: connect [[<hostname> <port>] | <elan id>]"},
54 {"disconnect", jt_ptl_disconnect, 0, "disconnect from a remote nid\n"
55 "usage: disconnect <nid>"},
56 {"mynid", jt_ptl_mynid, 0, "inform the socknal of the local nid. "
57 "The nid defaults to hostname for tcp networks and is automatically "
58 "setup for elan/myrinet networks.\n"
59 "usage: mynid [nid]"},
60 {"add_uuid", jt_ptl_add_uuid, 0, "associate a uuid with a nid\n"
61 "usage: add_uuid <uuid> <nid>"},
62 {"del_uuid", jt_ptl_del_uuid, 0, "delete a uuid association\n"
63 "usage: del_uuid <uuid>"},
64 {"add_route", jt_ptl_add_route, 0,
65 "add an entry to the routing table\n"
66 "usage: add_route <gateway> <target> [target]"},
67 {"del_route", jt_ptl_del_route, 0,
68 "delete an entry from the routing table\n"
69 "usage: del_route <target>"},
70 {"route_list", jt_ptl_print_routes, 0, "print the routing table\n"
72 {"recv_mem", jt_ptl_rxmem, 0, "set socket receive buffer size, "
73 "if size is omited the current size is reported.\n"
74 "usage: recv_mem [size]"},
75 {"send_mem", jt_ptl_txmem, 0, "set socket send buffer size, "
76 "if size is omited the current size is reported.\n"
77 "usage: send_mem [size]"},
78 {"nagle", jt_ptl_nagle, 0, "enable/disable nagle, omiting the "
79 "argument will cause the current nagle setting to be reported.\n"
80 "usage: nagle [on/off]"},
82 /* Device selection commands */
83 {"=== device selection ===", jt_noop, 0, "device selection"},
84 {"newdev", jt_obd_newdev, 0, "create a new device\n"
87 {"uuid2dev", jt_obd_uuid2dev, 0,
88 "find a uuid and make it the current device\n"
89 "usage: uuid2dev <uuid>"},
91 {"name2dev", jt_obd_name2dev, 0,
92 "find a name and make it the current device\n"
93 "usage: name2dev <name>"},
94 {"device", jt_obd_device, 0, "set current device to devno\n"
95 "usage: device <devno>"},
96 {"device_list", jt_obd_list, 0, "show all devices\n"
97 "usage: device_list"},
99 /* Device configuration commands */
100 {"==== device config =====", jt_noop, 0, "device config"},
101 {"attach", jt_obd_attach, 0, "name and type the device\n"
102 "usage: attach type [name [uuid]]"},
103 {"setup", jt_obd_setup, 0,
104 "type specific device configuration information\n"
105 "usage: setup <args...>"},
106 {"cleanup", jt_obd_cleanup, 0, "cleanup setup\n"
108 {"detach", jt_obd_detach, 0, "un-name a device\n"
110 {"lovconfig", jt_obd_lov_config, 0,
111 "write lov configuration to an mds device\n"
112 "usage: lovconfig lov-uuid stripe-count stripe-size offset pattern UUID1 [UUID2 ...]"},
114 /* Device operations */
115 {"=== device operations ==", jt_noop, 0, "device operations"},
116 {"probe", jt_obd_connect, 0,
117 "build a connection handle to a device. This command is used too "
118 "suspend configuration until lctl has ensured that the mds and osc "
119 "services are available. This is to avoid mount failures in a "
120 "rebooting cluster.\n"
121 "usage: probe [<timeout]"},
122 {"close", jt_obd_disconnect, 0, "close the connection handle\n"
124 {"getattr", jt_obd_getattr, 0, "get attribute for id\n"
125 "usage: getattr <id>"},
126 {"setattr", jt_obd_setattr, 0, "set attribute for id\n"
127 "usage: setattr <id> <mode>"},
128 {"test_getattr", jt_obd_test_getattr, 0,
129 "perform count number of getattr's\n"
130 "usage: test_getattr <count> [verbose]"},
131 {"test_brw", jt_obd_test_brw, 0,
132 "perform count number of bulk read/writes\n"
133 "usage: test_brw <count> [write [verbose [pages [obdos]]]]"},
134 {"test_ldlm", jt_obd_test_ldlm, 0, "perform lock manager test\n"
136 {"dump_ldlm", jt_obd_dump_ldlm, 0,
137 "dump all lock manager state (no args)"},
140 {"create", jt_create, 0, "create [count [mode [verbose]]]"},
141 {"destroy", jt_destroy, 0, "destroy <id>"},
142 {"newconn", jt_newconn, 0, "newconn [newuuid]"},
145 {"======== debug =========", jt_noop, 0, "debug"},
146 {"debug_kernel", jt_dbg_debug_kernel, 0,
147 "get debug buffer and dump to a file"
148 "usage: debug_kernel [file] [raw]"},
149 {"debug_file", jt_dbg_debug_file, 0,
150 "read debug buffer from input and dump to output"
151 "usage: debug_file <input> [output] [raw]"},
152 {"clear", jt_dbg_clear_debug_buf, 0, "clear kernel debug buffer\n"
154 {"mark", jt_dbg_mark_debug_buf, 0,"insert marker text in kernel debug buffer\n"
155 "usage: mark <text>"},
156 {"filter", jt_dbg_filter, 0, "filter message type\n"
157 "usage: filter <subsystem id/debug mask>"},
158 {"show", jt_dbg_show, 0, "show message type\n"
159 "usage: show <subsystem id/debug mask>"},
160 {"debug_list", jt_dbg_list, 0, "list subsystem and debug types\n"
161 "usage: debug_list <subs/types>"},
162 {"modules", jt_dbg_modules, 0,
163 "provide gdb-friendly module information\n"
164 "usage: modules <path>"},
165 {"panic", jt_dbg_panic, 0, "force the kernel to panic\n"
168 /* User interface commands */
169 {"======= control ========", jt_noop, 0, "control commands"},
170 {"help", Parser_help, 0, "help"},
171 {"exit", jt_quit, 0, "quit"},
172 {"quit", jt_quit, 0, "quit"},
178 int main(int argc, char **argv)
184 if (ptl_initialize(argc, argv) < 0)
186 if (obd_initialize(argc, argv) < 0)
188 if (dbg_initialize(argc, argv) < 0)
192 rc = Parser_execarg(argc - 1, argv + 1, cmdlist);
194 Parser_init("lctl > ", cmdlist);
195 rc = Parser_commands();
198 obd_cleanup(argc, argv);