Skip to contentSkip to conversation

conga luci/cluster/fence_device.js luci/cluste ...

Cluster-devel [email protected] 1 participant 1 message Aug 8, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-08-08 21:00:08

Modified files:
luci/cluster : fence_device.js form-chooser form-macros
resource_form_handlers.js validate_config_fence.js validate_config_general.js validate_config_gulm.js validate_config_multicast.js validate_config_qdisk.js validate_create_gulm.js validate_fdom.js validate_fence.js validate_sys_svc.js
luci/plone-custom: conga_ajax.js luci/site/luci/Extensions: HelperFunctions.py LuciClusterInfo.py
LuciZope.py LuciZopeExternal.py RicciQueries.py cluster_adapters.py conga_constants.py homebase_adapters.py
luci/site/luci/Extensions/ClusterModel: Device.py
make : version.in
Added files:
luci/cluster : validate_xvm_key.js
luci/site/luci/Extensions: LuciZopeAsync.py

Log message:
support for distributing fence_xvm keys

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_xvm_key.js.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence_device.js.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-chooser.diff?cvsroot=cluster&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.205&r2=1.206
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_fence.js.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_general.js.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_gulm.js.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_multicast.js.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_qdisk.js.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_create_gulm.js.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_fdom.js.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_fence.js.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_sys_svc.js.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/conga_ajax.js.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopeAsync.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/HelperFunctions.py.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.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZope.py.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopeExternal.py.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/RicciQueries.py.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.264&r2=1.265
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.42&r2=1.43
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&r1=1.52&r2=1.53
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/Device.py.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/make/version.in.diff?cvsroot=cluster&r1=1.32&r2=1.33

/cvs/cluster/conga/luci/cluster/validate_xvm_key.js,v --> standard output revision 1.1

- renamed from luci/cluster/validate_xvm_key.js +119 -0
@@ -0,0 +1,119 @@
+/*
+** Copyright (C) 2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
+function get_cluster_members(host_list) {
+	var url = '/luci/cluster?pagetype=1000';
+	var node_num = 0;
+
+	var hclu_elem = document.getElementById('host_cluster_name');
+	if (hclu_elem) {
+		++node_num;
+		url += '&node' + node_num + '=' + hclu_elem.value;
+	}
+	var vclu_elem = document.getElementById('virt_cluster_name');
+	if (vclu_elem) {
+		++node_num;
+		url += '&node' + node_num + '=' + vclu_elem.value;
+	}
+    initiate_async_get(url, cluster_member_callback);
+}
+
+function cluster_member_callback() {
+	return check_ajax_xml(xmlHttp_object, cluster_member_check);
+}
+
+function validate_xvm_dist_form(form) {
+	return form.submit();
+}
+
+function cluster_member_check(ret_status, obj) {
+	if (ret_status === null) {
+		/* Not ready */
+		return;
+	}
+
+	if (ret_status !== true) {
+		/* A communication error occurred. */
+		alert(obj);
+		return;
+	}
+
+	var err = get_ricci_response_status(obj.responseXML);
+	if (err !== null && err.length > 0) {
+		alert(err.join('\n'));
+		return;
+	}
+
+	obj = obj.responseXML;
+	var clusters = [];
+	var dict_tags = obj.firstChild.getElementsByTagName('dict');
+	for (var i = 0 ; i < dict_tags.length ; i++) {
+		try {
+			var cnode_names = [];
+			var tag_name = dict_tags[i].getAttribute('name');
+			var cnodes = dict_tags[i].getElementsByTagName('clusternode');
+
+			for (var j = 0 ; j < cnodes.length ; j++) {
+				cnode_names.push(cnodes[j].getAttribute('value'));
+			}
+			clusters.push([ tag_name, cnode_names ]);
+		} catch (e) {
+			continue;
+		}
+	}
+
+	var form_elem = document.getElementById('fence_config_form');
+	var xvm_submit_elem = document.getElementById('fence_config_submit');
+	var xvm_div_elem = document.getElementById('fence_xvm_hosts');
+	var xvm_hidden_elem = document.getElementById('fence_xvm_config');
+
+	if (!form_elem || !xvm_submit_elem || !xvm_div_elem || !xvm_hidden_elem) {
+		alert('Server error: required form elements are missing.');
+		return;
+	}
+
+	for (var i = 0 ; i < clusters.length ; i++) {
+		var cnode_list = clusters[i][1];
+
+		var div = document.createElement('div');
+		var p = document.createElement('p');
+		var span = document.createElement('strong');
+		var ul = document.createElement('ul');
+
+		p.className = 'cluster';
+		span.className = 'cluster';
+		span.textContent = 'Cluster: ' + clusters[i][0];
+
+		p.appendChild(span);
+		div.appendChild(p);
+
+		for (var j = 0 ; j < cnode_list.length ; j++) {
+			var li = document.createElement('li');
+			var input = document.createElement('input');
+			var lispan = document.createElement('span');
+			input.type = 'checkbox';
+			input.name = '__NODE_HOSTNAME__';
+			input.value = cnode_list[j];
+			input.checked = 'checked';
+			lispan.textContent = cnode_list[j];
+			li.appendChild(input);
+			li.appendChild(lispan);
+			ul.appendChild(li);
+		}
+		div.appendChild(ul);
+		xvm_div_elem.appendChild(div);
+	}
+
+	var fc_elem = document.getElementById('fence_xvm_init');
+	if (fc_elem) {
+		form_elem.pagetype.value = '60';
+		fc_elem.className = 'invisible';
+		xvm_hidden_elem.className = 'systemsTable';
+	}
+}
luci/cluster/fence_device.js +9 -0
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 var num_fences_level = [ 0, 0 ];
 var num_fence_instances = [];
 
