FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 08-06-2010, 09:57 PM
 
Default conga/luci cluster/fdom-macros cluster/fence-m ...

CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL5
Changes by: rmccabe@sourceware.org 2010-08-06 21:57:43

Modified files:
luci/cluster : fdom-macros fence-macros
luci/site/luci/Extensions: LuciValidation.py cluster_adapters.py
conga_constants.py
luci/site/luci/Extensions/ClusterModel: ModelBuilder.py

Log message:
Fix rhbz#555862 - Luci does not have an option to delete failover domain

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fdom-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1 =1.2.2.1&r2=1.2.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1 =1.2.2.15&r2=1.2.2.16
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciValidation.py.diff?cvsroot=cluster&only_with_t ag=RHEL5&r1=1.6.2.14&r2=1.6.2.15
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.49&r2=1.120.2.50
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&only_with_ tag=RHEL5&r1=1.19.2.17&r2=1.19.2.18
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag =RHEL5&r1=1.1.4.13&r2=1.1.4.14

--- conga/luci/cluster/fdom-macros 2008/01/23 04:44:30 1.2.2.1
+++ conga/luci/cluster/fdom-macros 2010/08/06 21:57:42 1.2.2.2
@@ -105,6 +105,7 @@
src="/luci/cluster/validate_fdom.js">
</script>

+<div class="hbSubmit">
<form method="post" action="">
<input type="hidden" name="clustername"
tal:attributes="value request/clustername | nothing" />
@@ -155,10 +156,8 @@

<tfoot class="systemsTable">
<tr class="systemsTable"><td>
- <div class="hbSubmit">
- <input type="button" name="add" value="Submit"
- onclick="validate_add_fdom(this.form)" />
- </div>
+ <input type="button" name="add" value="Submit"
+ onclick="validate_add_fdom(this.form)" />
</td></tr>
</tfoot>

@@ -191,8 +190,24 @@
</tal:block>
</tbody>
</table>
-</form>
+ </form>

+ <table class="systemsTable" width="100%">
+ <tr class="systemsTable">
+ <td tal:condition="exists: fdom/name">
+ <form method="post">
+ <input type="hidden" name="clustername"
+ tal:attributes="value request/clustername | nothing" />
+ <input type="hidden" name="pagetype" value="46"/>
+ <input type="hidden" name="name"
+ tal:attributes="value fdom/name | nothing" />
+ <input type="button" value="Delete this failover domain"
+ onclick="if (confirm('Delete this failover domain?')) this.form.submit()" />
+ </form>
+ </td>
+ </tr>
+ </table>
+</div>
</tal:block>

<div metal:define-macro="fdomadd-form">
@@ -213,6 +228,9 @@
</div>

