From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 11 Feb 2009 16:29:38 -0000 Subject: [Cluster-devel] conga ./conga.spec.in.in luci/cluster/fence-ma ... Message-ID: <20090211162938.28693.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: RHEL5 Changes by: rmccabe at sourceware.org 2009-02-11 16:29:37 Modified files: . : conga.spec.in.in luci/cluster : fence-macros luci/site/luci/Extensions: FenceHandler.py LuciClusterInfo.py Log message: - Fiz bz466013 (Add luci GUI support for LPAR and vmware fencing) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.45.2.110&r2=1.45.2.111 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2.2.8&r2=1.2.2.9 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.14&r2=1.4.2.15 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.13&r2=1.1.4.14 --- conga/conga.spec.in.in 2009/01/29 16:22:08 1.45.2.110 +++ conga/conga.spec.in.in 2009/02/11 16:29:36 1.45.2.111 @@ -328,6 +328,10 @@ - Fix bz467464 (adding qdisk to existing cluster fails to update cman entry in cluster.conf) - Fix bz460038 (Conga fs resource error when editing service) - Fix bz483067 (adding resource in conga doesn't work in IE) +- Fix bz483775 (Failover Domains can't be set for VMs as services of cluster suite using Conga) +- Fix bz483769 (Conga always shows VM properties as "Run exclusive") +- Fix bz450007 (cannot remove shared fence device through luci) +- Fiz bz466013 (Add luci GUI support for LPAR and vmware fencing) * Thu Sep 25 2008 Ryan McCabe 0.12.1-7 - Fix a typo in the fix for bz459562 --- conga/luci/cluster/fence-macros 2008/08/18 16:53:17 1.2.2.8 +++ conga/luci/cluster/fence-macros 2009/02/11 16:29:37 1.2.2.9 @@ -218,6 +218,14 @@ + + + + + + + + @@ -323,8 +331,10 @@ + +
@@ -347,6 +357,8 @@ + +
@@ -1084,6 +1096,139 @@ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Fence TypeLPAR
Name + +
Hostname + +
Login + +
Password + +
+ Password Script (optional) + + +
+ + + + + + + + + +
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Fence TypeVMWare
Name + +
Hostname + +
Login + +
Password + +
+ Password Script (optional) + + +
+ + + + + + + + +
+
+
@@ -1609,6 +1754,86 @@
+
+
+ + + + + + + +
Partition + +
+
+ + + + + + +
+
+ + + + + + +
+
+ +
+
+ + + + + + + +
Partition + +
+
+ + + + + + +
+
+ + + + + + +
+
+
+ + @@ -2117,6 +2346,16 @@ metal:use-macro="here/fence-macros/macros/fence-instance-form-egenera" /> + + + + + + + + --- conga/luci/site/luci/Extensions/FenceHandler.py 2008/06/13 18:37:46 1.4.2.14 +++ conga/luci/site/luci/Extensions/FenceHandler.py 2009/02/11 16:29:37 1.4.2.15 @@ -30,6 +30,8 @@ FD_PROVIDE_DEVICE = 'A device must be provided for this Fence Device' FD_PROVIDE_PORT = 'A port must be provided for this Fence Device' FD_PROVIDE_IPMILAN_AUTH = 'Authentication type must be "none" (or blank), "md5", or "password"' +FD_PROVIDE_VMLOGIN = 'A VMware ESX management login name must be provided for this Fence Device' +FD_PROVIDE_VMPASSWD = 'A VMware ESX management password must be provided for this Fence Device' FI_PROVIDE_PARENT = 'A Fence Device name must be provided for this Fence' FI_PROVIDE_SWITCH = 'A switch address must be provided for this Fence' @@ -40,6 +42,7 @@ FI_PROVIDE_ELPAN = 'A LPAN value must be provided for this Egenera Fence' FI_PROVIDE_EPSERVER = 'A PServer value must be provided for this Egenera Fence' FI_PROVIDE_NODENAME = 'A Node Name value must be provided for this SCSI Fence' +FI_PROVIDE_PARTITION = 'A partition name must be provided for this LPAR Fence' ILLEGAL_CHARS_REPLACED = 'Illegal characters were replaced by underscores. Feel free to set a new value.' @@ -534,6 +537,165 @@ return errors +def val_lpar_fd(form, fencedev): + errors = list() + + # fence_lpar currently requires the use of SSH + fencedev.addAttribute('secure', '1') + + try: + ip = form['ipaddr'].strip() + if not ip: + raise Exception, 'blank' + fencedev.addAttribute('ipaddr', ip) + except Exception, e: + errors.append(FD_PROVIDE_IP) + + try: + log = form['login'].strip() + if not log: + raise Exception, 'blank' + fencedev.addAttribute('login', log) + except Exception, e: + errors.append(FD_PROVIDE_LOGIN) + + has_passwd = False + try: + pwd = form['passwd'].strip() + if not pwd: + # Allow passwords that consist of only spaces. + if not form.has_key('passwd') or form['passwd'] == '': + raise Exception, 'blank' + else: + pwd = form['passwd'] + fencedev.addAttribute('passwd', pwd) + has_passwd = True + except Exception, e: + try: + fencedev.removeAttribute('passwd') + except: + pass + + try: + pwd_script = form['passwd_script'].strip() + if not pwd_script: + raise Exception, 'blank' + fencedev.addAttribute('passwd_script', pwd_script) + has_passwd = True + except Exception, e: + try: + fencedev.removeAttribute('passwd_script') + except: + pass + + if not has_passwd: + errors.append(FD_PROVIDE_PASSWD) + return errors + +def val_vmware_fd(form, fencedev): + errors = list() + + try: + ip = form['ipaddr'].strip() + if not ip: + raise Exception, 'blank' + fencedev.addAttribute('ipaddr', ip) + except Exception, e: + errors.append(FD_PROVIDE_IP) + + try: + log = form['login'].strip() + if not log: + raise Exception, 'blank' + fencedev.addAttribute('login', log) + except Exception, e: + errors.append(FD_PROVIDE_LOGIN) + + has_passwd = False + try: + pwd = form['passwd'].strip() + if not pwd: + # Allow passwords that consist of only spaces. + if not form.has_key('passwd') or form['passwd'] == '': + raise Exception, 'blank' + else: + pwd = form['passwd'] + fencedev.addAttribute('passwd', pwd) + has_passwd = True + except Exception, e: + try: + fencedev.removeAttribute('passwd') + except: + pass + + try: + pwd_script = form['passwd_script'].strip() + if not pwd_script: + raise Exception, 'blank' + fencedev.addAttribute('passwd_script', pwd_script) + has_passwd = True + except Exception, e: + try: + fencedev.removeAttribute('passwd_script') + except: + pass + + if not has_passwd: + errors.append(FD_PROVIDE_PASSWD) + use_ssh = form.has_key('secure') and (form['secure'] == '1' or form['secure'].lower() == 'true') + if use_ssh: + fencedev.addAttribute('secure', '1') + else: + fencedev.removeAttribute('secure') + + try: + vmlogin = form['vmlogin'].strip() + if not vmlogin: + raise Exception, 'blank' + fencedev.addAttribute('vmlogin', vmlogin) + except Exception, e: + errors.append(FD_PROVIDE_VMLOGIN) + + has_vmpasswd = False + try: + vmpwd = form['vmpasswd'].strip() + if not vmpwd: + # Allow passwords that consist of only spaces. + if not form.has_key('vmpasswd') or form['vmpasswd'] == '': + raise Exception, 'blank' + else: + vmpwd = form['vmpasswd'] + fencedev.addAttribute('vmpasswd', vmpwd) + has_vmpasswd = True + except Exception, e: + try: + fencedev.removeAttribute('vmpasswd') + except: + pass + + try: + vmpwd_script = form['vmpasswd_script'].strip() + if not vmpwd_script: + raise Exception, 'blank' + fencedev.addAttribute('vmpasswd_script', vmpwd_script) + has_vmpasswd = True + except Exception, e: + try: + fencedev.removeAttribute('vmpasswd_script') + except: + pass + + if not has_vmpasswd: + errors.append(FD_PROVIDE_VMPASSWD) + + use_ssh = form.has_key('secure') and (form['secure'] == '1' or form['secure'].lower() == 'true') + if use_ssh: + fencedev.addAttribute('secure', '1') + else: + fencedev.removeAttribute('secure') + + return errors + def val_noop_fd(dummy, _dummy): return [] @@ -830,6 +992,8 @@ 'fence_mcdata': val_mcdata_fd, 'fence_egenera': val_egenera_fd, 'fence_bullpap': val_bullpap_fd, + 'fence_lpar': val_lpar_fd, + 'fence_vmware': val_vmware_fd, 'fence_xvm': val_noop_fd, 'fence_scsi': val_noop_fd, 'fence_ilo': val_ilo_fd, @@ -1089,6 +1253,32 @@ return errors +def val_lpar_fi(form, fenceinst): + errors = list() + + try: + partition = form['partition'].strip() + if not partition: + raise Exception, 'blank' + fenceinst.addAttribute('partition', partition) + except Exception, e: + errors.append(FI_PROVIDE_PARTITION) + + return errors + +def val_vmware_fi(form, fenceinst): + errors = list() + + try: + port = form['port'].strip() + if not port: + raise Exception, 'blank' + fenceinst.addAttribute('port', port) + except Exception, e: + errors.append(FI_PROVIDE_PORT) + + return errors + def val_manual_fi(form, fenceinst): nodename = form.get('nodename') if nodename: @@ -1112,6 +1302,8 @@ 'fence_manual': val_manual_fi, 'fence_xvm': val_xvm_fi, 'fence_scsi': val_scsi_fi, + 'fence_lpar': val_lpar_fi, + 'fence_vmware': val_vmware_fi, 'fence_ilo': val_noop_fi, 'fence_ipmilan': val_noop_fi, 'fence_drac': val_noop_fi, --- conga/luci/site/luci/Extensions/LuciClusterInfo.py 2008/08/07 18:07:37 1.1.4.13 +++ conga/luci/site/luci/Extensions/LuciClusterInfo.py 2009/02/11 16:29:37 1.1.4.14 @@ -317,10 +317,48 @@ rc_map['max_depth'] = child_depth return child_depth + 1 - def get_fdom_names(model): return map(lambda x: x.getName(), model.getFailoverDomains()) +def get_svc_recovery_info(svc, model, hmap): + try: + hmap['fdoms'] = get_fdom_names(model) + except Exception, e: + if LUCI_DEBUG_MODE is True: + luci_log.debug_verbose('getServiceInfo1: %r %s' % (e, str(e))) + hmap['fdoms'] = list() + + try: + hmap['domain'] = svc.getAttribute('domain') + except: + hmap['domain'] = None + + try: + hmap['recovery'] = svc.getAttribute('recovery') + except: + hmap['recovery'] = None + + try: + hmap['max_restarts'] = svc.getAttribute('max_restarts') + if not hmap['max_restarts']: + hmap['max_restarts'] = 0 + except: + hmap['max_restarts'] = 0 + + try: + hmap['restart_expire_time'] = svc.getAttribute('restart_expire_time') + if not hmap['restart_expire_time']: + hmap['restart_expire_time'] = 0 + except: + hmap['restart_expire_time'] = 0 + + try: + if int(svc.getAttribute('exclusive')): + hmap['exclusive'] = 'true' + else: + hmap['exclusive'] = 'false' + except: + hmap['exclusive'] = 'false' def getServiceInfo(self, status, model, req): root_uuid = 'toplevel' @@ -332,18 +370,11 @@ if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('getServiceInfo0: no model: %r' % model) return {} + cluname = fvars['clustername'] or model.getClusterName() #set up struct for service config page hmap = {} - try: - cluname = fvars['clustername'] or model.getClusterName() - hmap['fdoms'] = get_fdom_names(model) - except Exception, e: - if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('getServiceInfo1: %r %s' % (e, str(e))) - hmap['fdoms'] = list() - hmap['root_uuid'] = root_uuid # uuids for the service page needed when new resources are created hmap['uuid_list'] = map(lambda x: make_uuid('resource'), xrange(30)) @@ -412,37 +443,7 @@ # first get service by name from model svc = model.getService(servicename) - try: - hmap['domain'] = svc.getAttribute('domain') - except: - hmap['domain'] = None - - try: - hmap['recovery'] = svc.getAttribute('recovery') - except: - hmap['recovery'] = None - - try: - hmap['max_restarts'] = svc.getAttribute('max_restarts') - if not hmap['max_restarts']: - hmap['max_restarts'] = 0 - except: - hmap['max_restarts'] = 0 - - try: - hmap['restart_expire_time'] = svc.getAttribute('restart_expire_time') - if not hmap['restart_expire_time']: - hmap['restart_expire_time'] = 0 - except: - hmap['restart_expire_time'] = 0 - - try: - if int(svc.getAttribute('exclusive')): - hmap['exclusive'] = 'true' - else: - hmap['exclusive'] = 'false' - except: - hmap['exclusive'] = 'false' + get_svc_recovery_info(svc, model, hmap) resource_list = list() if svc is not None: @@ -601,6 +602,8 @@ clumap['os_minor'] = os_minor if os_minor > 1: clumap['vm_migration_choice'] = True + if os_minor > 2: + clumap['has_fence_ssh'] = True elif cluster_os.find('Nahant') != -1: clumap['os_major'] = 4 os_minor = int(cluster_os[cluster_os.find('Update ') + 7]) @@ -1552,6 +1555,7 @@ attrs = vm.getAttributes() if attrs: vm_map.update(attrs) + get_svc_recovery_info(vm, model, vm_map) return vm_map def getResourcesInfo(self, model, request):