Whamcloud - gitweb
LU-10452 lnet: cleanup YAML output
[fs/lustre-release.git] / lnet / utils / lnetconfig / liblnetconfig.h
index d69bfcd..227a66e 100644 (file)
@@ -18,7 +18,7 @@
  *
  * LGPL HEADER END
  *
- * Copyright (c) 2014, 2016, Intel Corporation.
+ * Copyright (c) 2014, 2017, Intel Corporation.
  *
  * Author:
  *   Amir Shehata <amir.shehata@intel.com>
@@ -27,7 +27,9 @@
 #ifndef LIB_LNET_CONFIG_API_H
 #define LIB_LNET_CONFIG_API_H
 
-#include <lnet/lnet.h>
+#include <libcfs/util/string.h>
+#include <linux/lnet/lnet-dlc.h>
+#include <linux/lnet/nidstr.h>
 
 #define LUSTRE_CFG_RC_NO_ERR                    0
 #define LUSTRE_CFG_RC_BAD_PARAM                        -1
@@ -38,9 +40,6 @@
 #define LUSTRE_CFG_RC_NO_MATCH                 -6
 #define LUSTRE_CFG_RC_MATCH                    -7
 
-#include <lnet/lnet.h>
-#include <libcfs/libcfs_string.h>
-
 struct lnet_dlc_network_descr {
        struct list_head network_on_rule;
        __u32 nw_id;
@@ -124,11 +123,13 @@ int lustre_lnet_del_route(char *nw, char *gw, int seq_no,
  *   seq_no - sequence number of the request
  *   show_rc - [OUT] The show output in YAML.  Must be freed by caller.
  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
+ *   backup - true to output only what's necessary for reconfiguring
+ *           a node.
  */
 int lustre_lnet_show_route(char *nw, char *gw,
                           int hops, int prio, int detail,
                           int seq_no, struct cYAML **show_rc,
-                          struct cYAML **err_rc);
+                          struct cYAML **err_rc, bool backup);
 
 /*
  * lustre_lnet_config_ni
@@ -173,9 +174,12 @@ int lustre_lnet_del_ni(struct lnet_dlc_network_descr *nw,
  *   seq_no - sequence number of the request
  *   show_rc - [OUT] The show output in YAML.  Must be freed by caller.
  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
+ *   backup - true to output only what's necessary for reconfiguring
+ *           a node.
  */
 int lustre_lnet_show_net(char *nw, int detail, int seq_no,
-                        struct cYAML **show_rc, struct cYAML **err_rc);
+                        struct cYAML **show_rc, struct cYAML **err_rc,
+                        bool backup);
 
 /*
  * lustre_lnet_enable_routing
@@ -218,6 +222,53 @@ int lustre_lnet_show_numa_range(int seq_no, struct cYAML **show_rc,
                                struct cYAML **err_rc);
 
 /*
+ * lustre_lnet_config_max_intf
+ *   Sets the maximum number of interfaces per node. this tunable is
+ *   primarily useful for sanity checks prior to allocating memory.
+ *
+ *   max - maximum value to configure
+ *   seq_no - sequence number of the request
+ *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
+ *   caller
+ */
+int lustre_lnet_config_max_intf(int max, int seq_no, struct cYAML **err_rc);
+
+/*
+ * lustre_lnet_show_max_intf
+ *    show current maximum interface setting
+ *
+ *   seq_no - sequence number of the request
+ *   show_rc - [OUT] struct cYAML tree containing NUMA range info
+ *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
+ *   caller
+ */
+int lustre_lnet_show_max_intf(int seq_no, struct cYAML **show_rc,
+                             struct cYAML **err_rc);
+
+/*
+ * lustre_lnet_config_discovery
+ *   Enable or disable peer discovery. Peer discovery is enabled by default.
+ *
+ *   enable - non-0 enables, 0 disables
+ *   seq_no - sequence number of the request
+ *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
+ *   caller
+ */
+int lustre_lnet_config_discovery(int enable, int seq_no, struct cYAML **err_rc);
+
+/*
+ * lustre_lnet_show_discovery
+ *    show current peer discovery setting
+ *
+ *   seq_no - sequence number of the request
+ *   show_rc - [OUT] struct cYAML tree containing NUMA range info
+ *   err_rc - [OUT] struct cYAML tree describing the error. Freed by
+ *   caller
+ */
+int lustre_lnet_show_discovery(int seq_no, struct cYAML **show_rc,
+                              struct cYAML **err_rc);
+
+/*
  * lustre_lnet_config_buffers
  *   Send down an IOCTL to configure routing buffer sizes.  A value of 0 means
  *   default that particular buffer to default size. A value of -1 means
@@ -240,9 +291,11 @@ int lustre_lnet_config_buffers(int tiny, int small, int large,
  *   seq_no - sequence number of the request
  *   show_rc - [OUT] The show output in YAML.  Must be freed by caller.
  *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
+ *   backup - true to output only what's necessary for reconfiguring
+ *           a node.
  */
 int lustre_lnet_show_routing(int seq_no, struct cYAML **show_rc,
-                            struct cYAML **err_rc);
+                            struct cYAML **err_rc, bool backup);
 
 /*
  * lustre_lnet_show_stats
@@ -258,58 +311,99 @@ int lustre_lnet_show_stats(int seq_no, struct cYAML **show_rc,
 
 /*
  * lustre_lnet_config_peer_nid
- *   Add a peer nid to an peer identified by knid. If no knid is given
+ *   Add a peer nid to a peer with primary nid pnid. If no pnid is given
  *   then the first nid in the nid list becomes the primary nid for
  *   a newly created peer.
- *   Otherwise if knid is provided an it's unique then a new peer is
- *   created with knid as the primary NID and the nids in the nid list as
+ *   Otherwise if pnid is provided and it's unique then a new peer is
+ *   created with pnid as the primary NID and the nids in the nid list as
  *   secondary nids.
- *   If any of the peers nids provided in with exception to the knid is
+ *   If any of the peers nids provided in with exception to the pnid is
  *   not unique the operation fails. Some peer nids might have already
  *   been added. It's the role of the caller of this API to remove the
  *   added NIDs if they wish.
  *
- *     knid - Key NID of the peer
+ *     pnid - Primary NID of the peer
  *     nid - list of nids to add
  *     num_nids - number of nids in the nid array
  *     mr - true if this peer is MR capable.
  *     seq_no - sequence number of the command
  *     err_rc - YAML strucutre of the resultant return code.
  */
