cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] conga/luci/site/luci/Extensions ModelBuilder.p ...
@ 2006-10-06 21:08 rmccabe
  0 siblings, 0 replies; 12+ messages in thread
From: rmccabe @ 2006-10-06 21:08 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-10-06 21:08:54

Modified files:
	luci/site/luci/Extensions: ModelBuilder.py FenceHandler.py 

Log message:
	fix a few typos

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&r1=1.2&r2=1.3

--- conga/luci/site/luci/Extensions/ModelBuilder.py	2006/08/09 21:49:30	1.5
+++ conga/luci/site/luci/Extensions/ModelBuilder.py	2006/10/06 21:08:54	1.6
@@ -601,7 +601,7 @@
     return self.usesQuorumd
 
   def getQuorumdPtr(self):
-    return quorumd_ptr
+    return self.quorumd_ptr
 
   def check_empty_ptrs(self):
     if self.resourcemanager_ptr == None:
@@ -662,7 +662,7 @@
       kids = self.resourcemanager_ptr.getChildren()
       for kid in kids:
         if kid.getName() == service:
-          kids.removeChild(kid)
+          self.resourcemanager_ptr.removeChild(kid)
           break
  
   def getResources(self):
--- conga/luci/site/luci/Extensions/FenceHandler.py	2006/10/04 15:11:10	1.2
+++ conga/luci/site/luci/Extensions/FenceHandler.py	2006/10/06 21:08:54	1.3
@@ -11,6 +11,7 @@
 FD_PROVIDE_SERVER = "A server address must be provided for this Fence Device"
 FD_PROVIDE_CSERVER = "A cserver address must be provided for this Egenera Fence Device"
 FD_PROVIDE_IP = "An IP address must be provided for this Fence Device"
+FD_PROVIDE_HOSTNAME = "A host name must be provided for this Fence Device"
 FD_PROVIDE_LOGIN = "A login name must be provided for this Fence Device"
 FD_PROVIDE_PASSWD = "A password must be provided for this Fence Device"
 FI_PROVIDE_XCATNODENAME = "An xCAT Nodename must be provided for this Fence"



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Cluster-devel] conga/luci/site/luci/Extensions ModelBuilder.p ...
@ 2006-10-24  1:42 jparsons
  0 siblings, 0 replies; 12+ messages in thread
From: jparsons @ 2006-10-24  1:42 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	jparsons at sourceware.org	2006-10-24 01:42:53

Modified files:
	luci/site/luci/Extensions: ModelBuilder.py cluster_adapters.py 
Added files:
	luci/site/luci/Extensions: Vm.py 

Log message:
	Change UI name and tag name from Xenvm

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Vm.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8&r2=1.8.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.120.2.3&r2=1.120.2.4

--- conga/luci/site/luci/Extensions/ModelBuilder.py	2006/10/16 20:46:55	1.8
+++ conga/luci/site/luci/Extensions/ModelBuilder.py	2006/10/24 01:42:52	1.8.2.1
@@ -33,7 +33,7 @@
 from Service import Service
 from QuorumD import QuorumD
 from Heuristic import Heuristic
-from Xenvm import Xenvm
+from Vm import Vm
 from RefObject import RefObject
 from FailoverDomain import FailoverDomain
 from FailoverDomains import FailoverDomains
@@ -57,7 +57,7 @@
            'lockserver':Lockserver,
            'rm':Rm,
            'service':Service,
-           'xenvm':Xenvm,
+           'vm':Vm,
            'resources':Resources,
            'failoverdomain':FailoverDomain,
            'failoverdomains':FailoverDomains,
@@ -86,7 +86,7 @@
 RESOURCES_PTR_STR="resources"
 FENCEDAEMON_PTR_STR="fence_daemon"
 SERVICE="service"
-XENVM="xenvm"
+VM="vm"
 GULM_TAG_STR="gulm"
 MCAST_STR="multicast"
 CMAN_PTR_STR="cman"
@@ -663,7 +663,7 @@
     if self.resourcemanager_ptr != None:
       kids = self.resourcemanager_ptr.getChildren()
       for kid in kids:
-        if kid.getTagName() == XENVM:
+        if kid.getTagName() == VM:
           rg_list.append(kid)
 
     return rg_list
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/23 20:47:10	1.120.2.3
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/24 01:42:52	1.120.2.4
@@ -16,7 +16,7 @@
 from NFSClient import NFSClient
 from NFSExport import NFSExport
 from Netfs import Netfs
-from Xenvm import Xenvm
+from Vm import Vm
 from Script import Script
 from Samba import Samba
 from clusterOS import resolveOSType
@@ -910,10 +910,10 @@
 
   if model.getIsVirtualized() == True:
     vmadd = {}
-    vmadd['Title'] = "Add a XenVM"
+    vmadd['Title'] = "Add a Virtual Service"
     vmadd['cfg_type'] = "xenvmadd"
     vmadd['absolute_url'] = url + "?pagetype=" + XENVM_ADD + "&clustername=" + cluname
-    vmadd['Description'] = "Add a XenVM to this cluster"
+    vmadd['Description'] = "Add a Virtual Service to this cluster"
     if pagetype == XENVM_ADD:
       vmadd['currentItem'] = True
     else:
@@ -963,7 +963,7 @@
     svc['Title'] = xenname
     svc['cfg_type'] = "xenvm"
     svc['absolute_url'] = url + "?pagetype=" + XENVM_CONFIG + "&servicename=" + xenname + "&clustername=" + cluname
-    svc['Description'] = "Configure this XenVM"
+    svc['Description'] = "Configure this Virtual Service"
     if pagetype == XENVM_CONFIG:
       try:
         xname = request['servicename']
@@ -2512,7 +2512,7 @@
     isNew = True
   
   if isNew == True:
-    xvm = Xenvm()
+    xvm = Vm()
     xvm.addAttribute("name", req.form['xenvmname'])
     xvm.addAttribute("path", req.form['xenvmpath'])
     rmptr = model.getResourceManagerPtr()



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Cluster-devel] conga/luci/site/luci/Extensions ModelBuilder.p ...
@ 2006-10-24 15:05 jparsons
  0 siblings, 0 replies; 12+ messages in thread
From: jparsons @ 2006-10-24 15:05 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	jparsons at sourceware.org	2006-10-24 15:05:29

Modified files:
	luci/site/luci/Extensions: ModelBuilder.py cluster_adapters.py 

Log message:
	bz211942 xenvm name change

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.126&r2=1.127

--- conga/luci/site/luci/Extensions/ModelBuilder.py	2006/10/16 20:46:55	1.8
+++ conga/luci/site/luci/Extensions/ModelBuilder.py	2006/10/24 15:05:28	1.9
@@ -33,7 +33,7 @@
 from Service import Service
 from QuorumD import QuorumD
 from Heuristic import Heuristic
-from Xenvm import Xenvm
+from Vm import Vm
 from RefObject import RefObject
 from FailoverDomain import FailoverDomain
 from FailoverDomains import FailoverDomains
@@ -57,7 +57,7 @@
            'lockserver':Lockserver,
            'rm':Rm,
            'service':Service,
-           'xenvm':Xenvm,
+           'vm':Vm,
            'resources':Resources,
            'failoverdomain':FailoverDomain,
            'failoverdomains':FailoverDomains,
@@ -86,7 +86,7 @@
 RESOURCES_PTR_STR="resources"
 FENCEDAEMON_PTR_STR="fence_daemon"
 SERVICE="service"
-XENVM="xenvm"
+VM="vm"
 GULM_TAG_STR="gulm"
 MCAST_STR="multicast"
 CMAN_PTR_STR="cman"
@@ -663,7 +663,7 @@
     if self.resourcemanager_ptr != None:
       kids = self.resourcemanager_ptr.getChildren()
       for kid in kids:
-        if kid.getTagName() == XENVM:
+        if kid.getTagName() == VM:
           rg_list.append(kid)
 
     return rg_list
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/24 14:08:50	1.126
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/24 15:05:28	1.127
@@ -16,7 +16,7 @@
 from NFSClient import NFSClient
 from NFSExport import NFSExport
 from Netfs import Netfs
-from Xenvm import Xenvm
+from Vm import Vm
 from Script import Script
 from Samba import Samba
 from clusterOS import resolveOSType
@@ -942,10 +942,10 @@
 
   if model.getIsVirtualized() == True:
     vmadd = {}
-    vmadd['Title'] = "Add a XenVM"
+    vmadd['Title'] = "Add a Virtual Service"
     vmadd['cfg_type'] = "xenvmadd"
     vmadd['absolute_url'] = url + "?pagetype=" + XENVM_ADD + "&clustername=" + cluname
-    vmadd['Description'] = "Add a XenVM to this cluster"
+    vmadd['Description'] = "Add a Virtual Service to this cluster"
     if pagetype == XENVM_ADD:
       vmadd['currentItem'] = True
     else:
@@ -995,7 +995,7 @@
     svc['Title'] = xenname
     svc['cfg_type'] = "xenvm"
     svc['absolute_url'] = url + "?pagetype=" + XENVM_CONFIG + "&servicename=" + xenname + "&clustername=" + cluname
-    svc['Description'] = "Configure this XenVM"
+    svc['Description'] = "Configure this Virtual Service"
     if pagetype == XENVM_CONFIG:
       try:
         xname = request['servicename']
@@ -2635,7 +2635,7 @@
     isNew = True
   
   if isNew == True:
-    xvm = Xenvm()
+    xvm = Vm()
     xvm.addAttribute("name", req.form['xenvmname'])
     xvm.addAttribute("path", req.form['xenvmpath'])
     rmptr = model.getResourceManagerPtr()



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Cluster-devel] conga/luci/site/luci/Extensions ModelBuilder.p ...
@ 2006-10-26 22:59 rmccabe
  0 siblings, 0 replies; 12+ messages in thread
From: rmccabe @ 2006-10-26 22:59 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-10-26 22:59:13

Modified files:
	luci/site/luci/Extensions: ModelBuilder.py cluster_adapters.py 
	                           ricci_bridge.py 

