From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 20 Aug 2007 16:31:16 -0000 Subject: [Cluster-devel] conga luci/site/Makefile luci/site/luci/Extens ... Message-ID: <20070820163116.21271.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: rmccabe at sourceware.org 2007-08-20 16:31:14 Modified files: luci/site : Makefile luci/site/luci/Extensions: LuciClusterActions.py LuciDB.py LuciZope.py luci/storage : form-macros luci/utils : luci_admin luci_manage ricci/modules/cluster: Clusvcadm.cpp Log message: Fixes from the -RHEL5 branch. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/Makefile.diff?cvsroot=cluster&r1=1.14&r2=1.15 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterActions.py.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciDB.py.diff?cvsroot=cluster&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZope.py.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/storage/form-macros.diff?cvsroot=cluster&r1=1.23&r2=1.24 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/utils/luci_admin.diff?cvsroot=cluster&r1=1.55&r2=1.56 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/utils/luci_manage.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Clusvcadm.cpp.diff?cvsroot=cluster&r1=1.12&r2=1.13 --- conga/luci/site/Makefile 2007/07/16 22:21:31 1.14 +++ conga/luci/site/Makefile 2007/08/20 16:31:12 1.15 @@ -40,6 +40,8 @@ install: install -d ${DESTDIR}/var/lib/luci + echo False > ${DESTDIR}/var/lib/luci/.default_password_has_been_reset + chmod 640 ${DESTDIR}/var/lib/luci/.default_password_has_been_reset install -d ${DESTDIR}/var/lib/luci/bin # install `find luci/bin -maxdepth 1 -type f` ${DESTDIR}/var/lib/luci/bin --- conga/luci/site/luci/Extensions/LuciClusterActions.py 2007/07/27 16:43:47 1.4 +++ conga/luci/site/luci/Extensions/LuciClusterActions.py 2007/08/20 16:31:13 1.5 @@ -364,6 +364,10 @@ exclude_names=[ nodename_resolved ], exclude_busy=True) if rc2 is None: + rc2 = getRicciAgent(self, clustername, + exclude_names=[ nodename_resolved ]) + + if rc2 is None: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('ND0: unable to find ricci agent to delete %s from %s' % (nodename_resolved, clustername)) return None @@ -589,9 +593,11 @@ def NodeFence(self, clustername, nodename, nodename_resolved): rc = getRicciAgent(self, clustername, exclude_names=[ nodename_resolved, nodename ], exclude_busy=True) + if rc is None: rc = getRicciAgent(self, clustername, exclude_names=[ nodename_resolved, nodename ]) + if rc is None: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('FNF0: no ricci to fence %s for cluster %s' \ @@ -636,6 +642,7 @@ if rc is None: rc = getRicciAgent(self, clustername, exclude_busy=True) + if rc is None: rc = getRicciAgent(self, clustername) --- conga/luci/site/luci/Extensions/LuciDB.py 2007/07/27 16:43:47 1.6 +++ conga/luci/site/luci/Extensions/LuciDB.py 2007/08/20 16:31:13 1.7 @@ -852,7 +852,7 @@ continue if exclude_busy is True: - if NodeBusy(self, cluname, ricci_hostname, rc) is not False: + if NodeBusy(self, clustername, ricci_hostname, rc) is not False: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('GRA13: %s is busy, excluding' \ % ricci_hostname) @@ -861,7 +861,7 @@ if LUCI_DEBUG_MODE is True: luci_log.debug('GRA14: no ricci agent could be found for cluster %s' \ - % cluname) + % clustername) return None def getClusterDBObj(self, clustername): --- conga/luci/site/luci/Extensions/LuciZope.py 2007/08/08 21:00:07 1.4 +++ conga/luci/site/luci/Extensions/LuciZope.py 2007/08/20 16:31:13 1.5 @@ -126,7 +126,7 @@ def GetReqVars(req, varlist): ret = {} - from types import ListType; + from types import ListType for i in varlist: pval = None --- conga/luci/storage/form-macros 2007/08/09 04:37:21 1.23 +++ conga/luci/storage/form-macros 2007/08/20 16:31:14 1.24 @@ -615,7 +615,7 @@ id="graphics_checkbox_id" tal:attributes="checked mapper/graphical_view" onchange="var s = (this.checked)?'graphical_view':'textual_view'; singleVisibleSpan('mappings_view', s);"/> - Graphical View + Graphical View (Uncheck if volumes are too small to select) @@ -1068,7 +1068,7 @@ type string:text; value prop/value; onkeypress python:'return validate_text_keypress(this, event, 2, \'' + prop['validation']['illegal_chars'] + '\', ' + str(prop['validation']['max_length']) + ')'; - onblur python:'validate_text(this, 2, \'' + prop['validation']['illegal_chars'] + '\', \'' + prop['validation']['reserved_words'] + '\', ' + str(prop['validation']['min_length']) + ', ' + str(prop['validation']['max_length']) + ', \'' + form_submit_button_id + '\')'"/> + onchange python:'validate_text(this, 2, \'' + prop['validation']['illegal_chars'] + '\', \'' + prop['validation']['reserved_words'] + '\', ' + str(prop['validation']['min_length']) + ', ' + str(prop['validation']['max_length']) + ', \'' + form_submit_button_id + '\')'"/> @@ -1078,7 +1078,7 @@ type string:text; size string:15; value prop/value; - onblur python:'validate_int(this, 2, ' + str(prop['validation']['min']) + ', ' + str(prop['validation']['max']) + ', ' + str(prop['validation']['step']) + ', \'' + prop_units + '\', \'' + form_submit_button_id + '\')'" + onchange python:'validate_int(this, 2, ' + str(prop['validation']['min']) + ', ' + str(prop['validation']['max']) + ', ' + str(prop['validation']['step']) + ', \'' + prop_units + '\', \'' + form_submit_button_id + '\')'" onkeypress="return validate_int_keypress(this, event, 2)"/> ( - ) @@ -1096,7 +1096,7 @@ type string:text; size string:15; value value; - onblur python:'validate_float(this, 2, ' + str(minim) + ', ' + str(maxim) + ', ' + str(step) + ', \'' + units + '\', \'' + form_submit_button_id + '\')'" + onchange python:'validate_float(this, 2, ' + str(minim) + ', ' + str(maxim) + ', ' + str(step) + ', \'' + units + '\', \'' + form_submit_button_id + '\')'" onkeypress="return validate_float_keypress(this, event, 2)"/> ( - ) @@ -1422,9 +1422,15 @@ return ev.which; } +var pending_warning = false; + function display_warning(el, timeout, text) { - alert(text); + if (!pending_warning) { + pending_warning = true; + alert(text); + pending_warning = false; + } return; var geom_obj = getGeom(el); --- conga/luci/utils/luci_admin 2007/08/10 18:36:31 1.55 +++ conga/luci/utils/luci_admin 2007/08/20 16:31:14 1.56 @@ -99,7 +99,17 @@ }) orig_stderr = sys.stderr + if '--debug' in sys.argv or '--verbose' in sys.argv: + try: + del sys.argv[sys.argv.index('--debug')] + except: + pass + + try: + del sys.argv[sys.argv.index('--verbose')] + except: + pass verbose = sys.stderr else: verbose = file('/dev/null', 'rwb+', 0) --- conga/luci/utils/luci_manage 2007/02/05 20:08:28 1.3 +++ conga/luci/utils/luci_manage 2007/08/20 16:31:14 1.4 @@ -43,9 +43,10 @@ try: luci = pwd.getpwnam(LUCI_USER)[2:4] if not luci or len(luci) != 2: - raise - except: - sys.stderr.write('Cannot find the \"' + LUCI_USER + '\" user.\n') + raise Exception, 'user does not exist' + except Exception, e: + sys.stderr.write('Cannot find the "%s" user: %s\n' \ + % (LUCI_USER, str(e))) return -1 try: @@ -56,8 +57,8 @@ os.chown(LUCI_DB_PATH + i, luci[0], luci[1]) os.chmod(LUCI_DB_PATH + i, 0600) except: pass - except: - sys.stderr.write('Unable to change ownership of the Luci database back to user \"' + LUCI_USER + '\"\n') + except Exception, e: + sys.stderr.write('Unable to change ownership of the Luci database to user "%s": %s\n' % (LUCI_USER, str(e))) return -1 def luci_set_mgmt(set_state): @@ -82,7 +83,7 @@ from Products.PlonePAS import config from Products.PlonePAS.interfaces.plugins import IUserManagement import BTrees.OOBTree - ImageFile.ImageFile.__init__ = lambda x,y,z:None + ImageFile.ImageFile.__init__ = lambda x, y, z: None sys.stderr = orig_stderr try: --- conga/ricci/modules/cluster/Clusvcadm.cpp 2007/03/12 03:45:18 1.12 +++ conga/ricci/modules/cluster/Clusvcadm.cpp 2007/08/20 16:31:14 1.13 @@ -1,5 +1,5 @@ /* - Copyright Red Hat, Inc. 2005 + Copyright Red Hat, Inc. 2005-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -89,7 +89,7 @@ if (*iter == nodename) node_found = true; if (!node_found && nodename.size()) - throw String("node unable to run services"); + throw String("Node " + nodename + " is unable to run cluster services. Check whether the rgmanager service is running"); // start for (list::const_iterator iter = services.begin(); @@ -100,10 +100,20 @@ if (iter->status == ServiceStatus::RG_STATE_MIGRATE) throw String(servicename + " is in the process of being migrated"); - - if (iter->status == ServiceStatus::RG_STATE_STOPPED || + + /* + ** Failed services must be disabled before they can be + ** started again. + */ + if (iter->status == ServiceStatus::RG_STATE_FAILED) { + try { + Clusvcadm::stop(servicename); + } catch ( ... ) { + throw String("Unable to disable failed service " + servicename + " before starting it"); + } + flag = "-e"; + } else if (iter->status == ServiceStatus::RG_STATE_STOPPED || iter->status == ServiceStatus::RG_STATE_STOPPING || - iter->status == ServiceStatus::RG_STATE_FAILED || iter->status == ServiceStatus::RG_STATE_ERROR || iter->status == ServiceStatus::RG_STATE_DISABLED) flag = "-e"; @@ -127,12 +137,12 @@ if (utils::execute(CLUSVCADM_TOOL_PATH, args, out, err, status, false)) throw command_not_found_error_msg(CLUSVCADM_TOOL_PATH); if (status != 0) - throw String("clusvcadm failed"); + throw String("clusvcadm failed to start " + servicename); } return; } - throw String("no such service"); + throw String(servicename + ": no such cluster service"); } void @@ -150,7 +160,7 @@ if (*iter == nodename) node_found = true; if (!node_found && nodename.size()) - throw String("node unable to run services"); + throw String("Node " + nodename + " is unable to run cluster services. Check whether the rgmanager service is running"); // start for (list::const_iterator iter = services.begin(); @@ -162,9 +172,16 @@ String flag; if (iter->status == ServiceStatus::RG_STATE_MIGRATE) throw String(servicename + " is already in the process of being migrated"); - if (iter->status == ServiceStatus::RG_STATE_STOPPED || + + if (iter->status == ServiceStatus::RG_STATE_FAILED) { + try { + Clusvcadm::stop(servicename); + } catch ( ... ) { + throw String("Unable to disable failed service " + servicename + " before starting it"); + } + flag = "-e"; + } else if (iter->status == ServiceStatus::RG_STATE_STOPPED || iter->status == ServiceStatus::RG_STATE_STOPPING || - iter->status == ServiceStatus::RG_STATE_FAILED || iter->status == ServiceStatus::RG_STATE_ERROR || iter->status == ServiceStatus::RG_STATE_DISABLED) flag = "-e"; @@ -185,13 +202,13 @@ if (utils::execute(CLUSVCADM_TOOL_PATH, args, out, err, status, false)) throw command_not_found_error_msg(CLUSVCADM_TOOL_PATH); if (status != 0) - throw String("clusvcadm failed"); + throw String("clusvcadm failed to migrate " + servicename); } return; } } - throw String("no such virtual service"); + throw String(servicename + ": no such virtual machine service"); } void @@ -206,6 +223,7 @@ iter++) if (iter->name == servicename) { if (iter->status == ServiceStatus::RG_STATE_STARTING || + iter->status == ServiceStatus::RG_STATE_FAILED || iter->status == ServiceStatus::RG_STATE_STARTED) { String out, err; int status; @@ -218,12 +236,12 @@ if (utils::execute(CLUSVCADM_TOOL_PATH, args, out, err, status, false)) throw command_not_found_error_msg(CLUSVCADM_TOOL_PATH); if (status != 0) - throw String("clusvcadm failed"); + throw String("clusvcadm failed to stop " + servicename); } return; } - throw String("no such service"); + throw String(servicename + ": no such cluster service"); } void @@ -243,9 +261,15 @@ if (iter->status == ServiceStatus::RG_STATE_STARTING) throw String(servicename + " is in the process of being started"); - if (iter->status == ServiceStatus::RG_STATE_STOPPED || + if (iter->status == ServiceStatus::RG_STATE_FAILED) { + try { + Clusvcadm::stop(servicename); + } catch ( ... ) { + throw String("Unable to disable failed service " + servicename + " before starting it"); + } + flag = "-e"; + } else if (iter->status == ServiceStatus::RG_STATE_STOPPED || iter->status == ServiceStatus::RG_STATE_STOPPING || - iter->status == ServiceStatus::RG_STATE_FAILED || iter->status == ServiceStatus::RG_STATE_ERROR || iter->status == ServiceStatus::RG_STATE_DISABLED) flag = "-e"; @@ -264,12 +288,12 @@ if (utils::execute(CLUSVCADM_TOOL_PATH, args, out, err, status, false)) throw command_not_found_error_msg(CLUSVCADM_TOOL_PATH); if (status != 0) - throw String("clusvcadm failed"); + throw String("clusvcadm failed to restart cluster service " + servicename); } return; } - throw String("no such service"); + throw String(servicename + ": no such cluster service"); }