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
Changes by: rmccabe at sourceware.org 2007-08-24 22:01:45

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

Log message:
qdisk and multicast configuration fixes from the RHEL4 branch

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.209&r2=1.210
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_multicast.js.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_qdisk.js.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.268&r2=1.269
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&r1=1.6&r2=1.7

luci/cluster/form-macros +14 -2
@@ -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">
luci/cluster/validate_config_multicast.js +36 -14

72 lines not on this page · raw message

luci/cluster/validate_config_qdisk.js +24 -18

62 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 +19 -18
@@ -974,6 +974,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:
@@ -992,20 +1000,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' \
@@ -1108,7 +1109,7 @@
 	for i in xrange(num_heuristics):
 		try:
 			h = form['heuristic%d' % i]
-			if not h or len(h) != 3:
+			if not h or len(h) != 3 or not (h[0].strip() and h[1].strip() and h[2].strip()):
 				continue
 		except:
 			continue
@@ -1118,26 +1119,26 @@
 			if not hprog:
 				raise Exception, 'no hprog'
 		except Exception, e:
-			errors.append('No program was given for heuristic %d' % i + 1)
+			errors.append('No program was given for heuristic %d' % (i + 1))
 		try:
 			hint = int(h[1])
 			if hint < 1:
 				raise ValueError, 'Heuristic interval values must be greater than 0'
 		except KeyError, e:
-			errors.append('No interval was given for heuristic %d' % i + 1)
+			errors.append('No interval was given for heuristic %d' % (i + 1))
 		except ValueError, e:
 			errors.append('An invalid interval was given for heuristic %d: %s' \
-				% (i + 1, str(e)))
+				% ((i + 1), str(e)))
 
 		try:
 			hscore = int(h[2])
 			if hscore < 1:
 				raise ValueError, 'Heuristic scores must be greater than 0'
 		except KeyError, e:
-			errors.append('No score was given for heuristic %d' % i + 1)
+			errors.append('No score was given for heuristic %d' % (i + 1))
 		except ValueError, e:
 			errors.append('An invalid score was given for heuristic %d: %s' \
-				% (i + 1, str(e)))
+				% ((i + 1), str(e)))
 
 		heuristics.append([ hprog, hint, hscore ])
 
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