Log message:
	- fix for broken exportModelAsString()
	- fix for broken resource add/edit handler
	- lots more debugging and verbose exception handling

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.129&r2=1.130
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_bridge.py.diff?cvsroot=cluster&r1=1.35&r2=1.36

--- conga/luci/site/luci/Extensions/ModelBuilder.py	2006/10/24 15:05:28	1.9
+++ conga/luci/site/luci/Extensions/ModelBuilder.py	2006/10/26 22:59:13	1.10
@@ -416,9 +416,9 @@
 
     return True
   
-  def exportModelAsString(self, strbuf):
+  def exportModelAsString(self):
     if self.perform_final_check() == False: # failed
-      return False
+      return None
     
     #check for dual power fences
     self.dual_power_fence_check()
@@ -438,7 +438,7 @@
       #can be used
       self.purgePCDuplicates()
 
-    return True
+    return strbuf
   
   def has_filepath(self):
     if self.filename == None:
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/25 01:11:08	1.129
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/26 22:59:13	1.130
@@ -258,7 +258,6 @@
     flag.manage_addProperty(FLAG_DESC,"Creating node " + key + " for cluster " + clusterName, "string")
     flag.manage_addProperty(LAST_STATUS, 0, "int")
 
-
 def validateAddClusterNode(self, request):
 	errors = list()
 	messages = list()
@@ -441,7 +440,7 @@
 			return (False, {'errors': ['An invalid resource type was specified: ' + res_type]})
 
 		try:
-			resObj = resourceAddHandler[res_type](self, dummy_form)
+			resObj = resourceAddHandler[res_type](request, dummy_form)
 		except:
 			luci_log('res type %d is invalid' % res_type)
 			resObj = None
@@ -453,11 +452,32 @@
 	return (True, {'messages': ['This service has been updated.']})
 
 def validateResourceAdd(self, request):
-	return (True, {})
-	
-def validateResourceEdit(self, request):
-	return (True, {})
+	try:
+		res_type = request.form['type'].strip()
+		if not res_type:
+			raise KeyError, 'type is blank'
+	except Exception, e:
+		luci_log.debug_verbose('resourceAdd: type is blank')
+		return (False, {'errors': ['No resource type was given.']})
+
+	errors = list()
+	try:
+		res = resourceAddHandler[res_type](request)
+		if res is None or res[0] is None or res[1] is None:
+			if res and res[2]:
+				errors.extend(res[2])
+			raise Exception, 'An error occurred while adding this resource'
+		modelb = res[1]
+		newres = res[0]
+		addResource(self, request, modelb, newres)
+	except Exception, e:
+		if len(errors) < 1:
+			errors.append('An error occurred while adding this resource')
+		luci_log.debug_verbose('resource error: %s' % str(e))
+		return (False, {'errors': errors})
 
+	return (True, {'messages': ['Resource added successfully']})
+	
 ## Cluster properties form validation routines
 
 def validateMCastConfig(self, form):
@@ -705,7 +725,7 @@
 	21: validateServiceAdd,
 	24: validateServiceAdd,
 	31: validateResourceAdd,
-	33: validateResourceEdit,
+	33: validateResourceAdd,
 	51: validateFenceAdd,
 	50: validateFenceEdit,
 }
@@ -1331,19 +1351,21 @@
 
 def getRicciAgent(self, clustername):
 	#Check cluster permission here! return none if false
-	path = CLUSTER_FOLDER_PATH + clustername
+	path = str(CLUSTER_FOLDER_PATH + clustername)
 
 	try:
 		clusterfolder = self.restrictedTraverse(path)
 		if not clusterfolder:
-			luci_log.debug('cluster folder %s for %s is missing.' \
+			luci_log.debug('GRA: cluster folder %s for %s is missing.' \
 				% (path, clustername))
-			raise
+			raise Exception, 'no cluster folder at %s' % path
 		nodes = clusterfolder.objectItems('Folder')
 		if len(nodes) < 1:
-			luci_log.debug('no cluster nodes for %s found.' % clustername)
-			return None
-	except:
+			luci_log.debug('GRA: no cluster nodes for %s found.' % clustername)
+			raise Exception, 'no cluster nodes were found@%s' % path
+	except Exception, e:
+		luci_log.debug('GRA: cluster folder %s for %s is missing: %s.' \
+			% (path, clustername, str(e)))
 		return None
 
 	cluname = lower(clustername)
@@ -1360,24 +1382,31 @@
 		try:
 			rc = RicciCommunicator(hostname)
 		except RicciError, e:
-			luci_log.debug('ricci error: %s' % str(e))
+			luci_log.debug('GRA: ricci error: %s' % str(e))
 			continue
 
 		try:
 			clu_info = rc.cluster_info()
-			if cluname != lower(clu_info[0]) and cluname != lower(clu_info[1]):
-				luci_log.debug('%s reports it\'s in cluster %s:%s; we expect %s' \
+		except Exception, e:
+			luci_log.debug('GRA: cluster_info error: %s' % str(e))
+
+		if cluname != lower(clu_info[0]) and cluname != lower(clu_info[1]):
+			try:
+				luci_log.debug('GRA: %s reports it\'s in cluster %s:%s; we expect %s' \
 					 % (hostname, clu_info[0], clu_info[1], cluname))
-				# node reports it's in a different cluster
-				raise
-		except:
+				setNodeFlag(self, node, CLUSTER_NODE_NOT_MEMBER)
+			except:
+				pass
 			continue
 
 		if rc.authed():
 			return rc
-		setNodeFlag(node[1], CLUSTER_NODE_NEED_AUTH)
+		try:
+			setNodeFlag(node[1], CLUSTER_NODE_NEED_AUTH)
+		except:
+			pass
 
-	luci_log.debug('no ricci agent could be found for cluster %s' % cluname)
+	luci_log.debug('GRA: no ricci agent could be found for cluster %s' % cluname)
 	return None
 
 def getRicciAgentForCluster(self, req):
@@ -1394,23 +1423,14 @@
 	return getRicciAgent(self, clustername)
 
 def getClusterStatus(self, rc):
-	clustatus_batch ='<?xml version="1.0" ?><batch><module name="cluster"><request API_version="1.0"><function_call name="status"/></request></module></batch>'
-
-	try:
-		clustatuscmd_xml = minidom.parseString(clustatus_batch).firstChild
-	except:
-		return {}
-
-	try:
-		ricci_xml = rc.process_batch(clustatuscmd_xml, async=False)
-	except RicciError, e:
-		luci_log.debug('ricci error: %s', str(e))
-	except:
+	doc = getClusterStatusBatch(rc)
+	if not doc:
+		try:
+			luci_log.debug_verbose('getClusterStatusBatch returned None for %s/%s' % rc.cluster_info())
+		except:
+			pass
 		return {}
 
-	doc = getPayload(ricci_xml)
-	if not doc or not doc.firstChild:
-		return {}
 	results = list()
 
 	vals = {}
@@ -2284,8 +2304,14 @@
 			return None
 
 		model.deleteNode(delete_target)
-		str_buf = ""
-		model.exportModelAsString(str_buf)
+
+		try:
+			str_buf = model.exportModelAsString()
+			if not str_buf:
+				raise Exception, 'model string is blank'
+		except Exception, e:
+			luci_log.debug_verbose('NTP exportModelAsString: %s' % str(e))
+			return None
 
 		# propagate the new cluster.conf via the second node
 		batch_number, result = setClusterConf(rc2, str(str_buf))
@@ -2669,12 +2695,28 @@
     xvm.addAttribute("name", req.form['xenvmname'])
     xvm.addAttribute("path", req.form['xenvmpath'])
 
-  stringbuf = ""
-  model.exportModelAsString(stringbuf)
-  setClusterConf(stringbuf)
+  try:
+    stringbuf = model.exportModelAsString()
+    if not stringbuf:
+   	  raise Exception, 'model is blank'
+  except Exception, e:
+    luci_log.debug_verbose('exportModelAsString error: %s' % str(e))
+    return None
 
-  
-    
+  try:
+    clustername = model.getClusterName()
+    if not clustername:
+      raise Exception, 'cluster name from modelb.getClusterName() is blank'
+  except Exception, e:
+    luci_log.debug_verbose('error: getClusterName: %s' % str(e))
+    return None
+
+  rc = getRicciAgent(self, clustername)
+  if not rc:
+    luci_log.debug_verbose('Unable to find a ricci agent for the %s cluster' % clustername)
+    return None
+
+  setClusterConf(rc, stringbuf)
 
 def getXenVMInfo(self, model, request):
 	try:
@@ -2916,7 +2958,12 @@
 		map['isVirtualized'] = rc.dom0()
 	except:
 		# default to rhel5 if something crazy happened.
-		luci_log.debug('An error occurred while attempting to get OS/Virt info for %s -- defaulting to rhel5/False' % rc.hostname())
+		try:
+			luci_log.debug('An error occurred while attempting to get OS/Virt info for %s -- defaulting to rhel5/False' % rc.hostname())
+		except:
+			# this can throw an exception if the original exception
+			# is caused by rc being None or stale.
+			pass
 		map['os'] = 'rhel5'
 		map['isVirtualized'] = False
 	return map
@@ -2948,15 +2995,30 @@
 	return resList
 
 def getResourceInfo(modelb, request):
+	if not modelb:
+		luci_log.debug_verbose('no modelb obj in getResourceInfo')
+		return {}
+
+	name = None
 	try:
 		name = request['resourcename']
 	except KeyError, e:
 		try:
 			name = request.form['resourcename']
 		except:
-			luci_log.debug_verbose('getResourceInfo missing res name')
-			return {}
+			pass
 	except:
+		pass
+
+	if name is None:
+		try:
+			type = request.form['type']
+			if type == 'ip':
+				name = request.form['value'].strip()
+		except:
+			pass
+
+	if name is None:
 		luci_log.debug_verbose('getResourceInfo missing res name')
 		return {}
 
@@ -2997,7 +3059,7 @@
 	try:
 		modelb = request.SESSION.get('model')
 	except:
-		luci_log.debug_verbose('delResource unable to extract model from SESSION')
+		luci_log.debug_verbose('delRes unable to extract model from SESSION')
 		return errstr
 
 	try:
@@ -3006,10 +3068,10 @@
 		try:
 			name = request.form['resourcename']
 		except:
-			luci_log.debug_verbose('delResource missing resname %s' % str(e))
+			luci_log.debug_verbose('delRes missing resname %s' % str(e))
 			return errstr + ': ' + str(e)
 	except:
-		luci_log.debug_verbose('delResource missing resname')
+		luci_log.debug_verbose('delRes missing resname')
 		return errstr + ': ' + str(e)
 
 	try:
@@ -3018,7 +3080,7 @@
 		try:
 			clustername = request.form['clustername']
 		except:
-			luci_log.debug_verbose('delResource missing cluster name')
+			luci_log.debug_verbose('delRes missing cluster name')
 			return errstr + ': could not determine the cluster name.'
 
 	try:
@@ -3039,20 +3101,20 @@
 			break
 
 	if not found:
-		luci_log.debug_verbose('delresource cant find res %s' % name)
+		luci_log.debug_verbose('delRes cant find res %s' % name)
 		return errstr + ': the specified resource was not found.'
 
 	try:
 		conf = modelb.exportModelAsString()
 		if not conf:
-			raise
-	except:
-		luci_log.debug_verbose('exportModelAsString failed')
+			raise Exception, 'model string is blank'
+	except Exception, e:
+		luci_log.debug_verbose('delRes: exportModelAsString failed: %s' % str(e))
 		return errstr
 
-	batch_number, result = setClusterConf(str(conf))
+	batch_number, result = setClusterConf(rc, str(conf))
 	if batch_number is None or result is None:
-		luci_log.debug_verbose('missing batch and/or result from setClusterConf')
+		luci_log.debug_verbose('delRes: missing batch and/or result from setClusterConf')
 		return errstr
 
 	modelstr = ""
@@ -3070,10 +3132,10 @@
 		flag.manage_addProperty(TASKTYPE, RESOURCE_REMOVE, "string")
 		flag.manage_addProperty(FLAG_DESC, "Removing Resource \'" + request['resourcename'] + "\'", "string")
 	except Exception, e:
-		luci_log.debug('An error occurred while setting flag %s: %s' \
+		luci_log.debug('delRes: An error occurred while setting flag %s: %s' \
 			% (objname, str(e)))
 	except:
-		luci_log.debug('An error occurred while setting flag %s' % objname)
+		luci_log.debug('delRes: An error occurred while setting flag %s' % objname)
 
 	response = request.RESPONSE
 	response.redirect(request['HTTP_REFERER'] + "&busyfirst=true")
@@ -3082,99 +3144,142 @@
 	if form is None:
 		form = request.form
 
+	if not form:
+		luci_log.debug_verbose('addIp error: form is missing')
+		return None
+
 	modelb = request.SESSION.get('model')
-	if not modelb or not form:
+	if not modelb:
+		luci_log.debug_verbose('addIp error: modelb is missing')
 		return None
 
 	if form.has_key('edit'):
 		try:
 			oldname = form['oldname'].strip()
 			if not oldname:
-				raise KeyError('oldname is blank.')
+				raise KeyError, 'oldname is blank.'
 			res = getResourceForEdit(modelb, oldname)
-		except KeyError, e:
+		except Exception, e:
+			luci_log.debug_verbose('addIp error: %s' % str(e))
 			return None
 	else:
-		res = apply(Ip)
+		try:
+			res = apply(Ip)
+			if not res:
+				raise Exception, 'apply(Ip) is None'
+		except Exception, e:
+			luci_log.debug_verbose('addIp error: %s' % str(e))
+			return None
 
 	if not res:
+		luci_log.debug_verbose('addIp error: res is none')
 		return None
 
+	errors = list()
 	try:
 		addr = form['ip_address'].strip()
 		if not addr:
-			raise KeyError('ip_address is blank')
+			raise KeyError, 'ip_address is blank'
 		# XXX: validate IP addr
 		res.attr_hash['address'] = addr
 	except KeyError, e:
-		return None
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addIp error: %s' % err)
 
 	if 'monitorLink' in form:
 		res.attr_hash['monitor_link'] = '1'
 	else:
 		res.attr_hash['monitor_link'] = '0'
 
-	modelb.getResourcesPtr().addChild(res)
-	return res
+	if len(errors) > 1:
+		return [None, None, errors]
+	return [res, modelb, None]
 
 def addFs(request, form=None):
 	if form is None:
 		form = request.form
-	modelb = request.SESSION.get('model')
 
-	if not modelb or not form:
+	if not form:
+		luci_log.debug_verbose('addFs error: form is missing')
+		return None
+
+	modelb = request.SESSION.get('model')
+	if not modelb:
+		luci_log.debug_verbose('addFs error: modelb is missing')
 		return None
 
 	if form.has_key('edit'):
 		try:
 			oldname = form['oldname'].strip()
 			if not oldname:
-				raise KeyError('oldname is blank.')
+				raise KeyError, 'oldname is blank.'
 			res = getResourceForEdit(modelb, oldname)
-		except KeyError, e:
+		except Exception, e:
+			luci_log.debug_verbose('addFs error: %s' % str(e))
 			return None
 	else:
-		res = apply(Fs)
+		try:
+			res = apply(Fs)
+			if not res:
+				raise Exception, 'apply(Fs) is None'
+		except Exception, e:
+			luci_log.debug_verbose('addFs error: %s' % str(e))
+			return None
 
 	if not res:
+		luci_log.debug_verbose('addFs error: fs obj was not created')
 		return None
 
 	# XXX: sanity check these fields
+	errors = list()
 	try:
 		name = form['resourceName'].strip()
 		res.attr_hash['name'] = name
-	except:
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addFs error: %s' % err)
 
 	try:
 		mountpoint = form['mountpoint'].strip()
 		res.attr_hash['mountpoint'] = mountpoint
-	except:
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addFs error: %s' % err)
 
 	try:
 		device = form['device'].strip()
 		res.attr_hash['device'] = device
-	except:
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addFs error: %s' % err)
 
 	try:
 		options = form['options'].strip()
 		res.attr_hash['options'] = options
-	except:
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addFs error: %s' % err)
 
 	try:
 		fstype = form['fstype'].strip()
 		res.attr_hash['fstype'] = fstype
-	except:
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addFs error: %s' % err)
 
 	try:
 		fsid = form['fsid'].strip()
 		res.attr_hash['fsid'] = fsid
-	except:
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addFs error: %s' % err)
 
 	if form.has_key('forceunmount'):
 		res.attr_hash['force_unmount'] = '1'
@@ -3191,27 +3296,33 @@
 	else:
 		res.attr_hash['force_fsck'] = '0'
 
-	modelb.getResourcesPtr().addChild(res)
-	return res
+	if len(errors) > 1:
+		return [None, None, errors]
+	return [res, modelb, None]
 
 def addGfs(request, form=None):
 	if form is None:
 		form = request.form
 
+	if not form:
+		luci_log.debug_verbose('addGfs error: form is missing')
+		return None
+
 	modelb = request.SESSION.get('model')
 	if not modelb:
+		luci_log.debug_verbose('addGfs error: modelb is missing')
 		return None
 
 	if form.has_key('edit'):
 		try:
 			oldname = form['oldname'].strip()
 			if not oldname:
-				raise KeyError('oldname is blank.')
+				raise KeyError, 'oldname is blank.'
 			res = getResourceForEdit(modelb, oldname)
 			if not res:
 				luci_log.debug('resource %s was not found for editing' % oldname)
 				return None
-		except KeyError, e:
+		except Exception, e:
 			luci_log.debug('resource %s was not found for editing: %s' \
 				% (oldname, str(e)))
 			return None
@@ -3219,286 +3330,387 @@
 		try:
 			res = apply(Clusterfs)
 			if not res:
-				raise
+				raise Exception, 'apply(Clusterfs) is None'
+		except Exception, e:
+			luci_log.debug('addGfs error: %s' % str(e))
+			return None
 		except:
-			luci_log.debug('Error creating node Clusterfs resource')
+			luci_log.debug('addGfs error')
 			return None
 
 	# XXX: sanity check these fields
+	errors = list()
 	try:
 		name = form['resourceName'].strip()
 		if not name:
-			raise
+			raise KeyError, 'resourceName is blank'
 		res.attr_hash['name'] = name
-	except:
-		luci_log.debug_verbose('name is missing in clusterfs res')
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addGfs error: %s' % err)
 
 	try:
 		mountpoint = form['mountpoint'].strip()
 		res.attr_hash['mountpoint'] = mountpoint
-	except:
-		luci_log.debug_verbose('mountpoint is missing in clusterfs res')
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addGfs error: %s' % err)
 
 	try:
 		device = form['device'].strip()
 		res.attr_hash['device'] = device
-	except:
-		luci_log.debug_verbose('device is missing in clusterfs res')
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addGfs error: %s' % err)
 
 	try:
 		options = form['options'].strip()
 		res.attr_hash['options'] = options
-	except:
-		luci_log.debug_verbose('options is missing in clusterfs res')
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addGfs error: %s' % err)
 
 	try:
 		fsid = form['fsid'].strip()
 		res.attr_hash['fsid'] = fsid
-	except:
-		luci_log.debug_verbose('fsid is missing in clusterfs res')
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addGfs error: %s' % err)
 
 	if form.has_key('forceunmount'):
 		res.attr_hash['force_unmount'] = '1'
 	else:
 		res.attr_hash['force_unmount'] = '0'
 
-	modelb.getResourcesPtr().addChild(res)
-	return res
+	if len(errors) > 1:
+		return [None, None, errors]
+	return [res, modelb, None]
 
 def addNfsm(request, form=None):
 	if form is None:
 		form = request.form
-	modelb = request.SESSION.get('model')
 
-	if not form or not modelb:
+	if not form:
+		luci_log.debug_verbose('addNfsm error: form is missing')
+		return None
+
+	modelb = request.SESSION.get('model')
+	if not modelb:
+		luci_log.debug_verbose('addNfsm error: modelb is missing')
 		return None
 
 	if form.has_key('edit'):
 		try:
 			oldname = form['oldname'].strip()
 			if not oldname:
-				raise KeyError('oldname is blank.')
+				raise KeyError, 'oldname is blank.'
 			res = getResourceForEdit(modelb, oldname)
-		except KeyError, e:
+		except Exception, e:
+			luci_log.debug_verbose('addNfsm error: %s' % str(e))
 			return None
 	else:
-		res = apply(Netfs)
+		try:
+			res = apply(Netfs)
+		except Exception, e:
+			luci_log.debug_verbose('addNfsm error: %s' % str(e))
+			return None
 
 	if not res:
 		return None
 
 	# XXX: sanity check these fields
+	errors = list()
 	try:
 		name = form['resourceName'].strip()
 		if not name:
-			raise
+			raise KeyError, 'resourceName is blank'
 		res.attr_hash['name'] = name
-	except:
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addNfsm error: %s' % err)
 
 	try:
 		mountpoint = form['mountpoint'].strip()
 		res.attr_hash['mountpoint'] = mountpoint
-	except:
-		return None
-
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addNfsm error: %s' % err)
+		
 	try:
 		host = form['host'].strip()
 		res.attr_hash['host'] = host
-	except:
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addNfsm error: %s' % err)
 
 	try:
 		options = form['options'].strip()
 		res.attr_hash['options'] = options
-	except:
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addNfsm error: %s' % err)
 
 	try:
 		exportpath = form['exportpath'].strip()
 		res.attr_hash['exportpath'] = exportpath 
-	except:
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addNfsm error: %s' % err)
 
 	try:
 		nfstype = form['nfstype'].strip().lower()
 		if nfstype != 'nfs' and nfstype != 'nfs4':
-			raise
+			raise KeyError, 'invalid nfs type: %s' % nfstype
 		res.attr_hash['nfstype'] = nfstype
-	except:
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addNfsm error: %s' % err)
 
 	if form.has_key('forceunmount'):
 		res.attr_hash['force_unmount'] = '1'
 	else:
 		res.attr_hash['force_unmount'] = '0'
 
-	modelb.getResourcesPtr().addChild(res)
-	return res
+	if len(errors) > 1:
+		return [None, None, errors]
+	return [res, modelb, None]
 
 def addNfsc(request, form=None):
 	if form is None:
 		form = request.form
-	modelb = request.SESSION.get('model')
 
-	if not form or not modelb:
+	if not form:
+		luci_log.debug_verbose('addNfsc error: form is missing')
+		return None
+
+	modelb = request.SESSION.get('model')
+	if not modelb:
+		luci_log.debug_verbose('addNfsc error: modelb is missing')
 		return None
 
 	if form.has_key('edit'):
 		try:
 			oldname = form['oldname'].strip()
 			if not oldname:
-				raise KeyError('oldname is blank.')
+				raise KeyError, 'oldname is blank.'
 			res = getResourceForEdit(modelb, oldname)
-		except KeyError, e:
+		except Exception, e:
+			luci_log.debug_verbose('addNfsc error: %s' % str(e))
 			return None
 	else:
-		res = apply(NFSClient)
+		try:
+			res = apply(NFSClient)
+		except:
+			luci_log.debug_verbose('addNfsc error: %s' % str(e))
+			return None
 
 	if not res:
+		luci_log.debug_verbose('addNfsc error: res is none')
 		return None
 
+	errors = list()
 	try:
 		name = form['resourceName'].strip()
 		if not name:
-			raise
+			raise KeyError, 'resourceName is blank'
 		res.attr_hash['name'] = name
-	except:
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addNfsc error: %s' % err)
 
 	try:
 		target = form['target'].strip()
 		res.attr_hash['target'] = target 
-	except:
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addNfsc error: %s' % err)
 
 	try:
 		options = form['options'].strip()
 		res.attr_hash['options'] = options
-	except:
-		return None
-
-	modelb.getResourcesPtr().addChild(res)
-	return res
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addNfsc error: %s' % err)
+
+	if len(errors) > 1:
+		return [None, None, errors]
+	return [res, modelb, None]
 
 def addNfsx(request, form=None):
 	if form is None:
 		form = request.form
-	modelb = request.SESSION.get('model')
 
-	if not modelb or not form:
+	if not form:
+		luci_log.debug_verbose('addNfsx error: modelb is missing')
+		return None
+
+	modelb = request.SESSION.get('model')
+	if not modelb:
+		luci_log.debug_verbose('addNfsx error: modelb is missing')
 		return None
 
 	if form.has_key('edit'):
 		try:
 			oldname = form['oldname'].strip()
 			if not oldname:
-				raise KeyError('oldname is blank.')
+				raise KeyError, 'oldname is blank.'
 			res = getResourceForEdit(modelb, oldname)
-		except KeyError, e:
+		except Exception, e:
+			luci_log.debug_verbose('addNfsx error: %s', str(e))
 			return None
 	else:
-		res = apply(NFSExport)
+		try:
+			res = apply(NFSExport)
+		except:
+			luci_log.debug_verbose('addNfsx error: %s', str(e))
+			return None
 
 	if not res:
+		luci_log.debug_verbose('addNfsx error: res is None')
 		return None
 
+	errors = list()
 	try:
 		name = form['resourceName'].strip()
 		if not name:
-			raise
+			raise KeyError, 'resourceName is blank'
 		res.attr_hash['name'] = name
-	except:
-		return None
-
-	modelb.getResourcesPtr().addChild(res)
-	return res
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addNfsx error: %s', err)
+
+	if len(errors) > 1:
+		return [None, None, errors]
+	return [res, modelb, None]
 
 def addScr(request, form=None):
 	if form is None:
 		form = request.form
-	modelb = request.SESSION.get('model')
-	form = request.form
 
-	if not modelb or not form:
+	if not form:
+		luci_log.debug_verbose('addScr error: form is missing')
+		return None
+
+	modelb = request.SESSION.get('model')
+	if not modelb:
+		luci_log.debug_verbose('addScr error: modelb is missing')
 		return None
 
 	if form.has_key('edit'):
 		try:
 			oldname = form['oldname'].strip()
 			if not oldname:
-				raise KeyError('oldname is blank.')
+				raise KeyError, 'oldname is blank.'
 			res = getResourceForEdit(modelb, oldname)
-		except KeyError, e:
+		except Exception, e:
+			luci_log.debug_verbose('addScr error: %s' % str(e))
 			return None
 	else:
-		res = apply(Script)
+		try:
+			res = apply(Script)
+		except Exception, e:
+			luci_log.debug_verbose('addScr error: %s' % str(e))
+			return None
 
 	if not res:
+		luci_log.debug_verbose('addScr error: res is None')
 		return None
 
+	errors = list()
 	try:
 		name = form['resourceName'].strip()
 		if not name:
-			raise
+			raise KeyError, 'resourceName is blank'
 		res.attr_hash['name'] = name
-	except:
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addScr error: %s' % err)
 
 	try:
 		file = form['file'].strip()
 		if not file:
-			raise
+			raise KeyError, 'file path is blank'
 		res.attr_hash['file'] = file
-	except:
-		return None
-
-	modelb.getResourcesPtr().addChild(res)
-	return res
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addScr error: %s' % err)
+
+	if len(errors) > 1:
+		return [None, None, errors]
+	return [res, modelb, None]
 
 def addSmb(request, form=None):
 	if form is None:
 		form = request.form
-	modelb = request.SESSION.get('model')
 
-	if not modelb or not form:
+	if not form:
+		luci_log.debug_verbose('addSmb error: form is missing')
+		return None
+
+	modelb = request.SESSION.get('model')
+	if not modelb:
+		luci_log.debug_verbose('addSmb error: modelb is missing')
 		return None
 
 	if form.has_key('edit'):
 		try:
 			oldname = form['oldname'].strip()
 			if not oldname:
-				raise KeyError('oldname is blank.')
+				raise KeyError, 'oldname is blank.'
 			res = getResourceForEdit(modelb, oldname)
-		except KeyError, e:
+		except Exception, e:
+			luci_log.debug_verbose('addSmb error: %s' % str(e))
 			return None
 	else:
-		res = apply(Samba)
+		try:
+			res = apply(Samba)
+		except Exception, e:
+			luci_log.debug_verbose('addSmb error: %s' % str(e))
+			return None
 
 	if not res:
+		luci_log.debug_verbose('addSmb error: res is None')
 		return None
 
+	errors = list()
 	try:
 		name = form['resourceName'].strip()
 		if not name:
-			raise
+			raise KeyError, 'resourceName is blank'
 		res.attr_hash['name'] = name
-	except:
-		return None
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addSmb error: %s' % err)
 
 	try:
 		workgroup = form['workgroup'].strip()
 		res.attr_hash['workgroup'] = workgroup
-	except:
-		return None
-
-	modelb.getResourcesPtr().addChild(res)
-	return res
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addSmb error: %s' % err)
+
+	if len(errors) > 1:
+		return [None, None, errors]
+	return [res, modelb, None]
 
 resourceAddHandler = {
 	'ip': addIp,
@@ -3581,48 +3793,37 @@
 	
 	return messages
 
-def addResource(self, rc, request):
-	if not request.form:
-		return (False, {'errors': ['No form was submitted.']})
-
-	try:
-		type = request.form['type'].strip()
-		if not type or not type in resourceAddHandler:
-			raise
-	except:
-		return (False, {'errors': ['Form type is missing.']})
+def addResource(self, request, modelb, res):
+	clustername = modelb.getClusterName()
+	if not clustername:
+		raise Exception, 'cluster name from modelb.getClusterName() is blank'
+
+	rc = getRicciAgent(self, clustername)
+	if not rc:
+		raise Exception, 'Unable to find a ricci agent for the %s cluster' % clustername
 
-	try:
-		resname = request.form['resourceName']
-	except KeyError, e:
-		# For IP, the IP address itself is the name.
-		if request.form['type'] != 'ip':
-			return (False, {'errors': ['No resource name was given.']})
+	modelb.getResourcesPtr().addChild(res)
 
 	try:
-		clustername = request['clustername']
-	except KeyError, e:
-		try:
-			clustername = request.form['clustername']
-		except:
-			return 'unable to determine the current cluster\'s name'
-
-	res = resourceAddHandler[type](request)
-	modelb = request.SESSION.get('model')
-	modelstr = ""
-	conf = modelb.exportModelAsString()
+		conf = modelb.exportModelAsString()
+		if not conf:
+			raise Exception, 'model string for %s is blank' % clustername
+	except Exception, e:
+		luci_log.debug_verbose('addResource: exportModelAsString err: %s' % str(e))
+		return 'An error occurred while adding this resource'
 
 	try:
 		ragent = rc.hostname()
 		if not ragent:
-			luci_log.debug('missing hostname')
-			raise
-		batch_number, result = setClusterConf(str(conf))
+			luci_log.debug_verbose('missing hostname')
+			raise Exception, 'unknown ricci agent hostname'
+		luci_log.debug_verbose('SENDING NEW CLUSTER CONF: %s' % conf)
+		batch_number, result = setClusterConf(rc, str(conf))
 		if batch_number is None or result is None:
-			luci_log.debug('missing batch_number or result')
-			raise
-	except:
-		return "Some error occured in setClusterConf\n"
+			luci_log.debug_verbose('missing batch_number or result')
+			raise Exception, 'batch_number or results is None from setClusterConf'
+	except Exception, e:
+		return 'An error occurred while propagating the new cluster.conf: %s' % str(e)
 
 	path = str(CLUSTER_FOLDER_PATH + clustername)
 	clusterfolder = self.restrictedTraverse(path)
@@ -3638,7 +3839,7 @@
 		flag.manage_addProperty(TASKTYPE, RESOURCE_ADD, "string")
 
 		if type != 'ip':
-			flag.manage_addProperty(FLAG_DESC, "Creating New Resource \'" + request.form['resourceName'] + "\'", "string")
+			flag.manage_addProperty(FLAG_DESC, "Creating New Resource \'" + res.attr_hash['name'] + "\'", "string")
 		else:
 			flag.manage_addProperty(FLAG_DESC, "Creating New Resource \'" + res.attr_hash['address'] + "\'", "string")
 	except Exception, e:
@@ -3667,7 +3868,7 @@
 		request.SESSION.set('model', model)
 	except:
 		luci_log.debug_verbose('Appending model to request failed')
-		return False
+		return 'An error occurred while storing the cluster model.' 
 
 def resolve_nodename(self, clustername, nodename):
 	path = str(CLUSTER_FOLDER_PATH + clustername)
--- conga/luci/site/luci/Extensions/ricci_bridge.py	2006/10/25 16:01:17	1.35
+++ conga/luci/site/luci/Extensions/ricci_bridge.py	2006/10/26 22:59:13	1.36
@@ -2,6 +2,12 @@
 from time import time, ctime
 from xml.dom import minidom
 from ricci_communicator import RicciCommunicator
+from LuciSyslog import LuciSyslog
+
+try:
+	luci_log = LuciSyslog()
+except:
+	pass
 
 def checkBatch(rc, batch_id):
 	try:
@@ -201,19 +207,28 @@
 	return minidom.parseString(batch).firstChild
 
 def batchAttemptResult(self, doc):
-	docc = None
-	rc_node = None
+	try:
+		batch = doc.getElementsByTagName('batch')
+		if not batch or len(batch) < 1:
+			raise Exception, 'no batch tag was found'
+	except Exception, e:
+		luci_log.debug_verbose('batchAttemptResult: %s' % str(e))
 
-	for node in doc.firstChild.childNodes:
-		if node.nodeType == xml.dom.Node.ELEMENT_NODE:
-			if node.nodeName == 'batch':
-				#get batch number and status code
-				batch_number = node.getAttribute('batch_id')
-				result = node.getAttribute('status')
-				return (batch_number, result)
-			else:
-				#print "RETURNING NONE!!!"
-				return (None, None)
+	for i in batch:
+		try:
+			batch_number = i.getAttribute('batch_id')
+			result = i.getAttribute('status')
+			return (batch_number, result)
+		except Exception, e:
+			luci_log.debug_verbose('batchAttemptResult: %s' % str(e))
+
+	try:
+		luci_log.debug_verbose('no batch with batchid and status found in \"%s\"' % doc.toxml())
+	except:
+		pass
+
+	return (None, None)
+	
 
 def getPayload(bt_node):
 	if not bt_node:
@@ -260,6 +275,17 @@
 	doc.appendChild(cl_node)
 	return doc
 
+def getClusterStatusBatch(rc):
+	batch_str ='<module name="cluster"><request API_version="1.0"><function_call name="status"/></request></module>'
+	ricci_xml = rc.batch_run(batch_str, async=False)
+
+	doc = getPayload(ricci_xml)
+	if not doc or not doc.firstChild:
+		luci_log.debug_verbose('doc is None from getPayload: %s' % ricci_xml.toxml())
+		return None
+
+	return doc
+
 def setClusterConf(rc, clusterconf, propagate=True):
 	if propagate == True:
 		propg = 'true'
@@ -274,10 +300,7 @@
 	batch_str = '<module name="cluster"><request API_version="1.0"><function_call name="set_cluster.conf"><var type="boolean" name="propagate" mutable="false" value="' + propg + '"/><var type="xml" mutable="false" name="cluster.conf">' + conf + '</var></function_call></request></module>'
 
 	ricci_xml = rc.batch_run(batch_str)
-	doc = getPayload(ricci_xml)
-	if not doc or not doc.firstChild:
-		return (None, None)
-	return batchAttemptResult(doc)
+	return batchAttemptResult(ricci_xml)
 
 def getNodeLogs(rc):
 	errstr = 'log not accessible'
@@ -334,10 +357,7 @@
 	batch_str = '<module name="reboot"><request sequence="111" API_version="1.0"><function_call name="reboot_now"/></request></module>'
 
 	ricci_xml = rc.batch_run(batch_str)
-	doc = getPayload(ricci_xml)
-	if not doc or not doc.firstChild:
-		return (None, None)
-	return batchAttemptResult(doc)
+	return batchAttemptResult(ricci_xml)
 
 def nodeLeaveCluster(rc, cluster_shutdown=False, purge=False):
 	cshutdown = 'false'
@@ -351,19 +371,13 @@
 	batch_str = '<module name="cluster"><request sequence="111" API_version="1.0"><function_call name="stop_node"><var mutable="false" name="cluster_shutdown" type="boolean" value="' + cshutdown + '"/><var mutable="false" name="purge_conf" type="boolean" value="' + purge_conf + '"/></function_call></request></module>'
 
 	ricci_xml = rc.batch_run(batch_str)
-	doc = getPayload(ricci_xml)
-	if not doc or not doc.firstChild:
-		return (None, None)
-	return batchAttemptResult(doc)
+	return batchAttemptResult(ricci_xml)
 
 def nodeFence(rc, nodename):
 	batch_str = '<module name="cluster"><request sequence="111" API_version="1.0"><function_call name="fence_node"><var mutable="false" name="nodename" type="string" value="' + nodename + '"/></function_call></request></module>'
 
 	ricci_xml = rc.batch_run(batch_str)
-	doc = getPayload(ricci_xml)
-	if not doc or not doc.firstChild:
-		return (None, None)
-	return batchAttemptResult(doc)
+	return batchAttemptResult(ricci_xml)
 
 def nodeJoinCluster(rc, cluster_startup=False):
 	cstartup = 'false'
@@ -373,10 +387,7 @@
 	batch_str = '<module name="cluster"><request sequence="111" API_version="1.0"><function_call name="start_node"><var mutable="false" name="cluster_startup" type="boolean" value="' + cstartup + '"/></function_call></request></module>'
 
 	ricci_xml = rc.batch_run(batch_str)
-	doc = getPayload(ricci_xml)
-	if not doc or not doc.firstChild:
-		return (None, None)
-	return batchAttemptResult(doc)
+	return batchAttemptResult(ricci_xml)
 
 def startService(rc, servicename, preferrednode=None):
 	if preferrednode != None:
@@ -385,28 +396,19 @@
 		batch_str = '<module name="cluster"><request sequence="1254" API_version="1.0"><function_call name="start_service"><var mutable="false" name="servicename" type="string" value=\"' + servicename + '\"/></function_call></request></module>'
 
 	ricci_xml = rc.batch_run(batch_str)
-	doc = getPayload(ricci_xml)
-	if not doc or not doc.firstChild:
-		return (None, None)
-	return batchAttemptResult(doc)
+	return batchAttemptResult(ricci_xml)
 
 def restartService(rc, servicename):
 	batch_str = '<module name="cluster"><request sequence="1254" API_version="1.0"><function_call name="restart_service"><var mutable="false" name="servicename" type="string" value=\"' + servicename + '\"/></function_call></request></module>'
 
 	ricci_xml = rc.batch_run(batch_str)
-	doc = getPayload(ricci_xml)
-	if not doc or not doc.firstChild:
-		return (None, None)
-	return batchAttemptResult(doc)
+	return batchAttemptResult(ricci_xml)
 
 def stopService(rc, servicename):
 	batch_str = '<module name="cluster"><request sequence="1254" API_version="1.0"><function_call name="stop_service"><var mutable="false" name="servicename" type="string" value=\"' + servicename + '\"/></function_call></request></module>'
 
 	ricci_xml = rc.batch_run(batch_str)
-	doc = getPayload(ricci_xml)
-	if not doc or not doc.firstChild:
-		return (None, None)
-	return batchAttemptResult(doc)
+	return batchAttemptResult(ricci_xml)
 
 def getDaemonStates(rc, dlist):
 	batch_str = '<module name="service"><request API_version="1.0"><function_call name="query"><var mutable="false" name="search" type="list_xml">'



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Cluster-devel] conga/luci/site/luci/Extensions ModelBuilder.p ...
@ 2007-01-10 21:36 jparsons
  0 siblings, 0 replies; 12+ messages in thread
From: jparsons @ 2007-01-10 21:36 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	jparsons at sourceware.org	2007-01-10 21:36:09

Modified files:
	luci/site/luci/Extensions: ModelBuilder.py TagObject.py 

Log message:
	small piece of 212021 that enables ui when bad tags are passed in - prevents button lockup

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/TagObject.py.diff?cvsroot=cluster&r1=1.1&r2=1.2

--- conga/luci/site/luci/Extensions/ModelBuilder.py	2007/01/10 19:11:16	1.12
+++ conga/luci/site/luci/Extensions/ModelBuilder.py	2007/01/10 21:36:09	1.13
@@ -122,6 +122,7 @@
     self.isModified = False
     self.quorumd_ptr = None
     self.usesQuorumd = False
+    self.unusual_items = list()
     self.isVirtualized = False
     if mcast_addr == None:
       self.usesMulticast = False
@@ -137,6 +138,7 @@
       self.purgePCDuplicates()
       self.resolve_references()
       self.check_for_multicast()
+      self.check_for_nodeids()
     else:
       if filename == None:
         if lock_type == DLM_TYPE:
@@ -160,7 +162,7 @@
         self.check_for_multicast()
 
 
-  def buildModel(self, parent_node):
+  def buildModel(self, parent_node, parent_object=None):
 
     if parent_node == None:
       parent_node = self.parent
@@ -178,8 +180,22 @@
           attrNode = attrs.get(attrName)
           attrValue = attrNode.nodeValue
           new_object.addAttribute(attrName,attrValue)
-      except KeyError, k:
+      except KeyError, k: ##This allows for custom tags
+        new_object = TagObject(parent_node.nodeName)
+        attrs = parent_node.attributes
+        for attrName in attrs.keys():
+          attrNode = attrs.get(attrName)
+          attrValue = attrNode.nodeValue
+          new_object.addAttribute(attrName, attrValue)
+        self.unusual_items.append((parent_object, new_object))
+        for item in parent_node.childNodes:
+          result_object = self.buildModel(item, new_object)
+          if result_object != None:
+            new_object.addChild(result_object)
         return None
+
+       ######End of unusual item exception
+
       if parent_node.nodeName == CLUSTER_PTR_STR:
         self.cluster_ptr = new_object
       if parent_node.nodeName == CLUSTERNODES_PTR_STR:
@@ -210,7 +226,7 @@
 
 
     for item in parent_node.childNodes:
-      result_object = self.buildModel(item)
+      result_object = self.buildModel(item,new_object)
       if result_object != None:
         new_object.addChild(result_object)
 
@@ -422,6 +438,7 @@
     
     #check for dual power fences
     self.dual_power_fence_check()
+    self.restore_unusual_items()
 
     try:
 
@@ -431,15 +448,70 @@
 
       self.isModified = False
 
+    ##Need to restore model
+      self.parent = doc
+
+      self.object_tree = self.buildModel(None)
+      self.check_empty_ptrs()
+      self.check_fence_daemon()
+      self.resolve_fence_instance_types()
+      self.purgePCDuplicates()
+      self.resolve_references()
+      self.check_for_multicast() 
+
     finally:
+      pass
       #dual_power_fence_check() adds extra
       #fence instance entries for dual power controllers
       #These must be removed from the tree before the UI
       #can be used
-      self.purgePCDuplicates()
+      #self.purgePCDuplicates()
 
     return strbuf
-  
+
+  def restore_unusual_items(self):
+    for item in self.unusual_items:
+      duplicate = False
+      kids = item[0].getChildren()
+      for kid in kids:
+        if kid == item[1]:
+          duplicate = True
+          break
+      if duplicate == True:
+        continue
+      else:
+        item[0].addChild(item[1]) 
+
+  def check_for_nodeids(self):
+    nodes = self.getNodes()
+    for node in nodes:
+      if node.getAttribute('nodeid') == None:
+        new_id = self.getUniqueNodeID()
+        node.addAttribute('nodeid',new_id)
+                                                                                
+  def getUniqueNodeID(self):
+    nodes = self.getNodes()
+    total_nodes = len(nodes)
+    dex_list = list()
+    for nd_idx in range (1, (total_nodes + 3)):
+      dex_list.append(str(nd_idx))
+                                                                                
+    for dex in dex_list:
+      found = False
+      for node in nodes:
+        ndid = node.getAttribute('nodeid')
+        if ndid != None:
+          if ndid == dex:
+            found = True
+            break
+        else:
+          continue
+                                                                                
+      if found == True:
+        continue
+      else:
+        return dex
+ 
   def has_filepath(self):
     if self.filename == None:
       return False
--- conga/luci/site/luci/Extensions/TagObject.py	2006/05/30 20:17:21	1.1
+++ conga/luci/site/luci/Extensions/TagObject.py	2007/01/10 21:36:09	1.2
@@ -3,10 +3,13 @@
 TAG_NAME = "document"
 
 class TagObject:
-  def __init__(self):
+  def __init__(self, tagname=None):
     self.attr_hash = {}
     self.children = list()
-    self.TAG_NAME = TAG_NAME
+    if tagname == None:
+      self.TAG_NAME = TAG_NAME
+    else:
+      self.TAG_NAME = tagname
 
   def addChild(self, child):
     #print "in AddChild, adding child %s" % child.getName()



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Cluster-devel] conga/luci/site/luci/Extensions ModelBuilder.p ...
@ 2007-01-10 21:48 kupcevic
  0 siblings, 0 replies; 12+ messages in thread
From: kupcevic @ 2007-01-10 21:48 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	kupcevic at sourceware.org	2007-01-10 21:48:26

Modified files:
	luci/site/luci/Extensions: ModelBuilder.py TagObject.py 

Log message:
	small piece of 212021 that enables ui when bad tags are passed in - prevents button lockup

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8.2.4&r2=1.8.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/TagObject.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1&r2=1.1.2.1

--- conga/luci/site/luci/Extensions/ModelBuilder.py	2007/01/10 19:26:56	1.8.2.4
+++ conga/luci/site/luci/Extensions/ModelBuilder.py	2007/01/10 21:48:26	1.8.2.5
@@ -122,6 +122,7 @@
     self.isModified = False
     self.quorumd_ptr = None
     self.usesQuorumd = False
+    self.unusual_items = list()
     self.isVirtualized = False
     if mcast_addr == None:
       self.usesMulticast = False
@@ -137,6 +138,7 @@
       self.purgePCDuplicates()
       self.resolve_references()
       self.check_for_multicast()
+      self.check_for_nodeids()
     else:
       if filename == None:
         if lock_type == DLM_TYPE:
@@ -160,7 +162,7 @@
         self.check_for_multicast()
 
 
-  def buildModel(self, parent_node):
+  def buildModel(self, parent_node, parent_object=None):
 
     if parent_node == None:
       parent_node = self.parent
@@ -178,8 +180,22 @@
           attrNode = attrs.get(attrName)
           attrValue = attrNode.nodeValue
           new_object.addAttribute(attrName,attrValue)
-      except KeyError, k:
+      except KeyError, k: ##This allows for custom tags
+        new_object = TagObject(parent_node.nodeName)
+        attrs = parent_node.attributes
+        for attrName in attrs.keys():
+          attrNode = attrs.get(attrName)
+          attrValue = attrNode.nodeValue
+          new_object.addAttribute(attrName, attrValue)
+        self.unusual_items.append((parent_object, new_object))
+        for item in parent_node.childNodes:
+          result_object = self.buildModel(item, new_object)
+          if result_object != None:
+            new_object.addChild(result_object)
         return None
+
+       ######End of unusual item exception
+
       if parent_node.nodeName == CLUSTER_PTR_STR:
         self.cluster_ptr = new_object
       if parent_node.nodeName == CLUSTERNODES_PTR_STR:
@@ -210,7 +226,7 @@
 
 
     for item in parent_node.childNodes:
-      result_object = self.buildModel(item)
+      result_object = self.buildModel(item,new_object)
       if result_object != None:
         new_object.addChild(result_object)
 
@@ -422,6 +438,7 @@
     
     #check for dual power fences
     self.dual_power_fence_check()
+    self.restore_unusual_items()
 
     try:
 
@@ -431,15 +448,70 @@
 
       self.isModified = False
 
+    ##Need to restore model
+      self.parent = doc
+
+      self.object_tree = self.buildModel(None)
+      self.check_empty_ptrs()
+      self.check_fence_daemon()
+      self.resolve_fence_instance_types()
+      self.purgePCDuplicates()
+      self.resolve_references()
+      self.check_for_multicast() 
+
     finally:
+      pass
       #dual_power_fence_check() adds extra
       #fence instance entries for dual power controllers
       #These must be removed from the tree before the UI
       #can be used
-      self.purgePCDuplicates()
+      #self.purgePCDuplicates()
 
     return strbuf
-  
+
+  def restore_unusual_items(self):
+    for item in self.unusual_items:
+      duplicate = False
+      kids = item[0].getChildren()
+      for kid in kids:
+        if kid == item[1]:
+          duplicate = True
+          break
+      if duplicate == True:
+        continue
+      else:
+        item[0].addChild(item[1]) 
+
+  def check_for_nodeids(self):
+    nodes = self.getNodes()
+    for node in nodes:
+      if node.getAttribute('nodeid') == None:
+        new_id = self.getUniqueNodeID()
+        node.addAttribute('nodeid',new_id)
+                                                                                
+  def getUniqueNodeID(self):
+    nodes = self.getNodes()
+    total_nodes = len(nodes)
+    dex_list = list()
+    for nd_idx in range (1, (total_nodes + 3)):
+      dex_list.append(str(nd_idx))
+                                                                                
+    for dex in dex_list:
+      found = False
+      for node in nodes:
+        ndid = node.getAttribute('nodeid')
+        if ndid != None:
+          if ndid == dex:
+            found = True
+            break
+        else:
+          continue
+                                                                                
+      if found == True:
+        continue
+      else:
+        return dex
+ 
   def has_filepath(self):
     if self.filename == None:
       return False
--- conga/luci/site/luci/Extensions/TagObject.py	2006/05/30 20:17:21	1.1
+++ conga/luci/site/luci/Extensions/TagObject.py	2007/01/10 21:48:26	1.1.2.1
@@ -3,10 +3,13 @@
 TAG_NAME = "document"
 
 class TagObject:
-  def __init__(self):
+  def __init__(self, tagname=None):
     self.attr_hash = {}
     self.children = list()
-    self.TAG_NAME = TAG_NAME
+    if tagname == None:
+      self.TAG_NAME = TAG_NAME
+    else:
+      self.TAG_NAME = tagname
 
   def addChild(self, child):
     #print "in AddChild, adding child %s" % child.getName()



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Cluster-devel] conga/luci/site/luci/Extensions ModelBuilder.p ...
@ 2007-01-23 14:01 rmccabe
  0 siblings, 0 replies; 12+ messages in thread
From: rmccabe @ 2007-01-23 14:01 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-01-23 14:01:03

Modified files:
	luci/site/luci/Extensions: ModelBuilder.py 
Removed files:
	luci/site/luci/Extensions: CommandHandler.py MessageLibrary.py 

Log message:
	get rid of traces of GTK

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/CommandHandler.py.diff?cvsroot=cluster&r1=1.1&r2=NONE
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/MessageLibrary.py.diff?cvsroot=cluster&r1=1.1&r2=NONE

--- conga/luci/site/luci/Extensions/ModelBuilder.py	2007/01/15 21:29:53	1.14
+++ conga/luci/site/luci/Extensions/ModelBuilder.py	2007/01/23 14:01:02	1.15
@@ -40,7 +40,6 @@
 from FailoverDomainNode import FailoverDomainNode
 from Rm import Rm
 from Heuristic import Heuristic
-from CommandHandler import CommandHandler
 from CommandError import CommandError
 from GeneralError import GeneralError
 from clui_constants import *
@@ -118,7 +117,6 @@
     self.resourcemanager_ptr = None
     self.resources_ptr = None
     self.fence_daemon_ptr = None
-    self.command_handler = CommandHandler()
     self.isModified = False
     self.quorumd_ptr = None
     self.usesQuorumd = False
@@ -521,9 +519,6 @@
   def getFilepath(self):
     return self.filename
 
-  def isClusterMember(self):
-    return self.command_handler.isClusterMember()
-
   def setIsVirtualized(self,isVirtualized):
     if isVirtualized == None:
       self.isVirtualized = False
@@ -1032,7 +1027,6 @@
     if self.getLockType() == GULM_TYPE:
       gulm_count = len(self.getGULMPtr().getChildren())
       if not (gulm_count in (1, 3, 4, 5)):
-        MessageLibrary.errorMessage(INVALID_GULM_COUNT % gulm_count)
         return False
     return True
 



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Cluster-devel] conga/luci/site/luci/Extensions ModelBuilder.p ...
@ 2007-01-23 14:05 rmccabe
  0 siblings, 0 replies; 12+ messages in thread