<div metal:define-macro="fdom-form">
+ <script type="text/javascript">
+ set_page_title('Luci ?? cluster ?? failover domains ?? Configure a failover domain');
+ </script>
<h2>Failover Domain Form</h2>
<tal:block tal:define="fdom python:here.getFdomInfo(modelb, request)">
<tal:block metal:use-macro="here/fdom-macros/macros/fdom-macro" />
--- conga/luci/cluster/fence-macros 2010/08/05 19:14:10 1.2.2.15
+++ conga/luci/cluster/fence-macros 2010/08/06 21:57:43 1.2.2.16
@@ -1213,34 +1213,36 @@
value cur_fencedev/passwd_script | nothing" />
</td>
</tr>
-
- <tr>
- <td>VMware ESX Management Login</td>
- <td>
- <input name="vmlogin" type="text"
- tal:attributes="
- disabled cur_fencedev/isShared | nothing;
- value cur_fencedev/vmlogin | nothing" />
- </td>
- </tr>
- <tr>
- <td>VMware ESX Management Password</td>
- <td>
- <input name="vmpasswd" type="password" autocomplete="off"
- tal:attributes="
- disabled cur_fencedev/isShared | nothing;
- value cur_fencedev/passwd | nothing" />
+ <tr class="systemsTable">
+ <td class="systemsTable">VMware Type</td>
+ <td class="systemsTable">
+ <select name="vmware_type"
+ tal:define="vmware_type cur_fencedev/vmware_type | string:default"
+ tal:attributes="disabled cur_fencedev/isShared | nothing">
+ <option name="default" value="default"
+ tal:content="stringefault"
+ tal:attributes="selected python: vmware_type == 'default' and 'selected'"/>
+ <option name="esx" value="esx"
+ tal:content="string:VMware ESX"
+ tal:attributes="selected python: vmware_type == 'esx' and 'selected'" />
+ <option name="server2" value="server2"
+ tal:content="string:VMware Server v2"
+ tal:attributes="selected python: vmware_type == 'server2' and 'selected'" />
+ <option name="server1" value="server1"
+ tal:content="string:VMware Server v1"
+ tal:attributes="selected python: vmware_type == 'server1' and 'selected'" />
+ </select>
</td>
</tr>
<tr>
<td>
- <span title="Full path to a script to generate VMware ESX Management password">VMware ESX Management Password Script (optional)</span>
+ VMware Datacenter (ESX only)
</td>
<td>
- <input type="text" name="vmpasswd_script"
+ <input type="text" name="vmware_datacenter"
tal:attributes="
disabled cur_fencedev/isShared | nothing;
- value cur_fencedev/vmpasswd_script | nothing" />
+ value cur_fencedev/vmware_datacenter | nothing" />
</td>
</tr>
</table>
--- conga/luci/site/luci/Extensions/LuciValidation.py 2010/08/05 19:32:58 1.6.2.14
+++ conga/luci/site/luci/Extensions/LuciValidation.py 2010/08/06 21:57:43 1.6.2.15
@@ -16,7 +16,7 @@
from ClusterModel.Lockserver import Lockserver
from ClusterModel.Vm import Vm

-from conga_constants import LUCI_DEBUG_MODE, FDOM, FDOM_ADD, SERVICE_CONFIG, SERVICE_ADD, VM_CONFIG, VM_ADD
+from conga_constants import LUCI_DEBUG_MODE, FDOM, FDOM_ADD, FDOM_DELETE, SERVICE_CONFIG, SERVICE_ADD, VM_CONFIG, VM_ADD
from FenceHandler import validateFenceDevice, validateNewFenceDevice, validate_fenceinstance, FD_VAL_SUCCESS

from LuciSyslog import get_logger
@@ -524,6 +524,38 @@
return (False, { 'errors': [ 'Error configuring resource %s %s: ' % (resname, str(e)) ] })
return (True, { 'res_name': resname })

+def validate_fdom_delete(model, name):
+ errors = list()
+
+ fdom = model.getFailoverDomainByName(name)
+ if fdom is None:
+ if LUCI_DEBUG_MODE is True:
+ luci_log.debug_verbose('validateFdomdel1: No fdom named %s exists' % name)
+ errors.append('No failover domain named "%s" exists' % name)
+
+ svc_list = model.getServicesForFdom(name)
+ if svc_list and len(svc_list) != 0:
+ errors.append('Unable to delete failover domain "%s" because it is in use by %s %s' % (name, len(svc_list) == 1 and 'service' or 'services', ', '.join(map(lambda x: x.getName(), svc_list))))
+
+ if len(errors) > 0:
+ return (False, { 'errors': errors })
+
+ try:
+ fdom_ptr = model.getFailoverDomainPtr()
+ fdom_ptr.removeChild(fdom)
+ except:
+ if LUCI_DEBUG_MODE is True:
+ luci_log.debug_verbose('validateFdomdel2: unable to fdom remove %s' % name)
+ errors.append('Unable to remove failover domain "%s"' % name)
+
+ if len(errors) > 0:
+ return (False, { 'errors': errors })
+
+ action = FDOM_DELETE
+ status_msg = 'Deleting failover domain "%s"' % name
+
+ return (True, { 'msg': status_msg, 'action': action })
+
def validate_fdom(model, request):
errors = list()
fvar = GetReqVars(request, [ 'clustername', 'name', 'oldname' ])
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2010/08/06 20:17:21 1.120.2.49
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2010/08/06 21:57:43 1.120.2.50
@@ -30,7 +30,7 @@
NODE_FENCE, NODE_FORCE_DELETE, NODE_JOIN_CLUSTER, NODE_LEAVE_CLUSTER,
NODE_REBOOT, NODES, POSSIBLE_REBOOT_MESSAGE, PRE_CFG, PRE_INSTALL,
PRE_JOIN, REBOOT_TASK, REDIRECT_MSG, RESOURCES, RICCI_CONNECT_FAILURE,
- RICCI_CONNECT_FAILURE_MSG, SEND_CONF,
+ RICCI_CONNECT_FAILURE_MSG, SEND_CONF, FDOMS,
SERVICE_LIST, SERVICES, START_NODE, TASKTYPE,
REDIRECT_SEC, LUCI_CLUSTER_BASE_URL, FENCE_XVM_KEY_CREATE

