Skip to contentSkip to conversation

conga/luci cluster/form-macros cluster/validat ...

Cluster-devel [email protected] 1 participant 1 message Aug 24, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL4
Changes by: rmccabe at sourceware.org 2007-08-24 21:55:44

Modified files:
luci/cluster : form-macros validate_config_multicast.js
luci/site/luci/Extensions: LuciClusterInfo.py
cluster_adapters.py
luci/site/luci/Extensions/ClusterModel: ModelBuilder.py

Log message:
When using multicast on a rhel4 cluster, a network interface must be specified.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.176.2.20&r2=1.176.2.21
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_multicast.js.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.4.2&r2=1.3.4.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.10.2.2&r2=1.10.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.227.2.23&r2=1.227.2.24
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.2.2&r2=1.5.2.3

luci/cluster/form-macros +20 -8
@@ -1082,7 +1082,7 @@
 				<tr class="systemsTable">
 					<td class="systemsTable">
 						<input type="radio" name="mcast" value="False"
-							onClick="disable_mcast('mcast_address');"
+							onClick="disable_mcast('mcast_address', 'mcast_interface');"
 							tal:attributes="checked python: clusterinfo['is_mcast'] != 'True'"
 						/>
 						<tal:block tal:condition="python:os_version == 'rhel4'">
@@ -1097,7 +1097,7 @@
 				<tr class="systemsTable">
 					<td class="systemsTable">
 						<input type="radio" name="mcast" value="True"
-							onClick="enable_mcast('mcast_address');"
+							onClick="enable_mcast('mcast_address', 'mcast_interface');"
 							tal:attributes="checked python: clusterinfo['is_mcast'] == 'True'"
 
 						/>
@@ -1122,6 +1122,18 @@
 								value clusterinfo/mcast_addr |nothing" />
 					</td>
 				</tr>
+				<tr class="systemsTable">
+					<td class="systemsTable">
+						Multicast network interface <span tal:condition="python:os_version != 'rhel4'">(optional)</span>
+					</td>
+					<td class="systemsTable">
+						<input type="text"
+							name="mcast_interface" id="mcast_interface"
+							tal:attributes="
+								disabled not:clusterinfo/mcast_addr;
+								value clusterinfo/mcast_interface |nothing" />
+					</td>
+				</tr>
 			</tbody>
 
 			<tfoot class="systemsTable">
@@ -1194,18 +1206,18 @@
 			</tr>
 
 			<tr class="systemsTable">
-				<td class="systemsTable">TKO</td>
+				<td class="systemsTable">Votes</td>
 				<td class="systemsTable">
-					<input type="text" name="tko"
-						tal:attributes="value clusterinfo/tko | nothing" />
+					<input type="text" name="votes"
+						tal:attributes="value clusterinfo/votes | nothing" />
 				</td>
 			</tr>
 
 			<tr class="systemsTable">
-				<td class="systemsTable">Votes</td>
+				<td class="systemsTable">TKO</td>
 				<td class="systemsTable">
-					<input type="text" name="votes"
-						tal:attributes="value clusterinfo/votes | nothing" />
+					<input type="text" name="tko"
+						tal:attributes="value clusterinfo/tko | nothing" />
 				</td>
 			</tr>
 
luci/cluster/validate_config_multicast.js +36 -14

72 lines not on this page · raw message

luci/site/luci/Extensions/LuciClusterInfo.py +2 -0
@@ -618,9 +618,11 @@
 		is_mcast = model.isMulticast()
 		if is_mcast:
 			clumap['mcast_addr'] = model.getMcastAddr()
+			clumap['mcast_interface'] = model.getMcastInterface()
 			clumap['is_mcast'] = 'True'
 		else:
 			clumap['mcast_addr'] = None
+			clumap['mcast_interface'] = None
 			clumap['is_mcast'] = 'False'
 		clumap['gulm'] = False
 	else:
luci/site/luci/Extensions/cluster_adapters.py +13 -12
@@ -983,6 +983,14 @@
 		errors.append('An invalid multicast selection was made')
 		return (False, {'errors': errors})
 
+	mcast_interface = None
+	if form.has_key('mcast_interface'):
+		mcast_interface = form['mcast_interface'].strip()
+
+	if mcast_manual is True and form.has_key('cluster_version') and form['cluster_version'].strip() == 'rhel4' and not mcast_interface:
+		errors.append('No multicast interface was specified')
+		return (False, {'errors': errors})
+
 	if mcast_manual is True:
 		import socket
 		try:
@@ -1001,20 +1009,13 @@
 		addr_str = None
 
 	try:
-		old_mcast_addr = model.getMcastAddr()
-	except Exception, e:
-		luci_log.debug_verbose('VMCC0: %r %s' % (e, str(e)))
-		old_mcast_addr = None
-
-	if (addr_str is None and mcast_manual is not True and not old_mcast_addr) or (mcast_manual is True and addr_str == old_mcast_addr):
-		errors.append('No multicast configuration changes were made')
-		return (False, {'errors': errors})
-
-	try:
-		if model.getMcastAddr() is not None and not addr_str:
+		if not addr_str:
+			if mcast_interface:
+				errors.append('A multicast interface was specified, but no multicast address was given')
+				return (False, {'errors': errors})
 			model.del_cluster_multicast()
 		else:
-			model.set_cluster_multicast(addr_str)
+			model.set_cluster_multicast(addr_str, mcast_if=mcast_interface)
 	except Exception, e:
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug('Error updating mcast properties: %r %s' \
luci/site/luci/Extensions/ClusterModel/ModelBuilder.py +11 -3
@@ -682,17 +682,23 @@
       children = self.CMAN_ptr.getChildren()
       for child in children:
         if child.getTagName() == MCAST_STR:
+          self.mcast_ptr = child
           addr = child.getAttribute("addr")
           if addr is not None:
             self.mcast_address = addr
-            return
           else:  #What a mess! a multicast tag, but no addr attribute
             self.mcast_address = ""
-            return
+          mcastif = child.getAttribute("interface")
+          if mcastif is not None:
+            self.mcast_interface = mcastif
+          return
 
   def getMcastAddr(self):
     return self.mcast_address
 
+  def getMcastInterface(self):
+    return self.mcast_interface
+
   def isQuorumd(self):
     return self.usesQuorumd
 
@@ -877,6 +883,8 @@
 
       self.usesMulticast = None
       self.mcast_address = None
+      self.mcast_interface = None
+      self.mcast_ptr = None
 
       #reset self.lock_type
       self.lock_type = GULM_TYPE
@@ -985,7 +993,7 @@
     for child in iter(self.CMAN_ptr.getChildren()):
       if child.getTagName() == MCAST_STR:
         self.CMAN_ptr.removeChild(child)
-        break
+
     self.mcast_ptr = None
     self.usesMulticast = False
     self.mcast_address = None