From: rmccabe @ 2007-01-23 14:05 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-01-23 14:05:26

Modified files:
	luci/site/luci/Extensions: ModelBuilder.py 
Removed files:
	luci/site/luci/Extensions: CommandError.py ValidationError.py 

Log message:
	cruft removal

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/CommandError.py.diff?cvsroot=cluster&r1=1.1&r2=NONE
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ValidationError.py.diff?cvsroot=cluster&r1=1.1&r2=NONE

--- conga/luci/site/luci/Extensions/ModelBuilder.py	2007/01/23 14:01:02	1.15
+++ conga/luci/site/luci/Extensions/ModelBuilder.py	2007/01/23 14:05:25	1.16
@@ -40,7 +40,6 @@
 from FailoverDomainNode import FailoverDomainNode
 from Rm import Rm
 from Heuristic import Heuristic
-from CommandError import CommandError
 from GeneralError import GeneralError
 from clui_constants import *
 import MessageLibrary



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Cluster-devel] conga/luci/site/luci/Extensions ModelBuilder.p ...
@ 2007-02-15 18:55 rmccabe
  0 siblings, 0 replies; 12+ messages in thread
From: rmccabe @ 2007-02-15 18:55 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-02-15 18:55:36

Modified files:
	luci/site/luci/Extensions: ModelBuilder.py 
