CVSROOT:        /cvs/cluster
Module name:    conga
Branch:         RHEL5
Changes by:     [EMAIL PROTECTED]       2007-08-27 18:38:00

Modified files:
        .              : conga.spec.in.in 
        luci/cluster   : form-macros validate_config_multicast.js 
        luci/site/luci/Extensions: LuciClusterInfo.py 
                                   cluster_adapters.py 
        luci/site/luci/Extensions/ClusterModel: ModelBuilder.py 
        luci/site/luci/var: Data.fs 

Log message:
        - Fix 253994: Cannot specify multicast address for a cluster
        - Update the luci Zope DB
        - Update the changelog

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.45.2.58&r2=1.45.2.59
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.90.2.30&r2=1.90.2.31
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_multicast.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.1&r2=1.3.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.7&r2=1.1.4.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.120.2.38&r2=1.120.2.39
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.4&r2=1.1.4.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/var/Data.fs.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.15.2.24&r2=1.15.2.25

--- conga/conga.spec.in.in      2007/08/23 04:57:49     1.45.2.58
+++ conga/conga.spec.in.in      2007/08/27 18:36:43     1.45.2.59
@@ -311,9 +311,11 @@
 ###  changelog ###
 %changelog
 * Wed Aug 22 2007 Ryan McCabe <[EMAIL PROTECTED]> 0.10.0-6
-- Fixed bz253783 (ricci is vulnerable to a connect DoS attack)
+- Fixed bz253783
 - Fixed bz253914 (conga doesn't allow you to reuse nfs export and nfs client 
resources)
-- Resolves: bz253783, bz253914
+- Fixed bz254038 (Impossible to set many valid quorum disk configurations via 
conga)
+- Fixed bz253994 (Cannot specify multicast address for a cluster)
+- Resolves: bz253783, bz253914, bz254038, bz253994
 
 * Mon Aug 20 2007 Ryan McCabe <[EMAIL PROTECTED]> 0.10.0-5
 - Fixed bz249291 (delete node task fails to do all items listed in the help 
document)
--- conga/luci/cluster/form-macros      2007/08/09 20:26:11     1.90.2.30
+++ conga/luci/cluster/form-macros      2007/08/27 18:36:45     1.90.2.31
@@ -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'"
 
                                                />
@@ -1115,11 +1115,23 @@
                                                Multicast address
                                        </td>
                                        <td class="systemsTable">
-                                               <input type="text" 
name="mcast_address" id="mcast_address"
+                                               <input type="text"
+                                                       name="mcast_address" 
id="mcast_address"
                                                        tal:attributes="
-                                                               disabled 
python: clusterinfo['is_mcast'] != 'True' and '1' or '0';
-                                                               value python: 
clusterinfo['is_mcast'] == 'True' and clusterinfo['mcast_addr'] or '';"
-                                               />
+                                                               disabled 
not:clusterinfo/mcast_addr;
+                                                               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>
--- conga/luci/cluster/validate_config_multicast.js     2007/08/08 21:18:46     
1.3.2.1
+++ conga/luci/cluster/validate_config_multicast.js     2007/08/27 18:36:45     
1.3.2.2
@@ -8,22 +8,36 @@
 */
 
 var prev_mcast_str = '';
+var prev_mcast_if = '';
 
