[ofa-general] Re: [opensm patch] support dump_conf command in opensm console

Sasha Khapyorsky sashak at voltaire.com
Sun Nov 9 09:25:18 PST 2008


Hi Al,

On 16:39 Mon 03 Nov     , Al Chu wrote:
> Hey Sasha,
> 
> When config files are rescanned and loaded, there's no way to know if
> the right configuration was actually reloaded or not.  A console command
> to dump the current config is a useful way to verify the loading of new
> configs or not.
> 
> This patch assumes the fixes from my "fix qos config parsing bugs" is
> accepted.

Didn't pass over it, sorry about delay.

> 
> Al
> 
> -- 
> Albert Chu
> chu11 at llnl.gov
> Computer Scientist
> High Performance Systems Division
> Lawrence Livermore National Laboratory

> From 249607e47ec7ef1b92f9578cece90460418d12b8 Mon Sep 17 00:00:00 2001
> From: Albert Chu <chu11 at llnl.gov>
> Date: Mon, 3 Nov 2008 16:22:29 -0800
> Subject: [PATCH] support dump_conf console command
> 
> 
> Signed-off-by: Albert Chu <chu11 at llnl.gov>
> ---
>  opensm/opensm/osm_console.c |  158 +++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 158 insertions(+), 0 deletions(-)
> 
> diff --git a/opensm/opensm/osm_console.c b/opensm/opensm/osm_console.c
> index d9bbbc2..8422655 100644
> --- a/opensm/opensm/osm_console.c
> +++ b/opensm/opensm/osm_console.c
> @@ -53,6 +53,10 @@
>  #include <complib/cl_passivelock.h>
>  #include <opensm/osm_perfmgr.h>
>  
> +#define NULL_STR "(null)"
> +
> +#define BOOLEAN_STR(__b) ((__b) ? "TRUE" : "FALSE")
> +
>  struct command {
>  	char *name;
>  	void (*help_function) (FILE * out, int detail);
> @@ -189,6 +193,14 @@ static void help_lidbalance(FILE * out, int detail)
>  	}
>  }
>  
> +static void help_dump_conf(FILE *out, int detail)
> +{
> +	fprintf(out, "dump_conf\n");
> +	if (detail) {
> +		fprintf(out, "dump current opensm configuration\n");
> +	}
> +}
> +
>  #ifdef ENABLE_OSM_PERF_MGR
>  static void help_perfmgr(FILE * out, int detail)
>  {
> @@ -1136,6 +1148,151 @@ static void perfmgr_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
>  }
>  #endif				/* ENABLE_OSM_PERF_MGR */
>  
> +static void dump_qos_options(osm_qos_options_t * opt,
> +			     osm_qos_options_t * dflt, 
> +			     char *prefix,
> +			     FILE * out)
> +{
> +	fprintf(out, "%s_max_vls : %u\n",
> +		prefix, opt->max_vls ? opt->max_vls : dflt->max_vls);
> +	fprintf(out, "%s_high_limit : %u\n",
> +		prefix, opt->high_limit >= 0 ? (unsigned)opt->high_limit : (unsigned)dflt->high_limit);
> +	fprintf(out, "%s_vlarb_high : %s\n",
> +		prefix, opt->vlarb_high ? opt->vlarb_high : dflt->vlarb_high);
> +	fprintf(out, "%s_vlarb_low : %s\n",
> +		prefix, opt->vlarb_low ? opt->vlarb_low : dflt->vlarb_low);
> +	fprintf(out, "%s_sl2vl : %s\n",
> +		prefix, opt->sl2vl ? opt->sl2vl : dflt->sl2vl);
> +}
> +
> +static void dump_conf_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
> +{

Why to not use osm_subn_write_conf_file() function (wrapped by
dump_conf_parse())? I think we need to have config dumping code
consolidated.

Sasha

> +	osm_subn_opt_t * opt = &p_osm->subn.opt;
> +
> +	fprintf(out, "config_file : %s\n", 
> +		opt->config_file ? opt->config_file : NULL_STR);
> +	fprintf(out, "guid : 0x%016" PRIx64 "\n", opt->guid);
> +	fprintf(out, "m_key : 0x%016" PRIx64 "\n", opt->m_key);
> +	fprintf(out, "sm_key : 0x%016" PRIx64 "\n", opt->sm_key);
> +	fprintf(out, "sa_key : 0x%016" PRIx64 "\n", opt->sa_key);
> +	fprintf(out, "subnet_prefix : 0x%016" PRIx64 "\n", opt->subnet_prefix);
> +	fprintf(out, "m_key_lease_period : %u\n", opt->m_key_lease_period);
> +	fprintf(out, "sweep_interval : %u\n", opt->sweep_interval);
> +	fprintf(out, "max_wire_smps : %u\n", opt->max_wire_smps);
> +	fprintf(out, "transaction_timeout : %u\n", opt->transaction_timeout);
> +	fprintf(out, "sm_priority : %u\n", opt->sm_priority);
> +	fprintf(out, "lmc : %u\n", opt->lmc);
> +	fprintf(out, "lmc_esp0 : %s\n", 
> +		BOOLEAN_STR(opt->lmc_esp0));
> +	fprintf(out, "max_op_vls : %u\n", opt->max_op_vls);
> +	fprintf(out, "force_link_speed : %u\n", opt->force_link_speed);
> +	fprintf(out, "reassign_lids : %s\n", 
> +		BOOLEAN_STR(opt->reassign_lids));
> +	fprintf(out, "ignore_other_sm : %s\n", 
> +		BOOLEAN_STR(opt->ignore_other_sm));
> +	fprintf(out, "single_thread : %s\n", 
> +		BOOLEAN_STR(opt->single_thread));
> +	fprintf(out, "disable_multicast : %s\n", 
> +		BOOLEAN_STR(opt->disable_multicast));
> +	fprintf(out, "force_log_flush : %s\n", 
> +		BOOLEAN_STR(opt->force_log_flush));
> +	fprintf(out, "subnet_timeout : %u\n", opt->subnet_timeout);
> +	fprintf(out, "packet_life_time : %u\n", opt->packet_life_time);
> +	fprintf(out, "vl_stall_count : %u\n", opt->vl_stall_count);
> +	fprintf(out, "leaf_vl_stall_count : %u\n", opt->leaf_vl_stall_count);
> +	fprintf(out, "head_of_queue_lifetime : %u\n", opt->head_of_queue_lifetime);
> +	fprintf(out, "leaf_head_of_queue_lifetime : %u\n", opt->leaf_head_of_queue_lifetime);
> +	fprintf(out, "local_phy_errors_threshold : %u\n", opt->local_phy_errors_threshold);
> +	fprintf(out, "overrun_errors_threshold : %u\n", opt->overrun_errors_threshold);
> +	fprintf(out, "sminfo_polling_timeout : %u\n", opt->sminfo_polling_timeout);
> +	fprintf(out, "polling_retry_number : %u\n", opt->polling_retry_number);
> +	fprintf(out, "max_msg_fifo_timeout : %u\n", opt->max_msg_fifo_timeout);
> +	fprintf(out, "force_heavy_sweep : %s\n", 
> +		BOOLEAN_STR(opt->force_heavy_sweep));
> +	fprintf(out, "log_flags : 0x%02x\n", opt->log_flags);
> +	fprintf(out, "dump_files_dir : %s\n", 
> +		opt->dump_files_dir ? opt->dump_files_dir : NULL_STR);
> +	fprintf(out, "log_file : %s\n", 
> +		opt->log_file ? opt->log_file : NULL_STR);
> +	fprintf(out, "log_max_size : %lu\n", opt->log_max_size);
> +	fprintf(out, "partition_config_file : %s\n", 
> +		opt->partition_config_file ? opt->partition_config_file : NULL_STR);
> +	fprintf(out, "no_partition_enforcement : %s\n", 
> +		BOOLEAN_STR(opt->no_partition_enforcement));
> +	fprintf(out, "qos : %s\n", 
> +		BOOLEAN_STR(opt->qos));
> +	fprintf(out, "qos_policy_file : %s\n", 
> +		opt->qos_policy_file ? opt->qos_policy_file : NULL_STR);
> +	fprintf(out, "accum_log_file: %s\n", 
> +		BOOLEAN_STR(opt->accum_log_file));
> +	fprintf(out, "console : %s\n", 
> +		opt->console ? opt->console : NULL_STR);
> +	fprintf(out, "console_port : %u\n", opt->console_port);
> +	fprintf(out, "port_prof_ignore_file : %s\n", 
> +		opt->port_prof_ignore_file ? opt->port_prof_ignore_file : NULL_STR);
> +	fprintf(out, "port_profile_switch_nodes : %s\n", 
> +		BOOLEAN_STR(opt->port_profile_switch_nodes));
> +	fprintf(out, "sweep_on_trap : %s\n", 
> +		BOOLEAN_STR(opt->sweep_on_trap));
> +	fprintf(out, "routing_engine_names : %s\n", 
> +		opt->routing_engine_names ? opt->routing_engine_names : NULL_STR);
> +	fprintf(out, "use_ucast_cache : %s\n", 
> +		BOOLEAN_STR(opt->use_ucast_cache));
> +	fprintf(out, "connect_roots : %s\n", 
> +		BOOLEAN_STR(opt->connect_roots));
> +	fprintf(out, "lid_matrix_dump_file : %s\n", 
> +		opt->lid_matrix_dump_file ? opt->lid_matrix_dump_file : NULL_STR);
> +	fprintf(out, "lfts_file : %s\n", 
> +		opt->lfts_file ? opt->lfts_file : NULL_STR);
> +	fprintf(out, "root_guid_file : %s\n", 
> +		opt->root_guid_file ? opt->root_guid_file : NULL_STR);
> +	fprintf(out, "cn_guid_file : %s\n", 
> +		opt->cn_guid_file ? opt->cn_guid_file : NULL_STR);
> +	fprintf(out, "ids_guid_file : %s\n", 
> +		opt->ids_guid_file ? opt->ids_guid_file : NULL_STR);
> +	fprintf(out, "guid_routing_order_file : %s\n", 
> +		opt->guid_routing_order_file ? opt->guid_routing_order_file : NULL_STR);
> +	fprintf(out, "sa_db_file : %s\n", 
> +		opt->sa_db_file ? opt->sa_db_file : NULL_STR);
> +	fprintf(out, "exit_on_fatal : %s\n", 
> +		BOOLEAN_STR(opt->exit_on_fatal));
> +	fprintf(out, "honor_guid2lid_file : %s\n", 
> +		BOOLEAN_STR(opt->honor_guid2lid_file));
> +	fprintf(out, "daemon : %s\n", 
> +		BOOLEAN_STR(opt->daemon));
> +	fprintf(out, "sm_inactive : %s\n", 
> +		BOOLEAN_STR(opt->sm_inactive));
> +	fprintf(out, "babbling_port_policy : %s\n", 
> +		BOOLEAN_STR(opt->babbling_port_policy));
> +	dump_qos_options(&opt->qos_options, &opt->qos_options, "qos", out);
> +	dump_qos_options(&opt->qos_ca_options, &opt->qos_options, "qos_ca", out);
> +	dump_qos_options(&opt->qos_sw0_options, &opt->qos_options, "qos_sw0", out);
> +	dump_qos_options(&opt->qos_swe_options, &opt->qos_options, "qos_swe", out);
> +	dump_qos_options(&opt->qos_rtr_options, &opt->qos_options, "qos_rtr", out);
> +	fprintf(out, "enable_quirks : %s\n", 
> +		BOOLEAN_STR(opt->enable_quirks));
> +	fprintf(out, "no_clients_rereg : %s\n", 
> +		BOOLEAN_STR(opt->no_clients_rereg));
> +#ifdef ENABLE_OSM_PERF_MGR
> +	fprintf(out, "perfmgr : %s\n", 
> +		BOOLEAN_STR(opt->perfmgr));
> +	fprintf(out, "perfmgr_redir : %s\n", 
> +		BOOLEAN_STR(opt->perfmgr_redir));
> +	fprintf(out, "perfmgr_sweep_time_s : %u\n", opt->perfmgr_sweep_time_s);
> +	fprintf(out, "perfmgr_max_outstanding_queries : %u\n", opt->perfmgr_max_outstanding_queries);
> +	fprintf(out, "event_db_dump_file : %s\n", 
> +		opt->event_db_dump_file ? opt->event_db_dump_file : NULL_STR);
> +#endif
> +	fprintf(out, "event_plugin_name : %s\n", 
> +		opt->event_plugin_name ? opt->event_plugin_name : NULL_STR);
> +	fprintf(out, "node_name_map_name : %s\n", 
> +		opt->node_name_map_name ? opt->node_name_map_name : NULL_STR);
> +	fprintf(out, "prefix_routes_file : %s\n", 
> +		opt->prefix_routes_file ? opt->prefix_routes_file : NULL_STR);
> +	fprintf(out, "consolidate_ipv6_snm_req : %s\n", 
> +		BOOLEAN_STR(opt->consolidate_ipv6_snm_req));
> +}
> +
>  static void quit_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
>  {
>  	osm_console_exit(&p_osm->console, &p_osm->log);
> @@ -1166,6 +1323,7 @@ static const struct command console_cmds[] = {
>  	{"portstatus", &help_portstatus, &portstatus_parse},
>  	{"switchbalance", &help_switchbalance, &switchbalance_parse},
>  	{"lidbalance", &help_lidbalance, &lidbalance_parse},
> +	{"dump_conf", &help_dump_conf, &dump_conf_parse},
>  	{"version", &help_version, &version_parse},
>  #ifdef ENABLE_OSM_PERF_MGR
>  	{"perfmgr", &help_perfmgr, &perfmgr_parse},
> -- 
> 1.5.4.5
> 




More information about the general mailing list