Added files:
	luci/site/luci/Extensions: Totem.py 

Log message:
	Add explicit support for the totem cluster.conf tag

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Totem.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&r1=1.22&r2=1.23

/cvs/cluster/conga/luci/site/luci/Extensions/Totem.py,v  -->  standard output
revision 1.1
--- conga/luci/site/luci/Extensions/Totem.py
+++ -	2007-02-15 18:55:37.264108000 +0000
@@ -0,0 +1,9 @@
+import string
+from TagObject import TagObject
+
+TAG_NAME = "totem"
+
+class Totem(TagObject):
+  def __init__(self):
+    TagObject.__init__(self)
+    self.TAG_NAME = TAG_NAME 
--- conga/luci/site/luci/Extensions/ModelBuilder.py	2007/02/08 02:34:36	1.22
+++ conga/luci/site/luci/Extensions/ModelBuilder.py	2007/02/15 18:55:34	1.23
@@ -17,6 +17,7 @@
 from Method import Method
 from Device import Device
 from Cman import Cman
+from Totem import Totem
 from Gulm import Gulm
 from Lockserver import Lockserver
 from Ip import Ip
@@ -52,6 +53,7 @@
            'fencedevices':FenceDevices,
            'method':Method,
            'cman':Cman,
+           'totem':Totem,
            'gulm':Gulm,
            'lockserver':Lockserver,
            'rm':Rm,
