All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci cluster/form-macros cluster/validat ...
Date: 24 Aug 2007 18:42:07 -0000	[thread overview]
Message-ID: <20070824184207.11002.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-08-24 18:42:07

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:
	Fix the issue described in bz253994: Cannot specify multicast address for a cluster

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.208&r2=1.209
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_multicast.js.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.267&r2=1.268
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&r1=1.5&r2=1.6

--- conga/luci/cluster/form-macros	2007/08/09 21:05:28	1.208
+++ conga/luci/cluster/form-macros	2007/08/24 18:42:06	1.209
@@ -1115,11 +1115,11 @@
 						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>
 			</tbody>
--- conga/luci/cluster/validate_config_multicast.js	2007/08/08 21:00:06	1.4
+++ conga/luci/cluster/validate_config_multicast.js	2007/08/24 18:42:06	1.5
@@ -11,8 +11,9 @@
 
 function disable_mcast(addrId) {
 	addrObj = document.getElementById(addrId);
-	if (!addrObj || addrObj.disabled)
+	if (!addrObj) {
 		return;
+	}
 	addrObj.disabled = true;
 	prev_mcast_str = addrObj.value;
 	addrObj.value = '';
@@ -20,8 +21,9 @@
 
 function enable_mcast(addrId) {
 	addrObj = document.getElementById(addrId);
-	if (!addrObj || !addrObj.disabled)
+	if (!addrObj) {
 		return;
+	}
 	addrObj.disabled = false;
 	addrObj.value = prev_mcast_str;
 }
--- conga/luci/site/luci/Extensions/LuciClusterInfo.py	2007/08/08 21:00:07	1.10
+++ conga/luci/site/luci/Extensions/LuciClusterInfo.py	2007/08/24 18:42:06	1.11
@@ -620,8 +620,8 @@
 			clumap['mcast_addr'] = model.getMcastAddr()
 			clumap['is_mcast'] = 'True'
 		else:
+			clumap['mcast_addr'] = 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/09 04:37:20	1.267
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/08/24 18:42:06	1.268
@@ -991,13 +991,21 @@
 	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()):
+	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:
-		model.usesMulticast = True
-		model.mcast_address = addr_str
+		if model.getMcastAddr() is not None and not addr_str:
+			model.del_cluster_multicast()
+		else:
+			model.set_cluster_multicast(addr_str)
 	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/27 17:02:35	1.5
+++ conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py	2007/08/24 18:42:06	1.6
@@ -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
 
@@ -914,61 +920,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 iter(self.getNodes()):
+      new_mcast_tag = True
+      mcast = None
+
+      for node_child in iter(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 iter(self.getNodes()):
+      for node_child in iter(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 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
+    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:



             reply	other threads:[~2007-08-24 18:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-24 18:42 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-08-24 22:01 [Cluster-devel] conga/luci cluster/form-macros cluster/validat rmccabe
2007-08-24 21:55 rmccabe
2007-08-24 18:40 rmccabe
2007-08-09  4:37 rmccabe
2007-08-09  4:34 rmccabe
2007-02-24  7:02 rmccabe
2007-02-16  5:29 rmccabe
2007-02-16  5:26 rmccabe
2007-02-12 23:28 rmccabe
2007-02-12 23:26 rmccabe
2007-02-09 18:32 rmccabe
2007-02-09 18:30 rmccabe
2007-02-08  3:43 rmccabe
2007-02-08  2:34 rmccabe
2007-02-01 23:48 rmccabe
2007-01-25 19:55 rmccabe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070824184207.11002.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.