-function disable_mcast(addrId) {
-       addrObj = document.getElementById(addrId);
-       if (!addrObj || addrObj.disabled)
-               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 || !addrObj.disabled)
-               return;
-       addrObj.disabled = false;
-       addrObj.value = prev_mcast_str;
+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; 
+       }
 }
 
 function validate_form(form) {
@@ -52,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) {
@@ -66,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/08 21:14:38     
1.1.4.7
+++ conga/luci/site/luci/Extensions/LuciClusterInfo.py  2007/08/27 18:36:45     
1.1.4.8
@@ -618,10 +618,12 @@
                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['mcast_addr'] = '1.2.3.4'
                clumap['gulm'] = False
        else:
                #-------------
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2007/08/23 19:09:21     
1.120.2.38
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2007/08/27 18:36:45     
1.120.2.39
@@ -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:
@@ -991,13 +999,14 @@
        else:
                addr_str = None
 
-       if (addr_str is None and mcast_manual is not True) or (mcast_manual is 
True and addr_str == model.getMcastAddr()):
-               errors.append('No multicast configuration changes were made')
-               return (False, {'errors': errors})
-
        try:
-               model.usesMulticast = True
-               model.mcast_address = 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, 
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/07/30 05:06:47     1.1.4.4
+++ conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py        
2007/08/27 18:36:46     1.1.4.5
@@ -121,6 +121,8 @@
     self.filename = filename
     self.lock_type = DLM_TYPE
     self.mcast_address = mcast_addr
+    self.mcast_interface = None
+    self.mcast_ptr = None
     self.cluster_ptr = None
     self.GULM_ptr = None
     self.CMAN_ptr = None
@@ -269,7 +271,10 @@
     if self.usesMulticast is True:
       mcast = Multicast()
       mcast.addAttribute("addr", self.mcast_address)
+      if self.mcast_interface is not None:
+        mcast.addAttribute("interface", self.mcast_interface)
       cman.addChild(mcast)
+      self.mcast_ptr = mcast
 
     fds = FenceDevices()
     obj_tree.addChild(fds)
@@ -513,8 +518,9 @@
     self.clusternodes_ptr.addChild(clusternode)
     if self.usesMulticast is True:
       mcast = Multicast()
-      mcast.addAttribute("addr", self.mcast_address)
-      mcast.addAttribute("interface", "eth0")  #eth0 is the default
+      mcast.addAttribute('addr', self.mcast_address)
+      if self.mcast_interface is not None:
+        mcast.addAttribute('interface', self.mcast_interface)
       clusternode.addChild(mcast)
     self.isModified = True
 
@@ -676,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
 
@@ -871,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
@@ -914,61 +928,84 @@
       #set modified
       self.isModified = True
 
-  def swap_multicast_state(self, address=None):
-    if self.usesMulticast is True:
-      #First, eliminate <multicast> tag
-      if self.CMAN_ptr is not None:
-        children = self.CMAN_ptr.getChildren()
-        if len(children) > 0:
-          for child in children:
-            if child.getTagName() == MCAST_STR:
-              self.CMAN_ptr.removeChild(child)
-              break
-      found_one = True
-      while found_one is True:
-        found_one = False
-        nodes = self.clusternodes_ptr.getChildren()
-        for node in nodes:
-          node_children = node.getChildren()
-          for node_child in node_children:
-            if node_child.getTagName() == MCAST_STR:
-              node.removeChild(node_child)
-              found_one = True
-              break
-          if found_one is True:
-            break
+  def set_nodes_multicast(self, mcast_addr, mcast_if=None):
+    for node in self.getNodes():
+      new_mcast_tag = True
+      mcast = None
+
+      for node_child in node.getChildren():
+        if node_child.getTagName() == MCAST_STR:
+          mcast = node_child
+          new_mcast_tag = False
+          break
 
-      self.usesMulticast = False
-      self.mcast_address = None
-      self.isModified = True
+      if mcast is None:
+        mcast = Multicast()
+
+      mcast.addAttribute('addr', mcast_addr)
+      if mcast_if:
+        mcast.addAttribute('interface', mcast_if)
+      else:
+        try:
+          mcast.removeAttribute('interface')
+        except:
+          pass
 
+      if new_mcast_tag is True:
+        node.addChild(mcast)
+
+  def set_cluster_multicast(self, mcast_addr, mcast_if=None):
+    if not self.CMAN_ptr:
+      return False
 
+    if self.mcast_ptr is None:
+      mcast = Multicast()
+      self.CMAN_ptr.addChild(mcast)
+      self.mcast_ptr = mcast
     else:
-      if self.CMAN_ptr is not None:
-        mcast = Multicast()
-        mcast.addAttribute("addr", address)
-        self.CMAN_ptr.addChild(mcast)
+      mcast = self.mcast_ptr
 
-      has_one = False
-      nodes = self.getNodes()
-      for node in nodes:
-        has_one = False
-        node_children = node.getChildren()
-        for node_child in node_children:
-          if node_child.getTagName() == MCAST_STR:
-            has_one = True
-            break
-        if has_one is False:
-          mcast = Multicast()
-          mcast.addAttribute("addr", address)
-          mcast.addAttribute("interface", "eth0")
-          node.addChild(mcast)
+    mcast.addAttribute('addr', mcast_addr)
+    if mcast_if is not None:
+      mcast.addAttribute('interface', mcast_if)
+    else:
+      try:
+        mcast.removeAttribute('interface')
+      except:
+        pass
+    self.mcast_address = mcast_addr 
+    self.mcast_interface = mcast_if
+    self.usesMulticast = True
+    self.set_nodes_multicast(mcast_addr, mcast_if=mcast_if)
+    self.isModified = True
 
-      self.mcast_address = address
-      self.usesMulticast = True
-      self.isModified = True
+  def del_nodes_multicast(self):
+    for node in self.getNodes():
+      for node_child in node.getChildren():
+        if node_child.getTagName() == MCAST_STR:
+          node.removeChild(node_child)
+          break
+
+  def del_cluster_multicast(self):
+    if self.CMAN_ptr is None:
+      return False
 
+    for child in self.CMAN_ptr.getChildren():
+      if child.getTagName() == MCAST_STR:
+        self.CMAN_ptr.removeChild(child)
+
+    self.mcast_ptr = None
+    self.usesMulticast = False
+    self.mcast_address = None
+    self.mcast_interface = None
+    self.del_nodes_multicast()
+    self.isModified = True
 
+  def swap_multicast_state(self, address=None, mcast_if=None):
+    if self.usesMulticast is True:
+      self.del_cluster_multicast()
+    else:
+      self.set_cluster_multicast(address, mcast_if)
 
   def check_fence_daemon(self):
     if self.GULM_ptr is None and self.fence_daemon_ptr is None:
Binary files /cvs/cluster/conga/luci/site/luci/var/Data.fs      2007/08/23 
04:57:49     1.15.2.24 and /cvs/cluster/conga/luci/site/luci/var/Data.fs     
2007/08/27 18:36:46     1.15.2.25 differ
rcsdiff: /cvs/cluster/conga/luci/site/luci/var/Data.fs: diff failed

Reply via email to