[Cluster-devel] conga/luci cluster/form-macros cluster/index_h ...

rmccabe at sourceware.org rmccabe at sourceware.org
Tue Nov 7 21:33:52 UTC 2006


CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-11-07 21:33:52

Modified files:
	luci/cluster   : form-macros index_html resource-form-macros 
	luci/site/luci/Extensions: cluster_adapters.py 

Log message:
	- fix fenced parameter updates (properties must be strings, not ints)
	- fix more disappearing model builder object problems
	- add a configure action in the bottom left portal for each cluster

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.100&r2=1.101
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/index_html.diff?cvsroot=cluster&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.152&r2=1.153

--- conga/luci/cluster/form-macros	2006/11/07 20:28:36	1.100
+++ conga/luci/cluster/form-macros	2006/11/07 21:33:52	1.101
@@ -2176,7 +2176,6 @@
 </div>
 
 <div metal:define-macro="xenvmadd-form">
-  <span tal:define="ress python:here.appendModel(request, modelb)"/>
   <form method="get" action="" tal:attributes="action python:request['baseurl'] + '?clustername=' + request['clustername'] + '&pagetype=29'">
   <h4>Path to configuration file: </h4><input type="text" name="xenvmpath" value=""/>
   <h4>Name of configuration file: </h4><input type="text" name="xenvmname" value=""/>
@@ -2185,7 +2184,6 @@
 </div>
 
 <div metal:define-macro="xenvmconfig-form">
-  <span tal:define="ress python:here.appendModel(request, modelb)"/>
   <h4>Properties for Xen VM <font color="green"><span tal:content="request/servicename"/></font></h4>
   <span tal:define="global xeninfo python:here.getXenVMInfo(modelb, request)">
   <form method="get" action="" tal:attributes="action python:request['baseurl'] + '?clustername=' + request['clustername'] + '&pagetype=29&servicename=' + request['servicename']">
--- conga/luci/cluster/index_html	2006/11/07 20:28:36	1.26
+++ conga/luci/cluster/index_html	2006/11/07 21:33:52	1.27
@@ -164,9 +164,17 @@
 		<tal:block tal:condition="python: ri_agent">
 			<tal:block tal:define="
 				global modelb python:here.getmodelbuilder(ri_agent, isVirtualized)" />
+			<tal:block tal:condition="python: modelb">
+				<tal:block
+					tal:define="dummy python: here.appendModel(request, modelb)" />
+			</tal:block>
 		</tal:block>
     </tal:block>
 
+	<tal:block tal:condition="not: exists: modelb">
+		<tal:block tal:define="global modelb nothing" />
+	</tal:block>
+
       <table id="portal-columns">
         <tbody>
           <tr>
--- conga/luci/cluster/resource-form-macros	2006/10/30 20:42:03	1.22
+++ conga/luci/cluster/resource-form-macros	2006/11/07 21:33:52	1.23
@@ -43,8 +43,7 @@
 
 	<tal:block
 		tal:define="
-			global rescInf python: here.getResourcesInfo(modelb, request);
-			global msg python: here.appendModel(request, modelb)" />
+			global rescInf python: here.getResourcesInfo(modelb, request)" />
 
 	<table class="systemsTable">
 		<thead class="systemsTable">
@@ -258,44 +257,43 @@
 	<tal:block tal:define="global resourcename request/resourcename | request/form/resourceName | nothing" />
 	<tal:block tal:condition="resourcename"
 		tal:define="
-			global msg python: here.appendModel(request, modelb);
 			global res python: here.getResourceInfo(modelb, request);
 			global type python: 'tag_name' in res and res['tag_name'] or ''">
 
 	<h2>Configure <span tal:replace="res/name | string: resource" /></h2>
 
 	<div class="reschoose">
-		<span tal:omit-tag="" tal:condition="python: type == 'ip'">
+		<tal:block tal:condition="python: type == 'ip'">
 			<div metal:use-macro="here/resource-form-macros/macros/ip_macro" />
-		</span>
+		</tal:block>
 
-		<span tal:omit-tag="" tal:condition="python: type == 'fs'">
+		<tal:block tal:condition="python: type == 'fs'">
 			<div metal:use-macro="here/resource-form-macros/macros/fs_macro" />
-		</span>
+		</tal:block>
 
-		<span tal:omit-tag="" tal:condition="python: type == 'gfs'">
+		<tal:block tal:condition="python: type == 'gfs'">
 			<div metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
-		</span>
+		</tal:block>
 
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
+		<tal:block tal:condition="python: type == 'nfsm'">
 			<div metal:use-macro="here/resource-form-macros/macros/nfsm_macro"/>
-		</span>
+		</tal:block>
 
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsx'">
+		<tal:block tal:condition="python: type == 'nfsx'">
 			<div metal:use-macro="here/resource-form-macros/macros/nfsx_macro"/>
-		</span>
+		</tal:block>
 
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsc'">
+		<tal:block tal:condition="python: type == 'nfsc'">
 			<div metal:use-macro="here/resource-form-macros/macros/nfsc_macro"/>
