Whamcloud - gitweb
LU-5435 lnet: lustre network latency simulation
[fs/lustre-release.git] / lustre / utils / lctl.c
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
19  *
20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21  * CA 95054 USA or visit www.sun.com if you need additional information or
22  * have any questions.
23  *
24  * GPL HEADER END
25  */
26 /*
27  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
28  * Use is subject to license terms.
29  *
30  * Copyright (c) 2012, 2013, Intel Corporation.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  *
36  * lustre/utils/lctl.c
37  *
38  * Author: Peter J. Braam <braam@clusterfs.com>
39  * Author: Phil Schwan <phil@clusterfs.com>
40  * Author: Robert Read <rread@clusterfs.com>
41  */
42
43 #include <stdlib.h>
44 #include <stdio.h>
45 #include <lnet/lnetctl.h>
46 #include "obdctl.h"
47 #include <libcfs/libcfsutil.h>
48 #include <lustre/lustre_idl.h>
49
50 static int jt_noop(int argc, char **argv) {
51         return 0;
52 }
53
54 static int jt_opt_ignore_errors(int argc, char **argv) {
55         Parser_ignore_errors(1);
56         return 0;
57 }
58
59 command_t cmdlist[] = {
60         /* Metacommands */
61         {"===== metacommands =======", jt_noop, 0, "metacommands"},
62         {"--device", jt_opt_device, 0,
63          "run <command> after connecting to device <devno>\n"
64          "--device <devno> <command [args ...]>"},
65         {"--ignore_errors", jt_opt_ignore_errors, 0,
66          "ignore errors that occur during script processing\n"
67          "--ignore_errors"},
68         {"ignore_errors", jt_opt_ignore_errors, 0,
69          "ignore errors that occur during script processing\n"
70          "ignore_errors"},
71
72         /* User interface commands */
73         {"======== control =========", jt_noop, 0, "control commands"},
74         {"help", Parser_help, 0, "help"},
75         {"lustre_build_version", jt_get_version, 0,
76          "print the build version of lustre\n"
77          "usage: lustre_build_version"},
78         {"exit", Parser_quit, 0, "quit"},
79         {"quit", Parser_quit, 0, "quit"},
80         {"--version", Parser_version, 0,
81          "output build version of the utility and exit"},
82
83         /* Network configuration commands */
84         {"===== network config =====", jt_noop, 0, "network config"},
85         {"--net", jt_opt_net, 0,"run <command> after setting network to <net>\n"
86          "usage: --net <tcp/elan/o2ib/...> <command>"},
87         {"network", jt_ptl_network, 0, "configure LNET"
88          "usage: network up|down"},
89         {"net", jt_ptl_network, 0, "configure LNET"
90          "usage: net up|down"},
91         {"list_nids", jt_ptl_list_nids, 0, "list local NIDs"
92          "usage: list_nids [all]"},
93         {"which_nid", jt_ptl_which_nid, 0, "choose a NID"
94          "usage: which_nid NID [NID...]"},
95         {"replace_nids", jt_replace_nids, 0,
96          "replace primary NIDs for a device\n"
97          "usage: replace_nids <device> <nid1>[,nid2,nid3]"},
98         {"interface_list", jt_ptl_print_interfaces,0,"print interface entries\n"
99          "usage: interface_list"},
100         {"peer_list", jt_ptl_print_peers, 0, "print peer entries\n"
101          "usage: peer_list"},
102         {"conn_list", jt_ptl_print_connections, 0,
103          "print all the connected remote nid\n"
104          "usage: conn_list"},
105         {"active_tx", jt_ptl_print_active_txs, 0, "print active transmits\n"
106          "usage: active_tx"},
107         {"route_list", jt_ptl_print_routes, 0,
108          "print the portals routing table, same as show_route\n"
109          "usage: route_list"},
110         {"show_route", jt_ptl_print_routes, 0,
111          "print the portals routing table, same as route_list\n"
112          "usage: show_route"},
113         {"ping", jt_ptl_ping, 0, "Check LNET connectivity\n"
114          "usage: ping nid [timeout] [pid]"},
115         {"net_drop_add", jt_ptl_drop_add, 0, "Add LNet drop rule\n"
116          "usage: net_drop_add <-s | --source NID>\n"
117          "                    <-d | --dest NID>\n"
118          "                    <<-r | --rate DROP_RATE> |\n"
119          "                     <-i | --interval SECONDS>>\n"
120          "                    [<-p | --portal> PORTAL...]\n"
121          "                    [<-m | --message> <PUT|ACK|GET|REPLY>...]\n"},
122         {"net_drop_del", jt_ptl_drop_del, 0, "remove LNet drop rule\n"
123          "usage: net_drop_del <[-a | --all] |\n"
124          "                    <-s | --source NID>\n"
125          "                    <-d | --dest NID>>\n"},
126         {"net_drop_reset", jt_ptl_drop_reset, 0, "reset drop rule stats\n"
127          "usage: net_drop_reset"},
128         {"net_drop_list", jt_ptl_drop_list, 0, "list LNet drop rules\n"
129          "usage: net_drop_list"},
130         {"net_delay_add", jt_ptl_delay_add, 0, "Add LNet delay rule\n"
131          "usage: net_delay_add <-s | --source NID>\n"
132          "                     <-d | --dest NID>\n"
133          "                     <<-r | --rate DROP_RATE> |\n"
134          "                      <-i | --interval SECONDS>>\n"
135          "                     <-l | --latency SECONDS>\n"
136          "                     [<-p | --portal> PORTAL...]\n"
137          "                     [<-m | --message> <PUT|ACK|GET|REPLY>...]\n"},
138         {"net_delay_del", jt_ptl_delay_del, 0, "remove LNet delay rule\n"
139          "usage: net_delay_del <[-a | --all] |\n"
140          "                     <-s | --source NID>\n"
141          "                     <-d | --dest NID>>\n"},
142         {"net_delay_reset", jt_ptl_delay_reset, 0, "reset delay rule stats\n"
143          "usage: net_delay_reset"},
144         {"net_delay_list", jt_ptl_delay_list, 0, "list LNet delay rules\n"
145          "usage: net_delay_list"},
146
147         /* Device selection commands */
148         {"==== obd device selection ====", jt_noop, 0, "device selection"},
149         {"device", jt_obd_device, 0,
150          "set current device to <name|devno>\n"
151          "usage: device <%name|$name|devno>"},
152         {"device_list", jt_obd_list, 0, "show all devices\n"
153          "usage: device_list"},
154         {"dl", jt_obd_list, 0, "show all devices\n"
155          "usage: dl [-t]"},
156
157         /* Device operations */
158         {"==== obd device operations ====", jt_noop, 0, "device operations"},
159         {"activate", jt_obd_activate, 0, "activate an import\n"},
160         {"deactivate", jt_obd_deactivate, 0, "deactivate an import. "
161          "This command should be used on failed OSC devices in an MDT LOV.\n"},
162         {"abort_recovery", jt_obd_abort_recovery, 0,
163          "abort recovery on a restarting MDT or OST device\n"},
164         {"set_timeout", jt_lcfg_set_timeout, 0,
165          "usage: conf_param obd_timeout=<secs>\n"},
166 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0)
167         {"conf_param", jt_lcfg_mgsparam, 0,"set a permanent config parameter.\n"
168          "This command must be run on the MGS node\n"
169          "usage: conf_param [-d] <target.keyword=val>\n"
170          "  -d  Remove the permanent setting."},
171 #endif
172         {"local_param", jt_lcfg_param, 0, "set a temporary, local param\n"
173          "usage: local_param <target.keyword=val>\n"},
174         {"get_param", jt_lcfg_getparam, 0, "get the Lustre or LNET parameter\n"
175          "usage: get_param [-n|-N|-F] <param_path1 param_path2 ...>\n"
176          "Get the value of Lustre or LNET parameter from the specified path.\n"
177          "The path can contain shell-style filename patterns.\n"
178          "  -n  Print only the value and not parameter name.\n"
179          "  -N  Print only matched parameter names and not the values.\n"
180          "      (Especially useful when using patterns.)\n"
181          "  -F  When -N specified, add '/', '@' or '=' for directories,\n"
182          "      symlinks and writeable files, respectively."},
183         {"set_param", jt_lcfg_setparam, 0, "set the Lustre or LNET parameter\n"
184          "usage: set_param [-n] [-P] [-d]"
185          "<param_path1=value1 param_path2=value2 ...>\n"
186          "Set the value of the Lustre or LNET parameter at the specified path.\n"
187          "  -n  Disable printing of the key name when printing values.\n"
188          "  -P  Set the parameter permanently, filesystem-wide.\n"
189          "  -d  Remove the permanent setting (only with -P option).\n"},
190         {"list_param", jt_lcfg_listparam, 0,
191          "list the Lustre or LNET parameter name\n"
192          "usage: list_param [-F|-R] <param_path1 param_path2 ...>\n"
193          "List the name of Lustre or LNET parameter from the specified path.\n"
194          "  -F  Add '/', '@' or '=' for dirs, symlinks and writeable files,\n"
195                 "respectively.\n"
196          "  -R  Recursively list all parameters under the specified path.\n"},
197
198         /* Debug commands */
199         {"==== debugging control ====", jt_noop, 0, "debug"},
200         {"debug_daemon", jt_dbg_debug_daemon, 0,
201          "debug daemon control and dump to a file\n"
202          "usage: debug_daemon {start file [#MB]|stop}"},
203         {"debug_kernel", jt_dbg_debug_kernel, 0,
204          "get debug buffer and dump to a file, same as dk\n"
205          "usage: debug_kernel [file] [raw]"},
206         {"dk", jt_dbg_debug_kernel, 0,
207          "get debug buffer and dump to a file, same as debug_kernel\n"
208          "usage: dk [file] [raw]"},
209         {"debug_file", jt_dbg_debug_file, 0,
210          "convert a binary debug file dumped by the kernel to ASCII text\n"
211          "usage: debug_file <input> [output]"},
212         {"df", jt_dbg_debug_file, 0,
213          "read debug buffer from input and dump to output, same as debug_file\n"
214          "usage: df <input> [output]"},
215         {"clear", jt_dbg_clear_debug_buf, 0, "clear kernel debug buffer\n"
216          "usage: clear"},
217         {"mark", jt_dbg_mark_debug_buf, 0,
218          "insert marker text in kernel debug buffer\n"
219          "usage: mark <text>"},
220         {"filter", jt_dbg_filter, 0, "filter message type\n"
221          "usage: filter <subsystem id/debug mask>"},
222         {"show", jt_dbg_show, 0, "Show specific type of messages\n"
223          "usage: show <subsystem id/debug mask>"},
224         {"debug_list", jt_dbg_list, 0, "list subsystem and debug types\n"
225          "usage: debug_list <subs/types>"},
226         {"modules", jt_dbg_modules, 0,
227          "provide gdb-friendly module information\n"
228          "usage: modules <path>"},
229
230         /* virtual block operations */
231         {"==== virtual block device ====", jt_noop, 0, "virtual block device"},
232         {"blockdev_attach", jt_blockdev_attach, 0,
233          "attach a lustre regular file to a virtual block device\n"
234          "usage: blockdev_attach <file_name> <device_name>"},
235         {"blockdev_detach", jt_blockdev_detach, 0,
236          "detach a lustre regular file from a virtual block device\n"
237          "usage: blockdev_detach <device_name>"},
238         {"blockdev_info", jt_blockdev_info, 0,
239          "get the device info of a attached file\n"
240          "usage: blockdev_info <device_name>"},
241
242         /* Pool commands */
243         {"===  Pools ==", jt_noop, 0, "pool management"},
244         {"pool_new", jt_pool_cmd, 0,
245          "add a new pool\n"
246          "usage: pool_new <fsname>.<poolname>"},
247         {"pool_add", jt_pool_cmd, 0,
248          "add the named OSTs to the pool\n"
249          "usage: pool_add <fsname>.<poolname> <ostname indexed list>"},
250         {"pool_remove", jt_pool_cmd, 0,
251          "remove the named OST from the pool\n"
252          "usage: pool_remove <fsname>.<poolname> <ostname indexed list>"},
253         {"pool_destroy", jt_pool_cmd, 0,
254          "destroy a pool\n"
255          "usage: pool_destroy <fsname>.<poolname>"},
256         {"pool_list", jt_pool_cmd, 0,
257          "list pools and pools members\n"
258          "usage: pool_list  <fsname>[.<poolname>] | <pathname>"},
259
260         /* Nodemap commands */
261         {"=== Nodemap ===", jt_noop, 0, "nodemap management"},
262         {"nodemap_activate", jt_nodemap_activate, 0,
263          "activate nodemap idmapping functions\n"
264          "usage: nodemap_activate"},
265         {"nodemap_add", jt_nodemap_add, 0,
266          "add a new nodemap\n"
267          "usage: nodemap_add <nodemap_name>"},
268         {"nodemap_del", jt_nodemap_del, 0,
269          "remove a nodemap\n"
270          "usage: nodemap_del <nodemap_name>"},
271         {"nodemap_add_range", jt_nodemap_add_range, 0,
272          "add a range to a nodemap\n"
273          "usage: nodemap_add_range <NID range>"},
274         {"nodemap_del_range", jt_nodemap_del_range, 0,
275          "add a range to a nodemap\n"
276          "usage: nodemap_del_range <NID range>"},
277         {"nodemap_modify", jt_nodemap_modify, 0,
278          "modify a nodemap parameters"
279          "usage: nodemap_modify nodemap_name param value"},
280         {"nodemap_add_idmap", jt_nodemap_add_idmap, 0,
281          "add a UID or GID mapping to a nodemap"},
282         {"nodemap_del_idmap", jt_nodemap_del_idmap, 0,
283          "delete a UID or GID mapping from a nodemap"},
284         {"nodemap_test_nid", jt_nodemap_test_nid, 0,
285          "usage: nodemap_test_nid <nid>"},
286         {"nodemap_test_id", jt_nodemap_test_id, 0,
287          "Usage: nodemap_test_id --nid <nid> --idtype [uid|gid] --id <id>"},
288
289         /* Changelog commands */
290         {"===  Changelogs ==", jt_noop, 0, "changelog user management"},
291         {"changelog_register", jt_changelog_register, 0,
292          "register a new persistent changelog user, returns id\n"
293          "usage:\tdevice <mdtname>\n\tchangelog_register [-n]"},
294         {"changelog_deregister", jt_changelog_deregister, 0,
295          "deregister an existing changelog user\n"
296          "usage:\tdevice <mdtname>\n\tchangelog_deregister <id>"},
297
298         /* Device configuration commands */
299         {"== device setup (these are not normally used post 1.4) ==",
300                 jt_noop, 0, "device config"},
301         {"attach", jt_lcfg_attach, 0,
302          "set the type, name, and uuid of the current device\n"
303          "usage: attach type name uuid"},
304         {"detach", jt_obd_detach, 0,
305          "remove driver (and name and uuid) from current device\n"
306          "usage: detach"},
307         {"setup", jt_lcfg_setup, 0,
308          "type specific device configuration information\n"
309          "usage: setup <args...>"},
310         {"cleanup", jt_obd_cleanup, 0, "cleanup previously setup device\n"
311          "usage: cleanup [force | failover]"},
312         {"dump_cfg", jt_cfg_dump_log, 0,
313          "print log of recorded commands for this config to kernel debug log\n"
314          "usage: dump_cfg config-uuid-name"},
315
316         /* Test only commands */
317         {"==== testing (DANGEROUS) ====", jt_noop, 0, "testing (DANGEROUS)"},
318         {"--threads", jt_opt_threads, 0,
319          "run <threads> separate instances of <command> on device <devno>\n"
320          "--threads <threads> <verbose> <devno> <command [args ...]>"},
321         {"lookup", jt_obd_mdc_lookup, 0, "report file mode info\n"
322          "usage: lookup <directory> <file>"},
323         {"readonly", jt_obd_set_readonly, 0,
324          "disable writes to the underlying device\n"},
325         {"notransno", jt_obd_no_transno, 0,
326          "disable sending of committed-transno updates\n"},
327         {"add_uuid", jt_lcfg_add_uuid, 0, "associate a UUID with a nid\n"
328          "usage: add_uuid <uuid> <nid>"},
329         {"del_uuid", jt_lcfg_del_uuid, 0, "delete a UUID association\n"
330          "usage: del_uuid <uuid>"},
331         {"add_peer", jt_ptl_add_peer, 0, "add an peer entry\n"
332          "usage: add_peer <nid> <host> <port>"},
333         {"del_peer", jt_ptl_del_peer, 0, "remove an peer entry\n"
334          "usage: del_peer [<nid>] [<ipaddr|pid>]"},
335         {"add_conn ", jt_lcfg_add_conn, 0,
336          "usage: add_conn <conn_uuid> [priority]\n"},
337         {"del_conn ", jt_lcfg_del_conn, 0,
338          "usage: del_conn <conn_uuid> \n"},
339         {"disconnect", jt_ptl_disconnect, 0, "disconnect from a remote nid\n"
340          "usage: disconnect [<nid>]"},
341         {"push", jt_ptl_push_connection, 0, "flush connection to a remote nid\n"
342          "usage: push [<nid>]"},
343         {"mynid", jt_ptl_mynid, 0, "inform the socknal of the local nid. "
344          "The nid defaults to hostname for tcp networks and is automatically "
345          "setup for elan/myrinet networks.\n"
346          "usage: mynid [<nid>]"},
347         {"fail", jt_ptl_fail_nid, 0, "fail/restore communications.\n"
348          "Omitting the count means indefinitely, 0 means restore, "
349          "otherwise fail 'count' messages.\n"
350          "usage: fail nid|_all_ [count]"},
351
352         /*Test commands for echo client*/
353         {"test_create", jt_obd_test_create, 0,
354          "create files on MDT by echo client\n"
355          "usage: test_create [-d parent_basedir] <-D parent_count> "
356          "[-b child_base_id] <-c stripe_count> <-n count> <-t time>\n"},
357         {"test_mkdir", jt_obd_test_mkdir, 0,
358          "mkdir on MDT by echo client\n"
359          "usage: test_mkdir [-d parent_basedir] <-D parent_count>"
360          "[-b child_base_id] [-n count] <-t time>\n"},
361         {"test_destroy", jt_obd_test_destroy, 0,
362          "Destroy files on MDT by echo client\n"
363          "usage: test_destroy [-d parent_basedir] <-D parent_count>"
364          "[-b child_base_id] [-n count] <-t time>\n"},
365         {"test_rmdir", jt_obd_test_rmdir, 0,
366          "rmdir on MDT by echo client\n"
367          "usage: test_rmdir [-d parent_basedir] <-D parent_count>"
368          "[-b child_base_id] [-n count] <-t time>\n"},
369         {"test_lookup", jt_obd_test_lookup, 0,
370          "lookup files on MDT by echo client\n"
371          "usage: test_lookup [-d parent_basedir] <-D parent_count>"
372          "[-b child_base_id] [-n count] <-t time>\n"},
373         {"test_setxattr", jt_obd_test_setxattr, 0,
374          "Set EA for files/directory on MDT by echo client\n"
375          "usage: test_setxattr [-d parent_baseid] <-D parent_count>"
376          "[-b child_base_id] [-n count] <-t time>\n"},
377         {"test_md_getattr", jt_obd_test_md_getattr, 0,
378          "getattr files on MDT by echo client\n"
379          "usage: test_md_getattr [-d parent_basedir] <-D parent_count>"
380          "[-b child_base_id] [-n count] <-t time>\n"},
381         {"getattr", jt_obd_getattr, 0,
382          "get attribute for OST object <objid>\n"
383          "usage: getattr <objid>"},
384         {"setattr", jt_obd_setattr, 0,
385          "set mode attribute for OST object <objid>\n"
386          "usage: setattr <objid> <mode>"},
387         {"create", jt_obd_create, 0,
388          "create <num> OST objects (with <mode>)\n"
389          "usage: create [num [mode [verbose [lsm data]]]]"},
390         {"destroy", jt_obd_destroy, 0,
391          "destroy OST object <objid> [num [verbose]]\n"
392          "usage: destroy <num> objects, starting at objid <objid>"},
393         {"test_getattr", jt_obd_test_getattr, 0,
394          "do <num> getattrs (on OST object <objid> (objid+1 on each thread))\n"
395          "usage: test_getattr <num> [verbose [[t]objid]]"},
396         {"test_setattr", jt_obd_test_setattr, 0,
397          "do <num> setattrs (on OST object <objid> (objid+1 on each thread))\n"
398          "usage: test_setattr <num> [verbose [[t]objid]]"},
399         {"test_brw", jt_obd_test_brw, 0,
400          "do <num> bulk read/writes (<npages> per I/O, on OST object <objid>)\n"
401          "usage: test_brw [t]<num> [write [verbose [npages [[t]objid]]]]"},
402         {"memhog", jt_ptl_memhog, 0,
403          "memory pressure testing\n"
404          "usage: memhog <page count> [<gfp flags>]"},
405         {"getobjversion", jt_get_obj_version, 0,
406          "get the version of an object on servers\n"
407          "usage: getobjversion <fid>\n"
408          "       getobjversion -i <id> -g <group>"},
409
410         /* LFSCK commands */
411         {"==== LFSCK ====", jt_noop, 0, "LFSCK"},
412         {"lfsck_start", jt_lfsck_start, 0, "start LFSCK\n"
413          "usage: lfsck_start <-M | --device [MDT,OST]_device>\n"
414          "                   [-A | --all] [-c | --create_ostobj [on | off]]\n"
415          "                   [-C | --create_mdtobj [on | off]]\n"
416          "                   [-e | --error {continue | abort}] [-h | --help]\n"
417          "                   [-n | --dryrun [on | off]] [-o | --orphan]\n"
418          "                   [-r | --reset] [-s | --speed speed_limit]\n"
419          "                   [-t | --type lfsck_type[,lfsck_type...]]\n"
420          "                   [-w | --window_size size]"},
421         {"lfsck_stop", jt_lfsck_stop, 0, "stop lfsck(s)\n"
422          "usage: lfsck_stop <-M | --device [MDT,OST]_device>\n"
423          "                  [-A | --all] [-h | --help]"},
424
425         {"==== obsolete (DANGEROUS) ====", jt_noop, 0, "obsolete (DANGEROUS)"},
426         /* some test scripts still use these */
427         {"cfg_device", jt_obd_device, 0,
428          "set current device to <name>\n"
429          "usage: device <name>"},
430         {"recover", jt_obd_recover, 0,
431          "try to restore a lost connection immediately\n"
432          "usage: recover [MDC/OSC device]"},
433         /* saving for sanity 44a */
434         {"lov_getconfig", jt_obd_lov_getconfig, 0,
435          "read lov configuration from an mds device\n"
436          "usage: lov_getconfig <mountpoint>"},
437         /* Llog operations */
438         {"llog_catlist", jt_llog_catlist, 0,
439          "list all catalog logs on current device.\n"
440          "usage: llog_catlist"},
441         {"llog_info", jt_llog_info, 0,
442          "print log header information.\n"
443          "usage: llog_info <$logname|#oid#ogr#ogen>\n"
444          "       oid, ogr and ogen are hexadecimal."},
445         {"llog_print", jt_llog_print, 0,
446          "print log content information.\n"
447          "usage: llog_print <$logname|#oid#ogr#ogen> [from] [to]\n"
448          "       oid, ogr and ogen are hexadecimal.\n"
449          "       print all records from index 1 by default."},
450         {"llog_check", jt_llog_check, 0,
451          "print log content information.\n"
452          "usage: llog_check <$logname|#oid#ogr#ogen> [from] [to]\n"
453          "       oid, ogr and ogen are hexadecimal.\n"
454          "       check all records from index 1 by default."},
455          {"llog_cancel", jt_llog_cancel, 0,
456          "cancel one record in log.\n"
457          "This command supports both positional and optional arguments\n"
458          "usage (positional args): "
459          "llog_cancel <catalog id|catalog name> [log id] <index>\n"
460          "usage (optional args): "
461          "llog_cancel --catalog <catalog id|catalog name> --log_id <log_id> "
462          "--log_idx <index>"},
463         {"llog_remove", jt_llog_remove, 0,
464          "remove one log from catalog or plain log, erase it from disk.\n"
465          "usage: llog_remove <catalog id|catalog name> <log id>"},
466         /* network operations */
467         {"add_interface", jt_ptl_add_interface, 0, "add interface entry\n"
468          "usage: add_interface ip [netmask]"},
469         {"del_interface", jt_ptl_del_interface, 0, "del interface entry\n"
470          "usage: del_interface [ip]"},
471         {"add_route", jt_ptl_add_route, 0,
472          "add an entry to the portals routing table\n"
473          "usage: add_route <gateway> [<hops> [<priority>]]"},
474         {"del_route", jt_ptl_del_route, 0,
475          "delete route via gateway to targets from the portals routing table\n"
476          "usage: del_route <gateway> [<target>] [<target>]"},
477         {"set_route", jt_ptl_notify_router, 0,
478          "enable/disable routes via gateway in the portals routing table\n"
479          "usage: set_route <gateway> <up/down> [<time>]"},
480
481         { 0, 0, 0, NULL }
482 };
483
484 int lctl_main(int argc, char **argv)
485 {
486         int rc;
487
488         setlinebuf(stdout);
489
490         ptl_initialize(argc, argv);
491         if (obd_initialize(argc, argv) < 0)
492                 exit(2);
493         if (dbg_initialize(argc, argv) < 0)
494                 exit(3);
495
496         Parser_init("lctl > ", cmdlist);
497
498         if (argc > 1) {
499                 rc = Parser_execarg(argc - 1, argv + 1, cmdlist);
500         } else {
501                 rc = Parser_commands();
502         }
503
504         obd_finalize(argc, argv);
505         return rc < 0 ? -rc : rc;
506 }
507
508 #ifndef LIBLUSTRE_TEST
509 int main (int argc, char **argv)
510 {
511         return (lctl_main (argc, argv));
512 }
513 #endif