From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 18 Jun 2007 18:13:43 -0000 Subject: [Cluster-devel] conga luci/cluster/resource-form-macros luci/s ... Message-ID: <20070618181343.28437.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: conga Branch: EXPERIMENTAL Changes by: rmccabe at sourceware.org 2007-06-18 18:13:40 Modified files: luci/cluster : resource-form-macros luci/site/luci/Extensions: LuciClusterInfo.py LuciSyslog.py LuciZopeExternal.py ResourceHandler.py cluster_adapters.py conga_constants.py luci/site/luci/Extensions/ClusterModel: ModelBuilder.py SAPDatabase.py SAPInstance.py make : version.in Log message: - Cleanups related to bz239596 - Change log facility to LOG_AUTH (python lacks LOG_AUTHPRIV) - Bump the revision number Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.37.2.4&r2=1.37.2.5 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.10&r2=1.1.2.11 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciSyslog.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.11.4.5&r2=1.11.4.6 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.4&r2=1.1.2.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ResourceHandler.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/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.255.2.16&r2=1.255.2.17 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.39.2.10&r2=1.39.2.11 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.8&r2=1.1.2.9 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/SAPDatabase.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.2&r2=1.1.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/SAPInstance.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.2&r2=1.1.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/make/version.in.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.31.2.2&r2=1.31.2.3 --- conga/luci/cluster/resource-form-macros 2007/06/14 19:30:44 1.37.2.4 +++ conga/luci/cluster/resource-form-macros 2007/06/18 18:13:39 1.37.2.5 @@ -1235,7 +1235,7 @@ + value res/attrs/DIR_EXECUTABLE | nothing" /> @@ -1247,7 +1247,7 @@ + value res/attrs/DIR_PROFILE | nothing" /> @@ -1256,7 +1256,7 @@ + value res/attrs/START_PROFILE | nothing" /> @@ -1266,6 +1266,7 @@
+

SAP Database Configuration