-		</span>
+		</tal:block>
 
-		<span tal:omit-tag="" tal:condition="python: type == 'smb'">
+		<tal:block tal:condition="python: type == 'smb'">
 			<div metal:use-macro="here/resource-form-macros/macros/smb_macro" />
-		</span>
+		</tal:block>
 
-		<span tal:omit-tag="" tal:condition="python: type == 'script'">
+		<tal:block tal:condition="python: type == 'script'">
 			<div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
-		</span>
+		</tal:block>
 	</div>
 	</tal:block>
 </div>
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/07 20:14:15	1.152
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/07 21:33:52	1.153
@@ -516,7 +516,6 @@
 	try:
 		model.usesMulticast = True
 		model.mcast_address = addr_str
-		model.setModified(True)
 	except Exception, e:
 		luci_log.debug('Error updating mcast properties: %s' % str(e))
 		errors.append('Unable to update cluster multicast properties')
@@ -720,8 +719,8 @@
 		if post_join_delay == old_pj_delay and post_fail_delay == old_pf_delay:
 			errors.append('No fence daemon properties were changed.')
 		else:
-			fd.setPostJoinDelay(post_join_delay)
-			fd.setPostFailDelay(post_fail_delay)
+			fd.setPostJoinDelay(str(post_join_delay))
+			fd.setPostFailDelay(str(post_fail_delay))
 	except Exception, e:
 		luci_log.debug_verbose('Unable to update fence daemon properties: %s' % str(e))
 		errors.append('An error occurred while attempting to update fence daemon properties.')
@@ -764,7 +763,7 @@
 			return (False, {'errors': ['No cluster model was found.']})
 
 		try:
-			model = getModelBuilder(rc, rc.dom0())
+			model = getModelBuilder(None, rc, rc.dom0())
 			if not model:
 				raise Exception, 'model is none'
 		except Exception, e:
@@ -807,7 +806,8 @@
 		try:
 			config_ver = int(cp.getConfigVersion()) + 1
 			# always increment the configuration version
-			cp.setConfigVersion(config_ver)
+			cp.setConfigVersion(str(config_ver))
+			model.setModified(True)
 			conf_str = model.exportModelAsString()
 			if not conf_str:
 				raise Exception, 'conf_str is none'
@@ -1259,6 +1259,19 @@
   kids.append(rvadd)
   kids.append(rvcfg)
   rv['children'] = kids
+ ################################################################
+
+  cprop = {}
+  cprop['Title'] = 'Configure'
+  cprop['cfg_type'] = 'configuration paramters'
+  cprop['absolute_url'] = url + '?pagetype=' + CLUSTER_CONFIG + '&clustername=' + cluname
+  cprop['Description'] = 'Change cluster configuration parameters'
+  cprop['show_children'] = False
+  if pagetype == CLUSTER_CONFIG:
+    cprop['currentItem'] = True
+  else:
+    cprop['currentItem'] = False
+
  #################################################################
   fd = {}
   fd['Title'] = "Failover Domains"
@@ -1403,6 +1416,7 @@
   mylist.append(nd)
   mylist.append(sv)
   mylist.append(rv)
+  mylist.append(cprop)
   mylist.append(fd)
   mylist.append(fen)
 
@@ -2076,7 +2090,7 @@
       luci_log.debug_verbose('GCI1: unable to find a ricci agent for the %s cluster' % cluname)
       return {}
     try:
-      model = getModelBuilder(rc, rc.dom0())
+      model = getModelBuilder(None, rc, rc.dom0())
       if not model:
         raise Exception, 'model is none'
 
@@ -4350,24 +4364,27 @@
 
 	return True
 
-def getModelBuilder(rc, isVirtualized):
+def getModelBuilder(self, rc, isVirtualized):
 	try:
 		cluster_conf_node = getClusterConf(rc)
 		if not cluster_conf_node:
-			raise
-	except:
-		luci_log.debug('unable to get cluster_conf_node in getModelBuilder')
+			raise Exception, 'getClusterConf returned None'
+	except Exception, e:
+		luci_log.debug_verbose('GMB0: unable to get cluster_conf_node in getModelBuilder: %s' % str(e))
 		return None
 
 	try:
 		modelb = ModelBuilder(0, None, None, cluster_conf_node)
+		if not modelb:
+			raise Exception, 'ModelBuilder returned None'
 	except Exception, e:
 		try:
-			luci_log.debug('An error occurred while trying to get modelb for conf \"%s\": %s' % (cluster_conf_node.toxml(), str(e)))
+			luci_log.debug_verbose('GMB1: An error occurred while trying to get modelb for conf \"%s\": %s' % (cluster_conf_node.toxml(), str(e)))
 		except:
-			pass
+			luci_log.debug_verbose('GMB1: ModelBuilder failed')
 
-	modelb.setIsVirtualized(isVirtualized)
+	if modelb:
+		modelb.setIsVirtualized(isVirtualized)
 	return modelb
 
 def set_node_flag(self, cluname, agent, batchid, task, desc):




More information about the Cluster-devel mailing list