[Spread-cvs] commit: r891 - in trunk: daemon docs

jschultz at spread.org jschultz at spread.org
Tue Feb 28 21:01:57 EST 2017


Author: jschultz
Date: 2017-02-28 21:01:55 -0500 (Tue, 28 Feb 2017)
New Revision: 891

Modified:
   trunk/daemon/config_gram.l
   trunk/daemon/config_parse.y
   trunk/daemon/configuration.c
   trunk/daemon/configuration.h
   trunk/daemon/network.c
   trunk/docs/sample.spread.conf
Log:
Added two new features and parameters to configuration file: ExcludeSegAddrsFromHash, IgnoreMulticastJoinErrors.



Modified: trunk/daemon/config_gram.l
===================================================================
--- trunk/daemon/config_gram.l	2017-03-01 02:00:25 UTC (rev 890)
+++ trunk/daemon/config_gram.l	2017-03-01 02:01:55 UTC (rev 891)
@@ -225,6 +225,8 @@
 LookupTimeout                   { return LOOKUPTIMEOUT; }
 VirtualID                       { return VIRTUALID; }
 WideAreaNetwork                 { return WIDEAREANETWORK; }
+ExcludeSegAddrsFromHash         { return EXCLUDESEGADDRSFROMHASH; }
+IgnoreMulticastJoinErrors       { return IGNOREMULTICASTJOINERRORS; }
 {true}|{yes}                    { yylval.boolean = TRUE;        return SP_BOOL; }
 {false}|{no}                    { yylval.boolean = FALSE;       return SP_BOOL; }
 {on}                            { yylval.number = 1;            return SP_TRIVAL; }

Modified: trunk/daemon/config_parse.y
===================================================================
--- trunk/daemon/config_parse.y	2017-03-01 02:00:25 UTC (rev 890)
+++ trunk/daemon/config_parse.y	2017-03-01 02:01:55 UTC (rev 891)
@@ -263,8 +263,9 @@
 
   c += snprintf(c, SPCLAMP(c, e), "Segment: port = %u;", (unsigned) spu_addr_ip_get_port(&seg->seg_addrs[0]));
 
-  for (i = 0; i < seg->num_seg_addrs; ++i)  
-    c += snprintf(c, SPCLAMP(c, e), " [%s]", SPU_ADDR_NTOP_CANON(&seg->seg_addrs[i]));
+  if (!Conf_get_exclude_seg_addrs_from_hash())
+    for (i = 0; i < seg->num_seg_addrs; ++i)  
+      c += snprintf(c, SPCLAMP(c, e), " [%s]", SPU_ADDR_NTOP_CANON(&seg->seg_addrs[i]));
 
   c += snprintf(c, SPCLAMP(c, e), "\n");
   
@@ -315,6 +316,7 @@
 %token DANGEROUSMONITOR SOCKETPORTREUSE RUNTIMEDIR SPUSER SPGROUP ALLOWEDAUTHMETHODS REQUIREDAUTHMETHODS ACCESSCONTROLPOLICY
 %token MAXSESSIONMESSAGES ACTIVEIPVERSION
 %token WINDOW PERSONALWINDOW ACCELERATEDRING ACCELERATEDWINDOW
+%token EXCLUDESEGADDRSFROMHASH IGNOREMULTICASTJOINERRORS
 %token TOKENTIMEOUT HURRYTIMEOUT ALIVETIMEOUT JOINTIMEOUT REPTIMEOUT SEGTIMEOUT GATHERTIMEOUT FORMTIMEOUT LOOKUPTIMEOUT
 %token SP_BOOL SP_TRIVAL
 %token IMONITOR ICLIENT IDAEMON
@@ -323,6 +325,8 @@
 %%
 Config		:	ConfigStructs
                         {
+                          int i;
+                          
                           if (segments == 0)
                             yyerror("No segments specified!");
 
@@ -338,8 +342,11 @@
 			  Config->num_segments    = segments;
 			  Config->num_total_procs = num_procs;
 
-                          /* add Spread daemon version number and algorithm to hash string and calculate hash */
-                          
+                          /* calculate configuration hash */
+
+                          for (i = 0; i < Config->num_segments; ++i)                          
+                            ConfStringLen += convert_segment_to_string(&ConfStringRep[ConfStringLen], MAX_CONF_STRING - ConfStringLen, &Config->segments[i]);
+                           
                           ConfStringLen    += convert_version_to_string(&ConfStringRep[ConfStringLen], MAX_CONF_STRING - ConfStringLen);
                           Config->hash_code = stdhcode_oaat(ConfStringRep, ConfStringLen + 1);
 
@@ -629,7 +636,14 @@
                             Conf_set_wide_area_network_flag(TRUE);
 			    Conf_set_wide_area_network($3.boolean);
 			}