+ value res/attrs/DIR_EXECUTABLE | nothing" /> + + + Database type @@ -1353,7 +1356,7 @@ + value res/attrs/NETSERVICENAME | nothing" /> @@ -1363,7 +1366,7 @@ + checked res/attrs/DBJ2EE_ONLY | nothing" /> @@ -1375,7 +1378,7 @@ + value res/attrs/DIR_BOOTSTRAP | nothing" /> @@ -1387,7 +1390,7 @@ + value res/attrs/DIR_SECSTORE | nothing" /> --- conga/luci/site/luci/Extensions/Attic/LuciClusterInfo.py 2007/06/13 15:54:42 1.1.2.10 +++ conga/luci/site/luci/Extensions/Attic/LuciClusterInfo.py 2007/06/18 18:13:39 1.1.2.11 @@ -24,8 +24,8 @@ PROP_FENCE_TAB, PROP_GENERAL_TAB, PROP_GULM_TAB, PROP_MCAST_TAB, \ PROP_QDISK_TAB, RESOURCE, RESOURCE_CONFIG, RESOURCE_REMOVE, \ SERVICE, SERVICE_DELETE, SERVICE_MIGRATE, SERVICE_RESTART, \ - SERVICE_START, SERVICE_STOP, VM_CONFIG, LUCI_DEBUG_MODE, \ - LUCI_CLUSTER_BASE_URL + SERVICE_START, SERVICE_STOP, VM_CONFIG, \ + LUCI_DEBUG_MODE, LUCI_CLUSTER_BASE_URL luci_log = get_logger() @@ -37,11 +37,13 @@ luci_log.debug_verbose('getnodes0: %r %s' % (e, str(e))) return [] -def getResourceInfo(model, name, res=None): +def getResourceInfo(model, name, baseurl, res=None): if res is None: try: res = model.getResourceByName(name) except Exception, e: + if LUCI_DEBUG_MODE is True: + luci_log.debug_verbose('GRI0: %s: %r %s' % (name, e, str(e))) return {} res_info = {} @@ -54,19 +56,19 @@ cluname = model.getClusterName() res_info['cfgurl'] = '%s?clustername=%s&resourcename=%s&pagetype=%s' \ - % (cluname, res_name, RESOURCE_CONFIG) + % (baseurl, cluname, res_name, RESOURCE_CONFIG) res_info['url'] = '%s?clustername=%s&resourcename=%s&pagetype=%s' \ - % (cluname, res_name, RESOURCE) + % (baseurl, cluname, res_name, RESOURCE) res_info['delurl'] = '%s?clustername=%s&resourcename=%s&pagetype=%s' \ - % (cluname, res_name, RESOURCE_REMOVE) + % (baseurl, cluname, res_name, RESOURCE_REMOVE) return res_info -def getResources(model): +def getResources(model, baseurl): if model is None: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('getResources0: model is none') return [] - return map(lambda x: getResourcesInfo(model, None, x), model.getResources()) + return map(lambda x: getResourceInfo(model, None, baseurl, x), model.getResources()) def getClusterStatusModel(model): results = list() @@ -242,7 +244,7 @@ try: svc = model.retrieveServiceByName(item['name']) itemmap['cfgurl'] = '%s?clustername=%s&servicename=%s&pagetype=%s' % (baseurl, cluname, item['name'], SERVICE) - itemmap['cfgurl'] = '%s?clustername=%s&servicename=%s&pagetype=%s' % (baseurl, cluname, item['name'], SERVICE_DELETE) + itemmap['delurl'] = '%s?clustername=%s&servicename=%s&pagetype=%s' % (baseurl, cluname, item['name'], SERVICE_DELETE) except: try: svc = model.retrieveVMsByName(item['name']) @@ -1491,17 +1493,15 @@ return vm_map def getResourcesInfo(self, model, request): - resList = list() fvars = GetReqVars(request, [ 'clustername', 'URL' ]) baseurl = fvars['URL'] or LUCI_CLUSTER_BASE_URL if fvars['clustername'] is None: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('getResourcesInfo missing cluster name') - return resList + return [] - #CALL LUCICLUSTERINFO - return resList + return getResources(model, baseurl) def getClusterName(self, model): return model.getClusterName() --- conga/luci/site/luci/Extensions/LuciSyslog.py 2007/06/13 15:54:42 1.11.4.5 +++ conga/luci/site/luci/Extensions/LuciSyslog.py 2007/06/18 18:13:39 1.11.4.6 @@ -6,7 +6,7 @@ # Free Software Foundation. from syslog import openlog, closelog, syslog, \ - LOG_DAEMON, LOG_PID, LOG_NDELAY, LOG_INFO, \ + LOG_AUTH, LOG_PID, LOG_NDELAY, LOG_INFO, \ LOG_WARNING, LOG_DEBUG from conga_constants import LUCI_DEBUG_MODE, LUCI_DEBUG_VERBOSITY, \ @@ -22,7 +22,7 @@ def __init__(self): self.__init = 0 try: - openlog('luci', LOG_PID | LOG_NDELAY, LOG_DAEMON) + openlog('luci', LOG_PID | LOG_NDELAY, LOG_AUTH) self.__init = 1 except: raise LuciSyslogError, 'unable to setup syslog functionality.' --- conga/luci/site/luci/Extensions/Attic/LuciZopeExternal.py 2007/05/30 22:06:24 1.1.2.4 +++ conga/luci/site/luci/Extensions/Attic/LuciZopeExternal.py 2007/06/18 18:13:39 1.1.2.5 @@ -17,14 +17,15 @@ resourceAdd, resourceDelete, serviceDelete, \ getClusterURL, getSystemLogs, getRicciAgentForCluster, \ isClusterBusy, nodeTaskProcess, process_cluster_conf_editor, \ - serviceMigrate, serviceRestart, serviceStart, serviceStop + serviceMigrate, serviceRestart, serviceStart, serviceStop, \ + getResourceInfo from HelperFunctions import add_commas, bytes_to_value_units, convert_bytes from LuciClusterInfo import getClusterAlias, getClusterInfo, getClusterName, \ getClustersInfo, getClusterStatus, getFdomInfo, get_fdom_names, \ getFdomsInfo, getFence, getFenceInfo, getFencesInfo, getModelBuilder, \ - getNodeInfo, getnodes, getNodesInfo, getResourceInfo, getResourcesInfo, \ + getNodeInfo, getnodes, getNodesInfo, getResourcesInfo, \ getServiceInfo, getServicesInfo, getVMInfo, getClusterOS from LuciDB import access_to_host_allowed, allowed_systems, \ --- conga/luci/site/luci/Extensions/Attic/ResourceHandler.py 2007/06/08 18:27:00 1.1.2.6 +++ conga/luci/site/luci/Extensions/Attic/ResourceHandler.py 2007/06/18 18:13:39 1.1.2.7 @@ -74,7 +74,7 @@ if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('addIp4: %s' % err) - if 'monitorLink' in form: + if form.has_key('monitorLink'): res.addAttribute('monitor_link', '1') else: res.addAttribute('monitor_link', '0') @@ -751,7 +751,7 @@ } def create_resource(res_type, form, model): - if not res_type in resource_table: + if not resource_table.has_key(res_type): raise Exception, [ 'Unknown resource type: "%s"' % res_type ] res = None @@ -777,6 +777,8 @@ raise Exception, [ 'All resources must have a unique name.' ] rname = form['resourceName'].strip() res.addAttribute('name', rname) + else: + rname = form['ip_address'].strip() errors = resource_table[res_type][0](res, rname, form, model) try: --- conga/luci/site/luci/Extensions/cluster_adapters.py 2007/06/14 19:30:44 1.255.2.16 +++ conga/luci/site/luci/Extensions/cluster_adapters.py 2007/06/18 18:13:39 1.255.2.17 @@ -3152,26 +3152,28 @@ # These are called from external methods. def getResourceInfo(model, request): - fvars = GetReqVars(request, - [ 'resourcename', 'type', 'value', 'clustername', 'URL' ]) - if not model: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('GRI0: no model object in session') return {} + fvars = GetReqVars(request, + [ 'resourcename', 'type', 'value', 'clustername', 'URL' ]) + + baseurl = fvars['URL'] or LUCI_CLUSTER_BASE_URL + name = fvars['resourcename'] if name is None: - res_type = fvars['type'] - if res_type == 'ip': + if fvars['type'] == 'ip': name = fvars['value'] if name is None: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('GRI1: missing res name') return {} + from LuciClusterInfo import getResourceInfo as gri - return gri(model, name) + return gri(model, name, baseurl, res=None) def serviceRestart(self, rc, req): from LuciClusterActions import RestartCluSvc --- conga/luci/site/luci/Extensions/conga_constants.py 2007/06/14 19:30:44 1.39.2.10 +++ conga/luci/site/luci/Extensions/conga_constants.py 2007/06/18 18:13:39 1.39.2.11 @@ -149,6 +149,6 @@ # Debugging parameters. Set LUCI_DEBUG_MODE to True and LUCI_DEBUG_VERBOSITY # to >= 2 to get full debugging output in syslog (LOG_DAEMON/LOG_DEBUG). -LUCI_DEBUG_MODE = False +LUCI_DEBUG_MODE = True LUCI_DEBUG_NET = False -LUCI_DEBUG_VERBOSITY = 0 +LUCI_DEBUG_VERBOSITY = 3 --- conga/luci/site/luci/Extensions/ClusterModel/Attic/ModelBuilder.py 2007/06/08 18:27:00 1.1.2.8 +++ conga/luci/site/luci/Extensions/ClusterModel/Attic/ModelBuilder.py 2007/06/18 18:13:40 1.1.2.9 @@ -31,8 +31,8 @@ from OpenLDAP import OpenLDAP from Postgres8 import Postgres8 from Tomcat5 import Tomcat5 -from SAPInstance import SAPInstance from SAPDatabase import SAPDatabase +from SAPInstance import SAPInstance from Multicast import Multicast from FenceDaemon import FenceDaemon from FenceXVMd import FenceXVMd @@ -90,8 +90,8 @@ 'script': Script, 'nfsexport': NFSExport, 'nfsclient': NFSClient, + 'SAPDatabase': SAPDatabase, 'SAPInstance': SAPInstance, - 'SABDatabase': SAPDatabase, 'device': Device } --- conga/luci/site/luci/Extensions/ClusterModel/Attic/SAPDatabase.py 2007/05/15 18:58:56 1.1.2.2 +++ conga/luci/site/luci/Extensions/ClusterModel/Attic/SAPDatabase.py 2007/06/18 18:13:40 1.1.2.3 @@ -16,3 +16,9 @@ BaseResource.__init__(self) self.TAG_NAME = TAG_NAME self.resource_type = RESOURCE_TYPE + + def getName(self): + try: + return self.attr_hash['SID'] + except KeyError, e: + return '' --- conga/luci/site/luci/Extensions/ClusterModel/Attic/SAPInstance.py 2007/05/15 18:58:56 1.1.2.2 +++ conga/luci/site/luci/Extensions/ClusterModel/Attic/SAPInstance.py 2007/06/18 18:13:40 1.1.2.3 @@ -16,3 +16,10 @@ BaseResource.__init__(self) self.TAG_NAME = TAG_NAME self.resource_type = RESOURCE_TYPE + + def getName(self): + try: + return self.attr_hash['InstanceName'] + except KeyError, e: + return '' + --- conga/make/version.in 2007/06/05 05:30:23 1.31.2.2 +++ conga/make/version.in 2007/06/18 18:13:40 1.31.2.3 @@ -1,5 +1,5 @@ VERSION=0.10.0 -RELEASE=1_UNRELEASED +RELEASE=2_UNRELEASED # Remove "_UNRELEASED" at release time. # Put release num at the beggining, # so that after it gets released, it has