On 3/2/2012 10:31 AM, Doug Ledford wrote:
> On 3/2/2012 5:30 AM, Alex Netes wrote:
>> What the default opensm.conf would be used for? Just as a reference to the
>> default values?
> 
> No, he's referring to having a default config file that is parsed, then
> an override config file that is parsed where you only put options you
> want to update in the override config file.  That way you could have,
> for instance, a default opensm.conf in the normal location and totally
> unedited so that it gets updated with each update of the opensm rpm,
> then you could create an opensm.conf.1 that is empty except for just a
> guid setting, a subnet_prefix setting, maybe a cache dir setting, etc.
> In that way, if say the default routing engine gets a new option in the
> future, your override config file won't already be populated with the
> old stuff.  It's a means of inheritance that is functionally identical
> to specifying all this stuff on the command line, but doesn't require a
> huge command line or a complex init script.

And for what it's worth, it could be as simply done as the attached
(untested, but compiled) patch.

-- 
Doug Ledford <dledf...@redhat.com>
              GPG KeyID: 0E572FDD
              http://people.redhat.com/dledford

Infiniband specific RPMs available at
              http://people.redhat.com/dledford/Infiniband
diff -up opensm-3.3.13/opensm/main.c.config opensm-3.3.13/opensm/main.c
--- opensm-3.3.13/opensm/main.c.config  2012-03-02 10:35:26.783996345 -0500
+++ opensm-3.3.13/opensm/main.c 2012-03-02 10:46:33.471939369 -0500
@@ -131,6 +131,13 @@ static void show_usage(void)
               "          The name of the OpenSM config file. When not 
specified\n"
               "          " OSM_DEFAULT_CONFIG_FILE
               " will be used (if exists).\n\n");
+       printf("--extra-config, -E <file-name>\n"
+              "          The name of an OpenSM config file used to over ride\n"
+              "          the entries in the primary config file.  This is\n"
+              "          useful when you have more than one opensm instance\n"
+              "          to manage and you want them all to have a central,\n"
+              "          shared set of options and you want a second, 
smaller\n"
+              "          config file to hold their fabric specific 
options.\n\n");
        printf("--create-config, -c <file-name>\n"
               "          OpenSM will dump its configuration to the specified 
file and exit.\n"
               "          This is a way to generate OpenSM configuration file 
template.\n\n");
@@ -569,10 +576,10 @@ int main(int argc, char *argv[])
        boolean_t run_once_flag = FALSE;
        int32_t vendor_debug = 0;
        int next_option;
-       char *conf_template = NULL, *config_file = NULL;
+       char *conf_template, *config_file, *extra_config_file;
        uint32_t val;
        const char *const short_option =
-           
"F:c:i:w:O:f:ed:D:g:l:L:s:t:a:u:m:X:R:zM:U:S:P:Y:ANBIQvVhoryxp:n:q:k:C:G:H:";
+           
"F:E:c:i:w:O:f:ed:D:g:l:L:s:t:a:u:m:X:R:zM:U:S:P:Y:ANBIQvVhoryxp:n:q:k:C:G:H:";
 
        /*
           In the array below, the 2nd parameter specifies the number
@@ -584,6 +591,7 @@ int main(int argc, char *argv[])
        const struct option long_option[] = {
                {"version", 0, NULL, 12},
                {"config", 1, NULL, 'F'},
+               {"extra-config", 1, NULL, 'E'},
                {"create-config", 1, NULL, 'c'},
                {"debug", 1, NULL, 'd'},
                {"guid", 1, NULL, 'g'},
@@ -647,6 +655,7 @@ int main(int argc, char *argv[])
                {"torus_config", 1, NULL, 10},
                {NULL, 0, NULL, 0}      /* Required at the end of the array */
        };
+       conf_template = config_file = extra_config_file = NULL;
 
        /* force stdout to be line-buffered */
        setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
@@ -672,6 +681,11 @@ int main(int argc, char *argv[])
                        config_file = optarg;
                        printf("Config file is `%s`:\n", config_file);
                        break;
+               case 'E':
+                       extra_config_file = optarg;
+                       printf("Extra Config file is `%s`:\n",
+                              extra_config_file);
+                       break;
                default:
                        break;
                }
@@ -687,6 +701,11 @@ int main(int argc, char *argv[])
        if (osm_subn_parse_conf_file(config_file, &opt) < 0)
                printf("\nFail to parse config file \'%s\'\n", config_file);
 
+       if (extra_config_file)
+               if (osm_subn_parse_conf_file(extra_config_file, &opt) < 0)
+                       printf("\nFailed to parse extra config file `%s`\n",
+                              extra_config_file);
+
        printf("Command Line Arguments:\n");
        do {
                next_option = getopt_long_only(argc, argv, short_option,

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to