-                
+		|       EXCLUDESEGADDRSFROMHASH EQUALS SP_BOOL
+			{
+			    Conf_set_exclude_seg_addrs_from_hash($3.boolean);
+			}
+		|       IGNOREMULTICASTJOINERRORS EQUALS SP_BOOL
+			{
+			    Conf_set_ignore_multicast_join_errors($3.boolean);
+			}
 
 SegmentStruct	:	SEGMENT SegmentAddress SegmentAddresses_opt OPENBRACE Segmentparams CLOSEBRACE
 			{
@@ -696,8 +710,6 @@
                                        line_num, yytext, Config->allprocs[i].name, SPU_ADDR_NTOP(&Config->allprocs[i].proc_addr), j, Config->allprocs[j].name);
                           }
 
-                          ConfStringLen += convert_segment_to_string(&ConfStringRep[ConfStringLen], MAX_CONF_STRING - ConfStringLen, &Config->segments[segments]);
-
 			  ++segments;
 			  segment_procs = 0;
                           segment_addrs = 0;

Modified: trunk/daemon/configuration.c
===================================================================
--- trunk/daemon/configuration.c	2017-03-01 02:00:25 UTC (rev 890)
+++ trunk/daemon/configuration.c	2017-03-01 02:01:55 UTC (rev 891)
@@ -121,6 +121,9 @@
 static  bool    WideAreaNetworkFlag = FALSE;
 static  bool    WideAreaNetwork     = FALSE;
 
+static  bool    ExcludeSegAddrsFromHash = FALSE;
+static  bool    IgnoreMulticastJoinErrors = FALSE;
+
 static  bool    Conf_Reload_State = FALSE;
 static  bool    Conf_Reload_Singleton_State = FALSE;
 static  configuration *Config_Previous;
@@ -1163,3 +1166,24 @@
 {
   return WideAreaNetwork;
 }
+
+void Conf_set_exclude_seg_addrs_from_hash(bool exclude)
+{
+  ExcludeSegAddrsFromHash = exclude;
+}
+
+bool Conf_get_exclude_seg_addrs_from_hash(void)
+{
+  return ExcludeSegAddrsFromHash;
+}
+
+void Conf_set_ignore_multicast_join_errors(bool ignore)
+{
+  IgnoreMulticastJoinErrors = ignore;
+}
+
+bool Conf_get_ignore_multicast_join_errors(void)
+{
+  return IgnoreMulticastJoinErrors;
+}
+

Modified: trunk/daemon/configuration.h
===================================================================
--- trunk/daemon/configuration.h	2017-03-01 02:00:25 UTC (rev 890)
+++ trunk/daemon/configuration.h	2017-03-01 02:01:55 UTC (rev 891)
@@ -189,5 +189,9 @@
 bool            Conf_get_wide_area_network_flag(void);
 void            Conf_set_wide_area_network(bool network_is_wan);
 bool            Conf_get_wide_area_network(void);
+void            Conf_set_exclude_seg_addrs_from_hash(bool exclude);
+bool            Conf_get_exclude_seg_addrs_from_hash(void);
+void            Conf_set_ignore_multicast_join_errors(bool ignore);
+bool            Conf_get_ignore_multicast_join_errors(void);
 
 #endif /* INC_CONFIGURATION */