@@ -967,6 +967,36 @@

request.RESPONSE.redirect('%s?pagetype=%s&clustern ame=%s&nodename=%s&busyfirst=true' % (baseurl, NODE, clustername, nodename))

+def deleteFdom(self, request):
+ from LuciValidation import validate_fdom_delete
+
+ fvar = GetReqVars(request, [ 'clustername', 'name', 'oldname', 'URL' ])
+ baseurl = fvar['URL'] or LUCI_CLUSTER_BASE_URL
+
+ name = fvar['name']
+ clustername = fvar['clustername']
+ if clustername is None:
+ if LUCI_DEBUG_MODE is True:
+ luci_log.debug_verbose('VFE0: No cluster name')
+ return (False, {'errors': ['No cluster name was given']})
+
+ model = LuciExtractCluModel(self, request, clustername)
+ if model is None:
+ if LUCI_DEBUG_MODE is True:
+ luci_log.debug_verbose('validateFdomdel0: no model')
+ return (False, { 'errors': [ 'Unable to retrieve the cluster configuration for %s. The configuration XML may contain errors' % clustername ]})
+
+ ret = validate_fdom_delete(model, name)
+ if ret[0] is not True:
+ return ret
+
+ ret = propagateClusterConfAsync(self, model, None,
+ ret[1]['action'], ret[1]['msg'])
+ if ret[0] is not True:
+ return ret
+
+ request.RESPONSE.redirect('%s?pagetype=%s&clustern ame=%s&busyfirst=true' % (baseurl, FDOMS, clustername))
+
def validateFdom(self, request):
from LuciValidation import validate_fdom

@@ -1175,6 +1205,7 @@
33: validateResourceAdd,
41: validateFdom,
44: validateFdom,
+ 46: deleteFdom,
51: validateFenceAdd,
54: validateFenceEdit,
55: validateDaemonProperties,
--- conga/luci/site/luci/Extensions/conga_constants.py 2008/03/12 15:13:13 1.19.2.17
+++ conga/luci/site/luci/Extensions/conga_constants.py 2010/08/06 21:57:43 1.19.2.18
@@ -44,6 +44,7 @@
FDOM_LIST = '42'
FDOM_CONFIG = '43'
FDOM = '44'
+FDOM_DELETE = '46'
FENCEDEVS = '50'
FENCEDEV_ADD = '51'
FENCEDEV_LIST = '52'
--- conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py 2010/01/07 18:08:35 1.1.4.13
+++ conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py 2010/08/06 21:57:43 1.1.4.14
@@ -600,6 +600,9 @@

raise KeyError, 'Couldn't find service name %s in current list' % name

+ def getServicesForFdom(self, name):
+ return filter(lambda x: x.getAttribute('domain') == name, self.getServices())
+
def retrieveVMsByName(self, name):
vms = self.getVMs()
for v in vms:
 

Thread Tools




All times are GMT. The time now is 06:28 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org