luci/cluster/form-chooser +3 -0
@@ -161,6 +161,9 @@
     <span tal:omit-tag="" tal:condition="python: ptype == '91'">
      <div metal:use-macro="here/form-macros/macros/system-svc-update-form"/>
     </span>
+    <tal:block tal:condition="python: ptype == '1000'">
+     <div metal:use-macro="here/form-macros/macros/get-cluster-members-form"/>
+	</tal:block>
    </span>
   </metal:choose-form>
   </body>
luci/cluster/form-macros +75 -2

107 lines not on this page · raw message

luci/cluster/resource_form_handlers.js +9 -0
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 function swap_in_global_res(container_id, sel, replace, form) {
 	sel.id = null;
 	var container = document.getElementById(container_id);
luci/cluster/validate_config_fence.js +9 -0
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 function validate_form(form) {
 	var errors = new Array();
 
luci/cluster/validate_config_general.js +9 -0
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 function validate_form(form) {
 	var errors = new Array();
 	var name = null;
luci/cluster/validate_config_gulm.js +9 -0
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 function validate_form(form) {
 	var errors = new Array();
 	var lscount = 0;
luci/cluster/validate_config_multicast.js +9 -0
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 var prev_mcast_str = '';
 
 function disable_mcast(addrId) {
luci/cluster/validate_config_qdisk.js +9 -0
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 var heuristic_names = [ ':hprog', ':hinterval', ':hscore', ':hdel' ];
 
 function clear_heuristic(form, heur_num) {
luci/cluster/validate_create_gulm.js +9 -0
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 var lockservers = new Array();
 
 function toggle_gulm(form, lock_type) {
luci/cluster/validate_fdom.js +9 -0
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 function fdom_set_prioritized(form, state) {
 	var prilist = form.getElementsByTagName('input');
 	if (!prilist)
luci/cluster/validate_fence.js +9 -0
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 var fence_inst_validator = [];
 fence_inst_validator['apc'] = [ 'port', 'switch' ];
 fence_inst_validator['bladecenter'] = [ 'blade' ];
luci/cluster/validate_sys_svc.js +58 -42

106 lines not on this page · raw message

luci/plone-custom/conga_ajax.js +58 -0

61 lines not on this page · raw message

/cvs/cluster/conga/luci/site/luci/Extensions/LuciZopeAsync.py,v --> standard output revision 1.1

- renamed from luci/site/luci/Extensions/LuciZopeAsync.py +182 -0

182 lines not on this page · raw message

luci/site/luci/Extensions/HelperFunctions.py +4 -0
@@ -40,6 +40,10 @@
 			try:
 				rc = RicciCommunicator(host)
 				r['ricci'] = rc
+				try:
+					r['cluster_name'] = rc.cluster_info()[0]
+				except:
+					pass
 
 				if self.query_func is not None:
 					if self.query_args:
luci/site/luci/Extensions/LuciClusterInfo.py +9 -0
@@ -1609,3 +1609,12 @@
 		clu_map['os'] = 'rhel5'
 		clu_map['isVirtualized'] = False
 	return clu_map
+
+def getClusterConfNodes(conf_dom):
+	try:
+		cluster_nodes = conf_dom.getElementsByTagName('clusternode')
+		return map(lambda x: str(x.getAttribute('name')), cluster_nodes)
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('GCCN0: %r %s' % (e, str(e)))
+	return None
luci/site/luci/Extensions/LuciZope.py +8 -2
@@ -126,15 +126,21 @@
 
 def GetReqVars(req, varlist):
 	ret = {}
+	from types import ListType;
+
 	for i in varlist:
 		pval = None
 		if req and req.has_key(i):
-			pval = req[i].strip()
+			pval = req[i]
+			if type(req[i]) is not ListType:
+				pval = req[i].strip()
 			if not pval:
 				pval = None
 		if req and pval is None:
 			if req.form and req.form.has_key(i):
-				pval = req.form[i].strip()
+				pval = req.form[i]
+				if type(req.form[i]) is not ListType:
+					pval.strip()
 				if not pval:
 					pval = None
 		ret[i] = pval
luci/site/luci/Extensions/LuciZopeExternal.py +2 -0
@@ -51,3 +51,5 @@
 	get_content_data
 
 from system_adapters import get_sys_svc_list, validate_manage_svc
+
+from LuciZopeAsync import get_cluster_nodes_async, get_sysinfo_async
luci/site/luci/Extensions/RicciQueries.py +5 -0
@@ -721,3 +721,8 @@
 	if LUCI_DEBUG_MODE is True:
 		luci_log.debug_verbose('GCC2: no conf node found')
 	return None
+
+def set_xvm_key(rc, key_base64):
+	batch_str = '<module name="cluster"><request API_version="1.0"><function_call name="set_xvm_key"><var mutable="false" name="key_base64" type="string" value="%s"/></function_call></request></module>' % key_base64
+	ricci_xml = rc.batch_run(batch_str)
+	return batchAttemptResult(ricci_xml)
luci/site/luci/Extensions/cluster_adapters.py +55 -2

86 lines not on this page · raw message

luci/site/luci/Extensions/conga_constants.py +1 -0
@@ -54,6 +54,7 @@
 FENCEDEV_DELETE			= '57'
 FENCEDEV_NODE_CONFIG	= '58'
 SERVICE_MIGRATE			= '59'
+FENCE_XVM_KEY_CREATE	= '60'
 CONF_EDITOR				= '80'
 SYS_SERVICE_MANAGE		= '90'
 SYS_SERVICE_UPDATE		= '91'
luci/site/luci/Extensions/homebase_adapters.py +2 -4
@@ -17,6 +17,8 @@
 	manageCluster, \
 	CLUSTER_NODE_NEED_AUTH
 
+from LuciClusterInfo import getClusterConfNodes
+
 from LuciZopePerm import havePermAddCluster, havePermRemCluster, \
 	havePermAddUser, havePermDelUser, havePermEditPerms, \
 	havePermRemStorage, havePermAddStorage
@@ -1297,7 +1299,3 @@
 				if LUCI_DEBUG_MODE is True:
 					luci_log.debug_verbose('getUserPerms2: user %s, obj %s: %r %s' % (userName, s[0], e, str(e)))
 	return perms
-
-def getClusterConfNodes(conf_dom):
-	cluster_nodes = conf_dom.getElementsByTagName('clusternode')
-	return map(lambda x: str(x.getAttribute('name')), cluster_nodes)
luci/site/luci/Extensions/ClusterModel/Device.py +1 -1
@@ -13,7 +13,7 @@
 
 #New Power Controller Fence Agent names should be added to
 #the list below
-power_controller_list = ["fence_wti", "fence_apc","fence_apc_snmp"]
+power_controller_list = [ "fence_wti", "fence_apc", "fence_apc_snmp" ]
 
 class Device(TagObject):
   def __init__(self):
make/version.in +1 -1
@@ -1,5 +1,5 @@
 VERSION=0.10.0
-RELEASE=2_UNRELEASED
+RELEASE=4_UNRELEASED
 # Remove "_UNRELEASED" at release time.
 # Put release num at the beggining, 
 # so that after it gets released, it has