@@ -91,6 +93,7 @@
 GULM_TAG_STR="gulm"
 MCAST_STR="multicast"
 CMAN_PTR_STR="cman"
+TOTEM_PTR_STR="totem"
 QUORUMD_PTR_STR="quorumd"
 ###-----------------------------------
 
@@ -113,6 +116,7 @@
     self.cluster_ptr = None
     self.GULM_ptr = None
     self.CMAN_ptr = None
+    self.TOTEM_ptr = None
     self.clusternodes_ptr = None
     self.failoverdomains_ptr = None
     self.fencedevices_ptr = None
@@ -219,6 +223,8 @@
         self.lock_type = GULM_TYPE
       elif parent_node.nodeName == CMAN_PTR_STR:
         self.CMAN_ptr = new_object
+      elif parent_node.nodeName == TOTEM_PTR_STR:
+        self.TOTEM_ptr = new_object
       elif parent_node.nodeName == MCAST_STR:
         self.usesMulticast = True
       elif parent_node.nodeName == FENCE_XVMD_STR:
@@ -597,6 +603,17 @@
 
     raise GeneralError('FATAL',"Couldn't find VM name %s in current list" % name)
 
+  def del_totem(self):
+    if self.TOTEM_ptr is not None:
+      self.cluster_ptr.removeChild(self.TOTEM_ptr)
+      self.TOTEM_ptr = None
+
+  def add_totem(self, obj):
+    self.del_totem()
+    if self.TOTEM_ptr is None:
+      self.cluster_ptr.addChild(obj)
+      self.TOTEM_ptr = obj
+
   def hasFenceXVM(self):
     return self.fence_xvmd_ptr is not None
 
