CVSROOT:        /cvs/cluster
Module name:    conga
Branch:         RHEL4
Changes by:     [EMAIL PROTECTED]       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

--- conga/luci/cluster/form-macros      2007/08/24 18:40:28     1.176.2.20
+++ conga/luci/cluster/form-macros      2007/08/24 21:55:42     1.176.2.21
@@ -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>
 
--- conga/luci/cluster/validate_config_multicast.js     2007/08/24 18:40:28     
1.3.4.2
+++ conga/luci/cluster/validate_config_multicast.js     2007/08/24 21:55:42     
1.3.4.3
@@ -8,24 +8,36 @@
 */
 
 var prev_mcast_str = '';
+var prev_mcast_if = '';
 
-function disable_mcast(addrId) {
-       addrObj = document.getElementById(addrId);
-       if (!addrObj) {
-               return;
-       }
-       addrObj.disabled = true;
-       prev_mcast_str = addrObj.value;
-       addrObj.value = '';
+function disable_mcast(addrId, ifId) {
+       var addrObj = document.getElementById(addrId);
+       if (addrObj) {
+               prev_mcast_str = addrObj.value;
+               addrObj.disabled = true;
+               addrObj.value = '';
+       }
+
+       var ifObj = document.getElementById(ifId);
+       if (ifObj) {
+               prev_mcast_if = ifObj.value;
+               ifObj.disabled = true;
+               ifObj.value = '';
+       }
 }
 
-function enable_mcast(addrId) {
-       addrObj = document.getElementById(addrId);
-       if (!addrObj) {
-               return;
+function enable_mcast(addrId, ifId) {
+       var addrObj = document.getElementById(addrId);
+       if (addrObj) {
+               addrObj.disabled = false;
+               addrObj.value = prev_mcast_str;
+       }
+
+       var ifObj = document.getElementById(ifId);
+       if (ifObj) {
+               ifObj.disabled = false;
+               ifObj.value = prev_mcast_if; 
        }
-       addrObj.disabled = false;
-       addrObj.value = prev_mcast_str;
 }
 
 function validate_form(form) {
@@ -54,6 +66,7 @@
                clr_form_err(form.mcast[0]);
                clr_form_err(form.mcast[1]);
                clr_form_err(form.mcast_address);
+               clr_form_err(form.mcast_interface);
        }
 
        if (mcast == 1) {
@@ -68,6 +81,15 @@
                        }
                        clr_form_err(form.mcast_address);
                }
+
+               if (form.cluster_version && form.cluster_version.value == 
'rhel4') {
+                       if (!form.mcast_interface || 
str_is_blank(form.mcast_interface.value)) {
+                               set_form_err(form.mcast_interface);
+                               errors.push('No multicast interface was 
given.');
+                       } else {
+                               clr_form_err(form.mcast_interface);
+                       }
+               }
        }
 
        if (error_dialog(errors))
--- conga/luci/site/luci/Extensions/LuciClusterInfo.py  2007/08/24 18:40:29     
1.10.2.2
+++ conga/luci/site/luci/Extensions/LuciClusterInfo.py  2007/08/24 21:55:42     
1.10.2.3
@@ -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:
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2007/08/24 18:40:29     
1.227.2.23
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2007/08/24 21:55:42     
1.227.2.24
@@ -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' 
\
--- conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py        
2007/08/24 18:40:29     1.5.2.2
+++ conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py        
2007/08/24 21:55:43     1.5.2.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

Reply via email to