-int lustre_lnet_config_peer_nid(char *knid, char **nid, int num_nids,
+int lustre_lnet_config_peer_nid(char *pnid, char **nid, int num_nids,
                                bool mr, int seq_no, struct cYAML **err_rc);
 
 /*
  * lustre_lnet_del_peer_nid
- *  Delete the nids identified in the nid list from the peer identified by
- *  knid. If knid is NULL or it doesn't identify a peer the operation
+ *  Delete the nids given in the nid list from the peer with primary NID
+ *  pnid. If pnid is NULL or it doesn't identify a peer the operation
  *  fails and no change happens to the system.
  *  The operation is aborted on the first NID that fails to be deleted.
  *
- *     knid - Key NID of the peer
+ *     pnid - Primary NID of the peer
  *     nid - list of nids to add
  *     num_nids - number of nids in the nid array
  *     seq_no - sequence number of the command
  *     err_rc - YAML strucutre of the resultant return code.
  */
-int lustre_lnet_del_peer_nid(char *knid, char **nid, int num_nids,
+int lustre_lnet_del_peer_nid(char *pnid, char **nid, int num_nids,
                             int seq_no, struct cYAML **err_rc);
 
 /*
  * lustre_lnet_show_peer
- *   Show the peer identified by knid. If knid is NULL all peers in the
- *   system are shown.
+ *   Show the peer identified by nid, knid. If knid is NULL all
+ *   peers in the system are shown.
  *
- *     knid - Key NID of the peer
+ *     knid - A NID of the peer
  *     detail - display detailed information
  *     seq_no - sequence number of the command
  *     show_rc - YAML structure of the resultant show
  *     err_rc - YAML strucutre of the resultant return code.
+ *     backup - true to output only what's necessary for reconfiguring
+ *             a node.
  *
  */
 int lustre_lnet_show_peer(char *knid, int detail, int seq_no,
+                         struct cYAML **show_rc, struct cYAML **err_rc,
+                         bool backup);
+
+/*
+ * lustre_lnet_list_peer
+ *   List the known peers.
+ *
+ *     seq_no - sequence number of the command
+ *     show_rc - YAML structure of the resultant show
+ *     err_rc - YAML strucutre of the resultant return code.
+ *
+ */
+int lustre_lnet_list_peer(int seq_no,
                          struct cYAML **show_rc, struct cYAML **err_rc);
 
+/* lustre_lnet_ping_nid
+ *   Ping the nid list, pnids.
+ *
+ *    pnids - NID list to ping.
+ *    timeout - timeout(seconds) for ping.
+ *    seq_no - sequence number of the command.
+ *    show_rc - YAML structure of the resultant show.
+ *    err_rc - YAML strucutre of the resultant return code.
+ *
+ */
+int lustre_lnet_ping_nid(char *pnid, int timeout, int seq_no,
+                       struct cYAML **show_rc, struct cYAML **err_rc);
+
+/* lustre_lnet_discover_nid
+ *   Discover the nid list, pnids.
+ *
+ *    pnids - NID list to discover.
+ *    force - force discovery.
+ *    seq_no - sequence number of the command.
+ *    show_rc - YAML structure of the resultant show.
+ *    err_rc - YAML strucutre of the resultant return code.
+ *
+ */
+int lustre_lnet_discover_nid(char *pnid, int force, int seq_no,
+                            struct cYAML **show_rc, struct cYAML **err_rc);
+
 /*
  * lustre_yaml_config
  *   Parses the provided YAML file and then calls the specific APIs
@@ -343,6 +437,18 @@ int lustre_yaml_show(char *f, struct cYAML **show_rc,
                     struct cYAML **err_rc);
 
 /*
+ * lustre_yaml_exec
+ *   Parses the provided YAML file and then calls the specific APIs
+ *   to execute the entities identified in the file
+ *
+ *   f - YAML file
+ *   show_rc - [OUT] The show output in YAML.  Must be freed by caller.
+ *   err_rc - [OUT] struct cYAML tree describing the error. Freed by caller
+ */
+int lustre_yaml_exec(char *f, struct cYAML **show_rc,
+                    struct cYAML **err_rc);
+
+/*
  * lustre_lnet_init_nw_descr
  *     initialize the network descriptor structure for use
  */
@@ -377,17 +483,4 @@ int lustre_lnet_parse_interfaces(char *intf_str,
 int lustre_lnet_parse_nids(char *nids, char **array, int size,
                           char ***out_array);
 
-/*
- * lustre_lnet_send_dbg_task
- *     send a debug task to be carried out in the kernel. This API will
- *     not be exposed to the user through lnetctl utility. It can only be
- *     executed by being called directly.
- *             dbg_task: The task to be carried out
- *             dbg_info: task specific information
- */
-int lustre_lnet_send_dbg_task(enum lnet_dbg_task dbg_task,
-                             struct lnet_dbg_task_info *dbg_info,
-                             struct cYAML **show_rc,
-                             struct cYAML **err_rc);
-
 #endif /* LIB_LNET_CONFIG_API_H */