@@ -839,6 +856,8 @@
     if self.lock_type == DLM_TYPE:
       #remove <cman>
       self.cluster_ptr.removeChild(self.CMAN_ptr)
+      if self.TOTEM_ptr is not None:
+        self.del_totem()
       self.CMAN_ptr = None
 
       #add gulm tag



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Cluster-devel] conga/luci/site/luci/Extensions ModelBuilder.p ...
@ 2007-05-11  2:36 rmccabe
  0 siblings, 0 replies; 12+ messages in thread
From: rmccabe @ 2007-05-11  2:36 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-05-11 02:36:44

Modified files:
	luci/site/luci/Extensions: ModelBuilder.py 
Added files:
	luci/site/luci/Extensions: SAPDatabase.py SAPInstance.py 

Log message:
	Add SAPDatabase and SAPInstance resource agent support to the cluster model.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/SAPDatabase.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/SAPInstance.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&r1=1.26&r2=1.27

/cvs/cluster/conga/luci/site/luci/Extensions/SAPDatabase.py,v  -->  standard output
revision 1.1
--- conga/luci/site/luci/Extensions/SAPDatabase.py
+++ -	2007-05-11 02:36:45.150800000 +0000
@@ -0,0 +1,13 @@
+from BaseResource import BaseResource
+
+import gettext
+_ = gettext.gettext
+
+TAG_NAME = "SAPDatabase"
+RESOURCE_TYPE = _("SAP Database")
+
+class SAPDatabase(BaseResource):
+  def __init__(self):
+    BaseResource.__init__(self)
+    self.TAG_NAME = TAG_NAME
+    self.resource_type = RESOURCE_TYPE
/cvs/cluster/conga/luci/site/luci/Extensions/SAPInstance.py,v  -->  standard output
revision 1.1
--- conga/luci/site/luci/Extensions/SAPInstance.py
+++ -	2007-05-11 02:36:45.277270000 +0000
@@ -0,0 +1,13 @@
+from BaseResource import BaseResource
+
+import gettext
+_ = gettext.gettext
+
+TAG_NAME = "SAPInstance"
+RESOURCE_TYPE = _("SAP Instance")
+
+class SAPInstance(BaseResource):
+  def __init__(self):
+    BaseResource.__init__(self)
+    self.TAG_NAME = TAG_NAME
+    self.resource_type = RESOURCE_TYPE
--- conga/luci/site/luci/Extensions/ModelBuilder.py	2007/03/15 22:08:42	1.26
+++ conga/luci/site/luci/Extensions/ModelBuilder.py	2007/05/11 02:36:44	1.27
@@ -1,12 +1,6 @@
-#!/usr/bin/python
-#import xml.dom.minidom
 from xml.dom import minidom, Node
 import string
 import os
