Skip to contentSkip to conversation

conga/luci/site/luci/Extensions LuciClusterInf ...

Cluster-devel [email protected] 1 participant 1 message May 30, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Branch: EXPERIMENTAL
Changes by: rmccabe at sourceware.org 2007-05-30 22:06:24

Modified files:
luci/site/luci/Extensions: LuciClusterInfo.py LuciDB.py
LuciZope.py LuciZopeExternal.py Variable.py cluster_adapters.py storage_adapters.py
Added files:
luci/site/luci/Extensions: LuciZopeClusterPortal.py

Log message:
More cleanup and refactor

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopeClusterPortal.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.6&r2=1.1.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciDB.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.13&r2=1.1.2.14
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZope.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.7&r2=1.1.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopeExternal.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.3&r2=1.1.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Variable.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.4.8.3&r2=1.4.8.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.255.2.11&r2=1.255.2.12
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/storage_adapters.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.9.4.3&r2=1.9.4.4

luci/site/luci/Extensions/Attic/LuciClusterInfo.py +22 -0
@@ -1585,3 +1585,25 @@
 		return None
 
 	return model
+
+def getClusterOS(self, rc):
+	from HelperFunctions import resolveOSType
+
+	clu_map = {}
+
+	try:
+		os_str = resolveOSType(rc.os())
+		clu_map['os'] = os_str
+		clu_map['isVirtualized'] = rc.dom0()
+	except:
+		# default to rhel5 if something crazy happened.
+		try:
+			if LUCI_DEBUG_MODE is True:
+				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
+		clu_map['os'] = 'rhel5'
+		clu_map['isVirtualized'] = False
+	return clu_map
luci/site/luci/Extensions/Attic/LuciDB.py +32 -0
@@ -864,6 +864,38 @@
 		return []
 	return nodelist
 
+def getClusterDBVersion(cluster_folder):
+	try:
+		cluster_os = str(cluster_folder.getProperty('cluster_os'))
+		if not cluster_os:
+			raise Exception, 'cluster os is blank'
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('GCDBV0: %s: %r %s' \
+				% (cluster_folder.getId(), e, str(e)))
+		cluster_os = None
+	return cluster_os
+
+def setClusterDBVersion(cluster_folder, version_str):
+	if cluster_folder.getProperty('cluster_os') is None:
+		try:
+			cluster_folder.manage_addProperty('cluster_os',
+				version_str, 'string')
+		except Exception, e:
+			if LUCI_DEBUG_MODE is True:
+				luci_log.debug_verbose('SCDBV0: %s: %r %s' \
+					% (cluster_folder.getId(), e, str(e)))
+			return None
+	else:
+		try:
+			cluster_folder.manage_changeProperties({'cluster_os': version_str })
+		except Exception, e:
+			if LUCI_DEBUG_MODE is True:
+				luci_log.debug_verbose('SCDBV1: %s: %r %s' \
+					% (cluster_folder.getId(), e, str(e)))
+			return None
+	return True
+
 def getClusterFlags(self, cluname):
 	try:
 		path = '%s%s' % (CLUSTER_FOLDER_PATH, cluname)
luci/site/luci/Extensions/Attic/LuciZope.py +16 -0
@@ -124,3 +124,19 @@
 			luci_log.debug_verbose('Appending model to request failed: %r %s' \
 				% (e, str(e)))
 		return 'An error occurred while storing the cluster model'
+
+def GetReqVars(req, varlist):
+	ret = {}
+	for i in varlist:
+		pval = None
+		if req.has_key(i):
+			pval = req[i].strip()
+			if not pval:
+				pval = None
+		if pval is None:
+			if req.form and req.form.has_key(i):
+				pval = req.form[i].strip()
+				if not pval:
+					pval = None
+		ret[i] = pval
+	return ret
luci/site/luci/Extensions/Attic/LuciZopeExternal.py +7 -6
@@ -13,10 +13,9 @@
 from homebase_adapters import getUserPerms, homebaseControl, \
 	getDefaultUser
 
-from cluster_adapters import clusterTaskProcess, resourceAdd, \
-	resourceDelete, \
-	createCluChooser, createCluConfigTree, serviceDelete, \
-	getClusterOS, getClusterURL, getSystemLogs, getRicciAgentForCluster, \
+from cluster_adapters import clusterTaskProcess, \
+	resourceAdd, resourceDelete, serviceDelete, \
+	getClusterURL, getSystemLogs, getRicciAgentForCluster, \
 	isClusterBusy, nodeTaskProcess, process_cluster_conf_editor, \
 	serviceMigrate, serviceRestart, serviceStart, serviceStop
 
@@ -26,7 +25,7 @@
 	getClustersInfo, getClusterStatus, getFdomInfo, get_fdom_names, \
 	getFdomsInfo, getFence, getFenceInfo, getFencesInfo, getModelBuilder, \
 	getNodeInfo, getnodes, getNodesInfo, getResourceInfo, getResourcesInfo, \
-	getServiceInfo, getServicesInfo, getVMInfo
+	getServiceInfo, getServicesInfo, getVMInfo, getClusterOS
 
 from LuciDB import access_to_host_allowed, allowed_systems, \
 	check_clusters, getRicciAgent, getSystems, getClusters, \
@@ -35,6 +34,8 @@
 from LuciZope import appendModel, bytes_to_value_prefunits, \
 	set_persistent_var, strFilter, getTabs, siteIsSetup
 
+from LuciZopeClusterPortal import createCluChooser, createCluConfigTree
+
 from LuciZopePerm import isAdmin, userAuthenticated
 
 from ricci_communicator import get_ricci_communicator
@@ -42,7 +43,7 @@
 from storage_adapters import createStorageChooser, \
 	createStorageConfigTree, getStorageURL
 
-from StorageReport import apply, cache_storage_report, \
+from StorageReport import apply_storage_changes, cache_storage_report, \
 	get_bd_data, get_mapper_data, get_mappers_data, get_mapper_template_data, \
 	get_mappings_info, get_storage_batch_result, get_storage_report, \
 	group_systems_by_cluster, is_storage_report_cached, validate, \
luci/site/luci/Extensions/Variable.py +2 -0
@@ -91,6 +91,8 @@
     def __init__(self, name, value, mods={}):
         self.__name = str(name)
         self.__mods = mods
+        self.__value = None
+        self.__type = None
         self.set_value(value)
 
     def get_name(self):
luci/site/luci/Extensions/cluster_adapters.py +77 -664

794 lines not on this page · raw message

luci/site/luci/Extensions/storage_adapters.py +0 -2
@@ -357,8 +357,6 @@
   return dummynode
 
 
-
-
 def getStorageURL(self, request, hostname):
   # return URL to manage this storage system
   try: