[openib-general] Re: [PATCH] OpenSM - honor guid2lid when coming out of standby
Hal Rosenstock
halr at voltaire.com
Mon Mar 13 09:46:07 PST 2006
Hi Yael,
On Sun, 2006-03-12 at 07:45, Yael Kalka wrote:
> Hi Hal,
>
> The following patch adds an option to the opensm that forces it to
> honor the guid2lid file given when it comes out of Standby state.
> Currently, when opensm comes out of Standby state it ignores the
> guid2lid file it read, and honors only the lids defined on the ports
> themselves.
> This patch enables to run opensm with --honor_guid2lid flag, and that
> forces the opensm to re-read the guid2lid file when it comes out of
> Standby, and if this file is legal - honor it.
Just one question on this below:
> Thanks,
> Yael
>
> Signed-off-by: Yael Kalka <yael at mellanox.co.il>
>
> Index: include/opensm/osm_subnet.h
> ===================================================================
> --- include/opensm/osm_subnet.h (revision 5751)
> +++ include/opensm/osm_subnet.h (working copy)
> @@ -239,6 +239,7 @@ typedef struct _osm_subn_opt
> boolean_t updn_activate;
> char * updn_guid_file;
> boolean_t exit_on_fatal;
> + boolean_t honor_guid2lid_file;
> } osm_subn_opt_t;
> /*
> * FIELDS
> @@ -383,6 +384,11 @@ typedef struct _osm_subn_opt
> * a. SM recognizes 2 different nodes with the same guid, or 12x link with
> * lane reversal badly configured.
> *
> +* honor_guid2lid_file
> +* Always honor the guid2lid file if it exists and is valid. This means that
> +* the file will be honored when SM is coming out of STANDBY.
> +* By default this is FALSE.
> +*
> * SEE ALSO
> * Subnet object
> *********/
> Index: opensm/osm_subnet.c
> ===================================================================
> --- opensm/osm_subnet.c (revision 5751)
> +++ opensm/osm_subnet.c (working copy)
> @@ -437,6 +437,8 @@ osm_subn_set_default_opt(
> p_opt->polling_retry_number = 4;
> p_opt->force_heavy_sweep = FALSE;
> p_opt->log_flags = 0;
> + p_opt->honor_guid2lid_file = FALSE;
Shouldn't the default be to honor the guid2lid file so perhaps this
option should be reverse named ?
-- Hal
> +
> p_opt->dump_files_dir = getenv("OSM_TMP_DIR");
> if (!p_opt->dump_files_dir)
> p_opt->dump_files_dir = OSM_DEFAULT_TMP_DIR;
> @@ -786,6 +788,11 @@ osm_subn_parse_conf_file(
> __osm_subn_opts_unpack_boolean(
> "exit_on_fatal",
> p_key, p_val, &p_opts->exit_on_fatal);
> +
> + __osm_subn_opts_unpack_boolean(
> + "honor_guid2lid_file",
> + p_key, p_val, &p_opts->honor_guid2lid_file);
> +
> }
> }
> fclose(opts_file);
> @@ -909,11 +916,15 @@ osm_subn_write_conf_file(
> "# Timeout in [sec] between two polls of active master SM\n"
> "sminfo_polling_timeout %u\n\n"
> "# Number of failing polls of remote SM that declares it dead\n"
> - "polling_retry_number %u\n\n",
> + "polling_retry_number %u\n"
> + "# If true honor the guid2lid file when coming out of standby\n"
> + "# state, if such file exists and is valid\n"
> + "honor_guid2lid_file %s\n\n",
> p_opts->sm_priority,
> p_opts->ignore_other_sm ? "TRUE" : "FALSE",
> p_opts->sminfo_polling_timeout,
> - p_opts->polling_retry_number
> + p_opts->polling_retry_number,
> + p_opts->honor_guid2lid_file ? "TRUE" : "FALSE"
> );
>
> fprintf(
> Index: opensm/main.c
> ===================================================================
> --- opensm/main.c (revision 5751)
> +++ opensm/main.c (working copy)
> @@ -214,6 +214,12 @@ show_usage(void)
> " This option provides the means to define a set of ports\n"
> " (by guids) that will be ignored by the link load\n"
> " equalization algorithm.\n\n" );
> + printf( "-x\n"
> + "--honor_guid2lid\n"
> + " This option forces OpenSM to honor the guid2lid file,\n"
> + " when it comes out of Standby state, if such file exists\n"
> + " under OSM_CACHE_DIR, and is valid.\n"
> + " By default this is FALSE.\n" );
> printf( "-f\n"
> "--log_file\n"
> " This option defines the log to be the given file.\n"
> @@ -515,7 +521,7 @@ main(
> boolean_t cache_options = FALSE;
> char *ignore_guids_file_name = NULL;
> uint32_t val;
> - const char * const short_option = "i:f:ed:g:l:s:t:a:P:uvVhorcy";
> + const char * const short_option = "i:f:ed:g:l:s:t:a:P:uvVhorcyx";
>
> /*
> In the array below, the 2nd parameter specified the number
> @@ -549,6 +555,7 @@ main(
> { "add_guid_file", 1, NULL, 'a'},
> { "cache-options", 0, NULL, 'c'},
> { "stay_on_fatal", 0, NULL, 'y'},
> + { "honor_guid2lid", 0, NULL, 'x'},
> { NULL, 0, NULL, 0 } /* Required at the end of the array */
> };
>
> @@ -778,6 +785,11 @@ main(
> printf (" Caching command line options\n");
> break;
>
> + case 'x':
> + opt.honor_guid2lid_file = TRUE;
> + printf (" Honor guid2lid file, if possible\n");
> + break;
> +
> case 'h':
> case '?':
> case ':':
> Index: opensm/osm_lid_mgr.c
> ===================================================================
> --- opensm/osm_lid_mgr.c (revision 5751)
> +++ opensm/osm_lid_mgr.c (working copy)
> @@ -359,13 +359,32 @@ __osm_lid_mgr_init_sweep(
> lmc_mask = 0xffff;
>
> /* if we came out of standby we need to discard any previous guid2lid
> - info we might have */
> + info we might have.
> + Do this only if the honor_guid2lid_file option is FALSE. If not - then
> + need to honor this file. */
> if ( p_mgr->p_subn->coming_out_of_standby == TRUE )
> {
> + if ( p_mgr->p_subn->opt.honor_guid2lid_file == FALSE )
> + {
> + osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
> + "__osm_lid_mgr_init_sweep: "
> + "Ignore guid2lid file when coming out of standby\n");
> osm_db_clear( p_mgr->p_g2l );
> for (lid = 0; lid < cl_ptr_vector_get_size(&p_mgr->used_lids); lid++)
> cl_ptr_vector_set(p_persistent_vec, lid, NULL);
> }
> + else
> + {
> + osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
> + "__osm_lid_mgr_init_sweep: "
> + "Honor current guid2lid file when coming out of standby\n");
> + osm_db_clear( p_mgr->p_g2l );
> + if (osm_db_restore(p_mgr->p_g2l))
> + osm_log( p_mgr->p_log, OSM_LOG_ERROR,
> + "osm_lid_mgr_init_sweep: ERR 0306: "
> + "Error restore Guid-to-Lid persistant database. Ignoring it.\n");
> + }
> + }
>
> /* we need to cleanup the empty ranges list */
> p_item = cl_qlist_remove_head( &p_mgr->free_ranges );
>
More information about the general
mailing list