From mboxrd@z Thu Jan 1 00:00:00 1970 From: jparsons@sourceware.org Date: 24 Jul 2006 19:39:06 -0000 Subject: [Cluster-devel] conga/luci/site/luci/Extensions conga_constant ... Message-ID: <20060724193906.4525.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 Changes by: jparsons at sourceware.org 2006-07-24 19:39:06 Modified files: luci/site/luci/Extensions: conga_constants.py cluster_adapters.py ModelBuilder.py Log message: Support for cluster config Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&r1=1.3&r2=1.4 --- conga/luci/site/luci/Extensions/conga_constants.py 2006/07/14 16:48:23 1.3 +++ conga/luci/site/luci/Extensions/conga_constants.py 2006/07/24 19:39:06 1.4 @@ -3,6 +3,7 @@ CLUSTER="5" CLUSTER_ADD="6" CLUSTER_CONFIG="7" +CLUSTER_PROCESS="8" NODE="9" NODES="10" NODE_LIST="11" @@ -43,7 +44,13 @@ NODE_FENCE="103" NODE_DELETE="104" +BASECLUSTER="201" +FENCEDAEMON="202" +MULTICAST="203" +QUORUMD="204" + PAGETYPE="pagetype" +ACTIONTYPE="actiontype" CLUNAME="clustername" PATH_TO_PRIVKEY="/var/lib/luci/var/certs/privkey.pem" --- conga/luci/site/luci/Extensions/cluster_adapters.py 2006/07/21 14:49:47 1.8 +++ conga/luci/site/luci/Extensions/cluster_adapters.py 2006/07/24 19:39:06 1.9 @@ -921,7 +921,84 @@ response = req.RESPONSE response.redirect(req['HTTP_REFERER'] + "&busyfirst=true") +def getClusterInfo(self, model, req): + baseurl = req['URL'] + "?" + PAGETYPE + "=" + CLUSTER_PROCESS + "&" + CLUNAME + "=" + cluname + "&" + cluname = req[CLUNAME] + map = {} + basecluster_url = baseurl + ACTIONTYPE + "=" + BASECLUSTER + #needed: + map['basecluster_url'] = basecluster_url + #name field + map['clustername'] = model.getClusterAlias() + #config version + cp = model.getClusterPtr() + map['config_version'] = cp.getConfigVersion() + #------------- + #new cluster params - if rhel5 + #------------- + #Fence Daemon Props + fencedaemon_url = baseurl + ACTIONTYPE + "=" + FENCEDAEMON + map['fencedaemon_url'] = fencedaemon_url + fdp = model.getFenceDaemonPtr() + pjd = fdp.getAttribute('post_join_delay') + if pjd == None: + pjd = "6" + pfd = fdp.getAttribute('post_fail_delay') + if pfd == None: + pfd = "0" + #post join delay + map['pjd'] = pjd + #post fail delay + map['pfd'] = pfd + #------------- + #if multicast + multicast_url = baseurl + ACTIONTYPE + "=" + MULTICAST + map['multicast_url'] = multicast_url + #mcast addr + is_mcast = model.isMulticast() + map['is_mcast'] = is_mcast + if is_mcast: + map['mcast_addr'] = model.getMcastAddr() + + #------------- + #quorum disk params + quorumd_url = baseurl + ACTIONTYPE + "=" + QUORUMD + map['quorumd_url'] = quorumd_url + is_quorumd = model.isQuorumd() + map['is_quorumd'] = is_quorumd + if is_quorumd: + qdp = model.getQuorumdPtr() + interval = qdp.getAttribute('interval') + tko = qdp.getAttribute('tko') + votes = qdp.getAttribute('votes') + min_score = qdp.getAttribute('min_score') + device = qdp.getAttribute('device') + label = qdp.getAttribute('label') + heuristic_kids = qdp.getChildren() + h_ctr = 0 + hlist = list() + for kid in heuristic_kids: + hmap = {} + hname = kid.getAttribute('name') + if hname == None: + hname = h_ctr + h_ctr++ + hprog = kid.getAttribute('program') + hscore = kid.getAttribute('score') + hinterval = kid.getAttribute('interval') + if hprog == None: + continue + hmap['hname'] = hname + hmap['hprog'] = hprog + if hscore != None: + hmap['hscore'] = hscore + if hinterval != None: + hmap['hinterval'] = hinterval + hlist.append(hmap) + if len(hlist) > 0: + map['hlist'] = hlist + return map def getClustersInfo(self,status,req): map = {} @@ -941,7 +1018,10 @@ clu = clulist[0] clustername = clu['name'] - map['clusteralias'] = clu['alias'] + if clu['alias'] != "": + map['clusteralias'] = clu['alias'] + else: + map['clusteralias'] = clustername map['clustername'] = clustername if clu['quorate'] == "true": map['status'] = "Quorate" @@ -951,6 +1031,7 @@ map['running'] = "false" map['votes'] = clu['votes'] map['minquorum'] = clu['minQuorum'] + map['clucfg'] = baseurl + "?" + PAGETYPE + "=" + CLUSTER_CONFIG + "&" + CLUNAME + "=" + clustername svc_dict_list = list() for svc in svclist: svc_dict = {} --- conga/luci/site/luci/Extensions/ModelBuilder.py 2006/07/20 21:36:34 1.3 +++ conga/luci/site/luci/Extensions/ModelBuilder.py 2006/07/24 19:39:06 1.4 @@ -120,7 +120,7 @@ self.command_handler = CommandHandler() self.isModified = False self.quorumd_ptr = None - self.isQuorumd = False + self.usesQuorumd = False if mcast_addr == None: self.usesMulticast = False else: @@ -194,7 +194,7 @@ self.fence_daemon_ptr = new_object elif parent_node.nodeName == QUORUMD_PTR_STR: self.quorumd_ptr = new_object - self.isQuorumd = True + self.usesQuorumd = True elif parent_node.nodeName == GULM_TAG_STR: self.GULM_ptr = new_object self.lock_type = GULM_TYPE @@ -597,6 +597,12 @@ def getMcastAddr(self): return self.mcast_address + def isQuorumd(self): + return self.usesQuorumd + + def getQuorumdPtr(self): + return quorumd_ptr + def check_empty_ptrs(self): if self.resourcemanager_ptr == None: rm = Rm()