Modified: trunk/daemon/network.c
===================================================================
--- trunk/daemon/network.c	2017-03-01 02:00:25 UTC (rev 890)
+++ trunk/daemon/network.c	2017-03-01 02:01:55 UTC (rev 891)
@@ -204,11 +204,24 @@
     for (i = 0; i < Bcast_addrs_num; ++i)
       if (spu_addr_ip_is_multicast(&Bcast_addrs[i]))
       {
+        int log_lvl = (Conf_get_ignore_multicast_join_errors() ? SPLOG_ERROR : SPLOG_FATAL);
+
         if ((ret = DL_join_multicast_gen(Bcast_channel[Num_bcast_channels], &Bcast_addrs[i], &My.proc_addr)))
-          Alarmp(SPLOG_FATAL, NETWORK, "Net_init: implicit: error joining multicast group %s on channel %d: %d %s\n",
+        {
+          Alarmp(log_lvl, NETWORK, "Net_init: implicit: error joining multicast group %s on channel %d: %d %s; Won't send/recv to/from this segment address!\n",
                  SPU_ADDR_NTOP(&Bcast_addrs[i]), (int) Bcast_channel[Num_bcast_channels], sock_errno, sock_strerror(sock_errno));
 
-        Alarmp(SPLOG_INFO, NETWORK, "Net_init: implicit: joined multicast group %s on channel %d\n", SPU_ADDR_NTOP(&Bcast_addrs[i]), (int) Bcast_channel[Num_bcast_channels]);
+          /* move last bcast address into this spot and loop again */
+          
+          --Bcast_addrs_num;
+          Bcast_addrs[i] = Bcast_addrs[Bcast_addrs_num];
+          --i;  /* NOTE: counteract loop counter increment */
+
+          if (Bcast_needed && Bcast_addrs_num == 0)
+            Alarmp(SPLOG_FATAL, NETWORK, "Net_init: implicit: no configured segment addresses worked in a non-singelton segment.  Need at least one to work!\n");
+        }
+        else
+          Alarmp(SPLOG_INFO, NETWORK, "Net_init: implicit: joined multicast group %s on channel %d\n", SPU_ADDR_NTOP(&Bcast_addrs[i]), (int) Bcast_channel[Num_bcast_channels]);
       }
 
     ++Num_bcast_channels;
@@ -263,11 +276,25 @@
       for (j = 0; j < Bcast_addrs_num; ++j)
         if (spu_addr_ip_is_multicast(&Bcast_addrs[j]))
         {
+          int log_lvl = (Conf_get_ignore_multicast_join_errors() ? SPLOG_ERROR : SPLOG_FATAL);
+          
           if ((ret = DL_join_multicast_gen(Bcast_channel[Num_bcast_channels], &Bcast_addrs[j], &My.proc_addr)))
-            Alarmp(SPLOG_FATAL, NETWORK, "Net_init: explicit: error joining multicast group %s on channel %d: %d %s\n",
+          {
+            Alarmp(log_lvl, NETWORK, "Net_init: explicit: error joining multicast group %s on channel %d: %d %s; Won't send/recv to/from this segment address!\n",
                    SPU_ADDR_NTOP(&Bcast_addrs[j]), (int) Bcast_channel[Num_bcast_channels], sock_errno, sock_strerror(sock_errno));
+
+            /* move last bcast address into this spot and loop again */
           
-          Alarmp(SPLOG_INFO, NETWORK, "Net_init: explicit: joined multicast group %s on channel %d\n", SPU_ADDR_NTOP(&Bcast_addrs[j]), (int) Bcast_channel[Num_bcast_channels]);
+            --Bcast_addrs_num;
+            Bcast_addrs[j] = Bcast_addrs[Bcast_addrs_num];
+            bcast_bound[j] = bcast_bound[Bcast_addrs_num];
+            --j;  /* NOTE: counteract loop counter increment */
+
+            if (Bcast_needed && Bcast_addrs_num == 0)
+              Alarmp(SPLOG_FATAL, NETWORK, "Net_init: explicit: no configured segment addresses worked in a non-singelton segment.  Need at least one to work!\n");
+          }
+          else
+            Alarmp(SPLOG_INFO, NETWORK, "Net_init: explicit: joined multicast group %s on channel %d\n", SPU_ADDR_NTOP(&Bcast_addrs[j]), (int) Bcast_channel[Num_bcast_channels]);
         }
 
       ++Num_bcast_channels;
@@ -292,29 +319,44 @@
 
 #ifndef ARCH_PC_WIN95
     /* NOTE: for backwards compatability with old configurations we don't do this for singleton segments */
+    
     /* TODO: figure out a better way because not setting up this
      * socket here means that if a singleton segment is reconfigured
      * to have multiple daemons then this daemon needs to reboot */
     
-    for (i = 0; Bcast_needed && i < Bcast_addrs_num; ++i)
+    for (i = 0; Bcast_needed && i < Bcast_addrs_num; ++i, ++Num_bcast_channels)
       if (!bcast_bound[i])                 /* didn't already explicity or implicitly bind to Bcast_addrs[i] above */
       {
         if_addr = Bcast_addrs[i];
         
-        Alarmp(SPLOG_INFO, NETWORK, "Net_init: explicit: binding an extra recv bcast channel to [%s]:%u\n", SPU_ADDR_NTOP(&if_addr), (unsigned) spu_addr_ip_get_port(&if_addr));
+        Alarmp(SPLOG_INFO, NETWORK, "Net_init: explicit: extras: binding a recv bcast channel to [%s]:%u\n", SPU_ADDR_NTOP(&if_addr), (unsigned) spu_addr_ip_get_port(&if_addr));
         Bcast_channel[Num_bcast_channels] = DL_init_channel_gen(RECV_CHANNEL | REUSE_ADDR, NULL, &if_addr);
 
-        for (j = 0; j < Bcast_addrs_num; ++j)
-          if (spu_addr_ip_is_multicast(&Bcast_addrs[j]))
+        if (spu_addr_ip_is_multicast(&Bcast_addrs[i]))
+        {
+          int log_lvl = (Conf_get_ignore_multicast_join_errors() ? SPLOG_ERROR : SPLOG_FATAL);
+            
+          if ((ret = DL_join_multicast_gen(Bcast_channel[Num_bcast_channels], &Bcast_addrs[i], &My.proc_addr)))
           {
-            if ((ret = DL_join_multicast_gen(Bcast_channel[Num_bcast_channels], &Bcast_addrs[j], &My.proc_addr)))
-              Alarmp(SPLOG_FATAL, NETWORK, "Net_init: explicit: error joining multicast group %s on channel %d: %d %s\n",
-                     SPU_ADDR_NTOP(&Bcast_addrs[j]), (int) Bcast_channel[Num_bcast_channels], sock_errno, sock_strerror(sock_errno));
+            Alarmp(log_lvl, NETWORK, "Net_init: explicit: extras: error joining multicast group %s on channel %d: %d %s\n",
+                   SPU_ADDR_NTOP(&Bcast_addrs[i]), (int) Bcast_channel[Num_bcast_channels], sock_errno, sock_strerror(sock_errno));
+
+            /* move last bcast address into this spot and loop again */
+          
+            --Bcast_addrs_num;
+            Bcast_addrs[i] = Bcast_addrs[Bcast_addrs_num];
+            bcast_bound[i] = bcast_bound[Bcast_addrs_num];
+            --i;  /* NOTE: counteract loop counter increment */
             
-            Alarmp(SPLOG_INFO, NETWORK, "Net_init: explicit: joined multicast group %s on channel %d\n", SPU_ADDR_NTOP(&Bcast_addrs[j]), (int) Bcast_channel[Num_bcast_channels]);
+            if (Bcast_addrs_num == 0)
+              Alarmp(SPLOG_FATAL, NETWORK, "Net_init: explicit: extras: no configured segment addresses worked in a non-singelton segment.  Need at least one to work!\n");
+
+            DL_close_channel(Bcast_channel[Num_bcast_channels]);            
+            --Num_bcast_channels;  /* NOTE: counteract loop increment */
           }
-      
-        ++Num_bcast_channels;
+          else
+            Alarmp(SPLOG_INFO, NETWORK, "Net_init: explicit: extras: joined multicast group %s on channel %d\n", SPU_ADDR_NTOP(&Bcast_addrs[i]), (int) Bcast_channel[Num_bcast_channels]);
+        }
       }
 #endif    
   }

Modified: trunk/docs/sample.spread.conf
===================================================================
--- trunk/docs/sample.spread.conf	2017-03-01 02:00:25 UTC (rev 890)
+++ trunk/docs/sample.spread.conf	2017-03-01 02:01:55 UTC (rev 891)
@@ -434,4 +434,15 @@
 #SegTimeout = 500
 #GatherTimeout = 1250
 #FormTimeout = 1250
-#LookupTimeout = 30000
\ No newline at end of file
+#LookupTimeout = 30000
+
+# Exclude segment addresses from computation of configuration hashes.
+# Can be useful if different daemons in configuration need to have 
+# different segment addresses.
+#
+#ExcludeSegAddrsFromHash = false
+
+# Ignore multicast join errors for segment addresses.  Can be useful
+# if a configured segment address' interface is down on startup
+#
+#IgnoreMulticastJoinErrors = false




More information about the Spread-cvs mailing list