-#import sys
-#directory = os.path.dirname(__file__)
-#from Cluster import Cluster
-#sys.path.append(directory)
 from TagObject import TagObject
 from Cluster import Cluster
 from ClusterNode import ClusterNode
@@ -32,6 +26,8 @@
 from OpenLDAP import OpenLDAP
 from Postgres8 import Postgres8
 from Tomcat5 import Tomcat5
+from SAPInstance import SAPInstance
+from SAPDatabase import SAPDatabase
 from Multicast import Multicast
 from FenceDaemon import FenceDaemon
 from FenceXVMd import FenceXVMd
@@ -79,6 +75,8 @@
            'openldap':OpenLDAP,
            'postgres-8':Postgres8,
            'tomcat-5':Tomcat5,
+           'SAPDatabase':SAPDatabase,
+           'SAPInstance':SAPInstance,
            'fence_daemon':FenceDaemon,
            'multicast':Multicast,
            'clusterfs':Clusterfs,
@@ -1169,12 +1167,3 @@
     self.object_tree.searchTree(objlist, tagtype)
 
     return objlist
- 
-   
-if __name__ == "__main__":
-  print "Starting main program"
-  mdl = ModelBuilder()
-  objs = mdl.buildModel(None)
-
-  mdl.exportModel("/tmp/tags.xml",objs)
- 



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Cluster-devel] conga/luci/site/luci/Extensions ModelBuilder.p ...
@ 2007-05-11  2:38 rmccabe
  0 siblings, 0 replies; 12+ messages in thread
From: rmccabe @ 2007-05-11  2:38 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe at sourceware.org	2007-05-11 02:38:08

Modified files:
	luci/site/luci/Extensions: ModelBuilder.py 
Added files:
	luci/site/luci/Extensions: SAPDatabase.py SAPInstance.py 

Log message:
	Add SAPDatabase and SAPInstance resource agent support to the cluster model.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/SAPDatabase.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/SAPInstance.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8.2.8&r2=1.8.2.9

/cvs/cluster/conga/luci/site/luci/Extensions/SAPDatabase.py,v  -->  standard output
revision 1.1.2.1
--- conga/luci/site/luci/Extensions/SAPDatabase.py
+++ -	2007-05-11 02:38:09.885976000 +0000
@@ -0,0 +1,13 @@
+from BaseResource import BaseResource
+
+import gettext
+_ = gettext.gettext
+
+TAG_NAME = "SAPDatabase"
+RESOURCE_TYPE = _("SAP Database")
+
+class SAPDatabase(BaseResource):
+  def __init__(self):
+    BaseResource.__init__(self)
+    self.TAG_NAME = TAG_NAME
+    self.resource_type = RESOURCE_TYPE
/cvs/cluster/conga/luci/site/luci/Extensions/SAPInstance.py,v  -->  standard output
revision 1.1.2.1
--- conga/luci/site/luci/Extensions/SAPInstance.py
+++ -	2007-05-11 02:38:09.993046000 +0000
@@ -0,0 +1,13 @@
+from BaseResource import BaseResource
+
+import gettext
+_ = gettext.gettext
+
+TAG_NAME = "SAPInstance"
+RESOURCE_TYPE = _("SAP Instance")
+
+class SAPInstance(BaseResource):
+  def __init__(self):
+    BaseResource.__init__(self)
+    self.TAG_NAME = TAG_NAME
+    self.resource_type = RESOURCE_TYPE
--- conga/luci/site/luci/Extensions/ModelBuilder.py	2007/03/15 22:11:28	1.8.2.8
+++ conga/luci/site/luci/Extensions/ModelBuilder.py	2007/05/11 02:38:08	1.8.2.9
@@ -1,12 +1,6 @@
-#!/usr/bin/python
-#import xml.dom.minidom
 from xml.dom import minidom, Node
 import string
 import os
-#import sys
-#directory = os.path.dirname(__file__)
-#from Cluster import Cluster
-#sys.path.append(directory)
 from TagObject import TagObject
 from Cluster import Cluster
 from ClusterNode import ClusterNode
@@ -32,6 +26,8 @@
 from OpenLDAP import OpenLDAP
 from Postgres8 import Postgres8
 from Tomcat5 import Tomcat5
+from SAPInstance import SAPInstance
+from SAPDatabase import SAPDatabase
 from Multicast import Multicast
 from FenceDaemon import FenceDaemon
 from FenceXVMd import FenceXVMd
@@ -79,6 +75,8 @@
            'openldap':OpenLDAP,
            'postgres-8':Postgres8,
            'tomcat-5':Tomcat5,
+           'SAPDatabase':SAPDatabase,
+           'SAPInstance':SAPInstance,
            'fence_daemon':FenceDaemon,
            'multicast':Multicast,
            'clusterfs':Clusterfs,
@@ -1169,12 +1167,3 @@
     self.object_tree.searchTree(objlist, tagtype)
 
     return objlist
- 
-   
-if __name__ == "__main__":
-  print "Starting main program"
-  mdl = ModelBuilder()
-  objs = mdl.buildModel(None)
-
-  mdl.exportModel("/tmp/tags.xml",objs)
- 



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Cluster-devel] conga/luci/site/luci/Extensions ModelBuilder.p ...
@ 2007-05-11  2:38 rmccabe
  0 siblings, 0 replies; 12+ messages in thread
From: rmccabe @ 2007-05-11  2:38 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL4
Changes by:	rmccabe at sourceware.org	2007-05-11 02:38:58

Modified files:
	luci/site/luci/Extensions: ModelBuilder.py 
Added files:
	luci/site/luci/Extensions: SAPDatabase.py SAPInstance.py 

Log message:
	Add SAPDatabase and SAPInstance resource agent support to the cluster model.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/SAPDatabase.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=NONE&r2=1.1.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/SAPInstance.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=NONE&r2=1.1.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.19.2.5&r2=1.19.2.6

/cvs/cluster/conga/luci/site/luci/Extensions/SAPDatabase.py,v  -->  standard output
revision 1.1.4.1
--- conga/luci/site/luci/Extensions/SAPDatabase.py
+++ -	2007-05-11 02:38:58.561211000 +0000
@@ -0,0 +1,13 @@
+from BaseResource import BaseResource
+
+import gettext
+_ = gettext.gettext
+
+TAG_NAME = "SAPDatabase"
+RESOURCE_TYPE = _("SAP Database")
+
+class SAPDatabase(BaseResource):
+  def __init__(self):
+    BaseResource.__init__(self)
+    self.TAG_NAME = TAG_NAME
+    self.resource_type = RESOURCE_TYPE
/cvs/cluster/conga/luci/site/luci/Extensions/SAPInstance.py,v  -->  standard output
revision 1.1.4.1
--- conga/luci/site/luci/Extensions/SAPInstance.py
+++ -	2007-05-11 02:38:58.646496000 +0000
@@ -0,0 +1,13 @@
+from BaseResource import BaseResource
+
+import gettext
+_ = gettext.gettext
+
+TAG_NAME = "SAPInstance"
+RESOURCE_TYPE = _("SAP Instance")
+
+class SAPInstance(BaseResource):
+  def __init__(self):
+    BaseResource.__init__(self)
+    self.TAG_NAME = TAG_NAME
+    self.resource_type = RESOURCE_TYPE
--- conga/luci/site/luci/Extensions/ModelBuilder.py	2007/03/15 22:09:58	1.19.2.5
+++ conga/luci/site/luci/Extensions/ModelBuilder.py	2007/05/11 02:38:58	1.19.2.6
@@ -1,12 +1,6 @@
-#!/usr/bin/python
-#import xml.dom.minidom
 from xml.dom import minidom, Node
 import string
 import os
-#import sys
-#directory = os.path.dirname(__file__)
-#from Cluster import Cluster
-#sys.path.append(directory)
 from TagObject import TagObject
 from Cluster import Cluster
 from ClusterNode import ClusterNode
@@ -32,6 +26,8 @@
 from OpenLDAP import OpenLDAP
 from Postgres8 import Postgres8
 from Tomcat5 import Tomcat5
+from SAPInstance import SAPInstance
+from SAPDatabase import SAPDatabase
 from Multicast import Multicast
 from FenceDaemon import FenceDaemon
 from FenceXVMd import FenceXVMd
@@ -79,6 +75,8 @@
            'openldap':OpenLDAP,
            'postgres-8':Postgres8,
            'tomcat-5':Tomcat5,
+           'SAPDatabase':SAPDatabase,
+           'SAPInstance':SAPInstance,
            'fence_daemon':FenceDaemon,
            'multicast':Multicast,
            'clusterfs':Clusterfs,
@@ -1169,12 +1167,3 @@
     self.object_tree.searchTree(objlist, tagtype)
 
     return objlist
- 
-   
-if __name__ == "__main__":
-  print "Starting main program"
-  mdl = ModelBuilder()
-  objs = mdl.buildModel(None)
-
-  mdl.exportModel("/tmp/tags.xml",objs)
- 



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-05-11  2:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-11  2:36 [Cluster-devel] conga/luci/site/luci/Extensions ModelBuilder.p rmccabe
  -- strict thread matches above, loose matches on Subject: below --
2007-05-11  2:38 rmccabe
2007-05-11  2:38 rmccabe
2007-02-15 18:55 rmccabe
2007-01-23 14:05 rmccabe
2007-01-23 14:01 rmccabe
2007-01-10 21:48 kupcevic
2007-01-10 21:36 jparsons
2006-10-26 22:59 rmccabe
2006-10-24 15:05 jparsons
2006-10-24  1:42 jparsons
2006-10-06 21:08 rmccabe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).