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 homebase/form-macros site/luci/Exte ...
Date: 31 Jul 2006 17:46:32 -0000	[thread overview]
Message-ID: <20060731174632.13488.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-07-31 17:46:32

Modified files:
	luci/homebase  : form-macros 
	luci/site/luci/Extensions: cluster_adapters.py 

Log message:
	cluster add bits.. been sitting here unchecked in for too long

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&r1=1.31&r2=1.32
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.23&r2=1.24

--- conga/luci/homebase/form-macros	2006/07/25 17:47:36	1.31
+++ conga/luci/homebase/form-macros	2006/07/31 17:46:32	1.32
@@ -1,7 +1,7 @@
 <html>
 
 <tal:comment replace="nothing">
-	$Id: form-macros,v 1.31 2006/07/25 17:47:36 rmccabe Exp $
+	$Id: form-macros,v 1.32 2006/07/31 17:46:32 rmccabe Exp $
 </tal:comment>
 
 <head>
@@ -336,7 +336,7 @@
 		</tal:block>
 
 		<div tal:omit-tag="" tal:condition="python: systems[1] and len(systems[1]) > 0">
-			<h3 class="homebase">Unclustered Systems</h3>
+			<h3 class="homebase">Storage Systems</h3>
 
 			<tal:block tal:repeat="s python: systems[1]">
 				<div class="hbcheckdiv"
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/07/28 19:03:05	1.23
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/07/31 17:46:32	1.24
@@ -25,17 +25,15 @@
 
 CLUSTER_FOLDER_PATH = '/luci/systems/cluster/'
 
-def validateCreateCluster(self, request):
-	errors = list()
-	messages = list()
+def validateClusterNodes(request, sessionData, numStorage):
 	nodeList = list()
 	nodeHash = {}
 	rnodeHash = {}
 	oldNodeHash = {}
 	oldRnodeHash = {}
 	requestResults = {}
+	errors = list()
 
- 	sessionData = request.SESSION.get('checkRet')
 	if sessionData and 'requestResults' in sessionData:
 		requestResults = sessionData['requestResults']
 		if 'nodeHash' in requestResults:
@@ -43,18 +41,6 @@
 		if 'rnodeHash' in requestResults:
 			oldRnodeHash = requestResults['rnodeHash']
 
-	if not 'clusterName' in request.form or not request.form['clusterName']:
-		return (False, {'errors': [ 'No cluster name was specified.' ] })
-	clusterName = request.form['clusterName']
-
-	try:
-		numStorage = int(request.form['numStorage'])
-	except:
-		return (False, { 'errors': ['Unknown number of systems entered'], 'requestResults': requestResults })
-
-	if numStorage < 2:
-		return (False, { 'errors': ['A cluster must contain at least two nodes'], 'requestResults': requestResults })
-
 	i = 0
 	while i < numStorage:
 		try:
@@ -95,9 +81,6 @@
 				nodeList.append(node)
 		i += 1
 
-	if len(nodeList) < 2:
-		errors.append('A cluster must contain at least two nodes')
-
 	sfn = lambda x, y: \
 		x['cur_auth'] - y['cur_auth'] or (('errors' in y) - ('errors' in x))
 	nodeList.sort(sfn)
@@ -111,6 +94,41 @@
 		'isComplete': len(errors) < 1 and len(filter(dfn, nodeList)) == 0
 	}
 
+	return [errors, cluster_properties]
+
+def validateCreateCluster(self, request):
+	errors = list()
+	messages = list()
+	requestResults = {}
+
+	try:
+	 	sessionData = request.SESSION.get('checkRet')
+	except:
+		sessionData = None
+
+	if not 'clusterName' in request.form or not request.form['clusterName']:
+		return (False, {'errors': [ 'No cluster name was specified.' ] })
+	clusterName = request.form['clusterName']
+
+	try:
+		numStorage = int(request.form['numStorage'])
+	except:
+		return (False, { 'errors': ['Unknown number of systems entered'], 'requestResults': requestResults })
+
+	if numStorage < 2:
+		return (False, { 'errors': ['A cluster must contain at least two nodes'], 'requestResults': requestResults })
+
+	ret = validateClusterNodes(request, sessionData, numStorage)
+	errors.extend(ret[0])
+	cluster_properties = ret[1]
+
+	try:
+		nodeList = cluster_properties['nodeList']
+		if len(nodeList) < 2:
+			raise
+	except:
+		errors.append('A cluster must contain at least two nodes')
+
 	if cluster_properties['isComplete'] != True:
 		nodeUnauth(nodeList)
 		return (False, {'errors': errors, 'requestResults':cluster_properties })
@@ -168,12 +186,53 @@
   
 
 def validateAddClusterNode(self, request):
+	try:
+	 	sessionData = request.SESSION.get('checkRet')
+	except:
+		sessionData = None
+
 	if 'clusterName' in request.form:
 		clusterName = request.form['clusterName']
 	else:
 		return (False, {'errrors': [ 'Cluster name is missing'] })
 
-	return None
+	try:
+		numStorage = int(request.form['numStorage'])
+		if numStorage < 1:
+			raise
+	except:
+		errors.append('You must specify at least one node to add to the cluster')
+		return (False, {'errors': [ errors ] })
+
+	ret = validateClusterNodes(sessionData, request, numStorage)
+	errors.extend(ret[0])
+	cluster_properties = ret[1]
+
+	try:
+		nodeList = cluster_properties['nodeList']
+		if len(nodeList) < 1:
+			raise
+	except:
+		errors.append('You must specify@least one valid node to add to the cluster')
+		
+	if not cluster_properties['isComplete']:
+		return (False, {'errors': errors, 'requestResults': cluster_properties})
+
+	i = 0
+	while i < len(nodeList):
+		try:
+			x = 0 # ricci call succeeds
+			messages.append('Cluster join initiated for host \"' + i['ricci_host'] + '\"')
+			del nodeList[i]
+		except:
+			i['errors'] = True
+			errors.append('Unable to initiate node creation for host \"' + i['ricci_host'] + '\"')
+			cluster_properties['isComplete'] = 0
+
+	if not cluster_properties['isComplete']:
+		return (False, {'errors': errors, 'requestResults': cluster_properties})
+
+	return (True, {'errors': errors, 'messages': messages})
 
 formValidators = {
 	6: validateCreateCluster,



             reply	other threads:[~2006-07-31 17:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-31 17:46 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-10-31 19:09 [Cluster-devel] conga/luci homebase/form-macros site/luci/Exte rmccabe
2006-10-13 17:04 rmccabe
2006-06-30 21:39 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=20060731174632.13488.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.