[Cluster-devel] conga/luci cluster/form-macros cluster/validat ...
rmccabe at sourceware.org
rmccabe at sourceware.org
Fri Aug 24 18:40:30 UTC 2007
CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL4
Changes by: rmccabe at sourceware.org 2007-08-24 18:40:29
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&only_with_tag=RHEL4&r1=1.176.2.19&r2=1.176.2.20
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.1&r2=1.3.4.2
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.1&r2=1.10.2.2
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.22&r2=1.227.2.23
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.1&r2=1.5.2.2
--- conga/luci/cluster/form-macros 2007/08/23 18:47:34 1.176.2.19
+++ conga/luci/cluster/form-macros 2007/08/24 18:40:28 1.176.2.20
@@ -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/09 21:28:50 1.3.4.1
+++ conga/luci/cluster/validate_config_multicast.js 2007/08/24 18:40:28 1.3.4.2
@@ -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/09 21:35:20 1.10.2.1
+++ conga/luci/site/luci/Extensions/LuciClusterInfo.py 2007/08/24 18:40:29 1.10.2.2
@@ -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/23 19:00:30 1.227.2.22
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2007/08/24 18:40:29 1.227.2.23
@@ -1000,13 +1000,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/08/09 21:32:34 1.5.2.1
+++ conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py 2007/08/24 18:40:29 1.5.2.2
@@ -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:
More information about the Cluster-devel
mailing list