CVSROOT:        /cvs/cluster
Module name:    conga
Branch:         RHEL5
Changes by:     [email protected]  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 <[email protected]> 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 @@
                <tal:block 
metal:use-macro="here/fence-macros/macros/fence-form-egenera" />
        </tal:block>
 
+       <tal:block tal:condition="python: cur_fence_type == 'fence_lpar'">
+               <tal:block 
metal:use-macro="here/fence-macros/macros/fence-form-lpar" />
+       </tal:block>
+       
+       <tal:block tal:condition="python: cur_fence_type == 'fence_vmware'">
+               <tal:block 
metal:use-macro="here/fence-macros/macros/fence-form-vmware" />
+       </tal:block>
+
        <tal:block tal:condition="python: cur_fence_type == 
'fence_bladecenter'">
                <tal:block 
metal:use-macro="here/fence-macros/macros/fence-form-bladecenter" />
        </tal:block>
@@ -323,8 +331,10 @@
        <option name="fence_egenera" value="fence_egenera">Egenera SAN 
Controller</option>
        <option name="fence_bladecenter" value="fence_bladecenter">IBM Blade 
Center</option>
        <option name="fence_bullpap" value="fence_bullpap">Bull PAP</option>
+       <option name="fence_vmware" value="fence_vmware">VMWare Fencing</option>
        <option name="fence_xvm" value="fence_xvm">Virtual Machine 
Fencing</option>
        <option name="fence_scsi" value="fence_scsi">SCSI Fencing</option>
+       <option name="fence_lpar" value="fence_lpar">LPAR Fencing</option>
 </div>
 
 <div metal:define-macro="fence-option-list">
@@ -347,6 +357,8 @@
        <option name="fence_ipmilan" value="fence_ipmilan">IPMI Lan</option>
        <option name="fence_xvm" value="fence_xvm">Virtual Machine 
Fencing</option>
        <option name="fence_scsi" value="fence_scsi">SCSI Fencing</option>
+       <option name="fence_vmware" value="fence_vmware">VMWare Fencing</option>
+       <option name="fence_lpar" value="fence_lpar">LPAR Fencing</option>
        <option name="fence_manual" value="fence_manual">Manual Fencing</option>
 </div>
 
@@ -1084,6 +1096,139 @@
        </div>
 </div>
 
+<div metal:define-macro="fence-form-lpar"
+       tal:attributes="id cur_fencedev/name | nothing">
+
+       <div id="fence_lpar" class="fencedev">
+               <table>
+                       <tr>
+                               <td><strong class="cluster">Fence 
Type</strong></td>
+                               <td>LPAR</td>
+                       </tr>
+                       <tr>
+                               <td>Name</td>
+                               <td>
+                                       <input name="name" type="text"
+                                               tal:attributes="
+                                                       disabled 
cur_fencedev/isShared | nothing;
+                                                       value cur_fencedev/name 
| nothing" />
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>Hostname</td>
+                               <td>
+                                       <input name="ipaddr" type="text"
+                                               disabled cur_fencedev/isShared 
| nothing;
+                                               tal:attributes="value 
cur_fencedev/ipaddr | nothing" />
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>Login</td>
+                               <td>
+                                       <input name="login" type="text"
+                                               disabled cur_fencedev/isShared 
| nothing;
+                                               tal:attributes="value 
cur_fencedev/login | nothing" />
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>Password</td>
+                               <td>
+                                       <input name="passwd" type="password" 
autocomplete="off"
+                                               disabled cur_fencedev/isShared 
| nothing;
+                                               tal:attributes="value nothing" 
/>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>
+                                       <span title="Full path to a script to 
generate fence password">Password Script (optional)</span>
+                               </td>
+                               <td>
+                                       <input type="text" name="passwd_script"
+                                               tal:attributes="
+                                                       disabled 
cur_fencedev/isShared | nothing;
+                                                       value 
cur_fencedev/passwd_script | nothing" />
+                               </td>
+                       </tr>
+               </table>
+
+               <tal:block tal:condition="exists: cur_fencedev">
+                       <input type="hidden" name="existing_device" value="1" />
+                       <input type="hidden" name="orig_name"
+                               tal:attributes="value cur_fencedev/name | 
nothing" />
+               </tal:block>
+
+               <input type="hidden" name="secure" value="1" />
+               <input type="hidden" name="sharable" value="1" />
+               <input type="hidden" name="fence_type" value="fence_lpar" />
+       </div>
+</div>
+
+<div metal:define-macro="fence-form-vmware"
+       tal:attributes="id cur_fencedev/name | nothing">
+
+       <div id="fence_vmware" class="fencedev">
+               <table>
+                       <tr>
+                               <td><strong class="cluster">Fence 
Type</strong></td>
+                               <td>VMWare</td>
+                       </tr>
+                       <tr>
+                               <td>Name</td>
+                               <td>
+                                       <input name="name" type="text"
+                                               tal:attributes="
+                                                       disabled 
cur_fencedev/isShared | nothing;
+                                                       value cur_fencedev/name 
| nothing" />
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>Hostname</td>
+                               <td>
+                                       <input name="ipaddr" type="text"
+                                               disabled cur_fencedev/isShared 
| nothing;
+                                               tal:attributes="value 
cur_fencedev/ipaddr | nothing" />
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>Login</td>
+                               <td>
+                                       <input name="login" type="text"
+                                               disabled cur_fencedev/isShared 
| nothing;
+                                               tal:attributes="value 
cur_fencedev/login | nothing" />
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>Password</td>
+                               <td>
+                                       <input name="passwd" type="password" 
autocomplete="off"
+                                               disabled cur_fencedev/isShared 
| nothing;
+                                               tal:attributes="value nothing" 
/>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>
+                                       <span title="Full path to a script to 
generate fence password">Password Script (optional)</span>
+                               </td>
+                               <td>
+                                       <input type="text" name="passwd_script"
+                                               tal:attributes="
+                                                       disabled 
cur_fencedev/isShared | nothing;
+                                                       value 
cur_fencedev/passwd_script | nothing" />
+                               </td>
+                       </tr>
+               </table>
+
+               <tal:block tal:condition="exists: cur_fencedev">
+                       <input type="hidden" name="existing_device" value="1" />
+                       <input type="hidden" name="orig_name"
+                               tal:attributes="value cur_fencedev/name | 
nothing" />
+               </tal:block>
+
+               <input type="hidden" name="sharable" value="1" />
+               <input type="hidden" name="fence_type" value="fence_vmware" />
+       </div>
+</div>
+
 <div metal:define-macro="fence-form-egenera"
        tal:attributes="id cur_fencedev/name | nothing">
 
@@ -1609,6 +1754,86 @@
        </div>
 </div>
 
+<div metal:define-macro="fence-instance-form-lpar"
+       tal:omit-tag="exists: cur_fence_dev_id">
+       <div id="fence_lpar_instance" name="fence_lpar" 
class="fencedev_instance"
+               tal:omit-tag="exists: cur_fence_dev_id">
+               <table>
+                       <tr>
+                               <td>Partition</td>
+                               <td>
+                                       <input name="partition" type="text"
+                                               tal:attributes="
+                                                       value 
cur_instance/partition | nothing" />
+                               </td>
+                       </tr>
+
+                       <tr><td colspan="2">
+                               <div class="hbSubmit">
+                                       <tal:block 
tal:condition="exists:cur_fence_instance_id">
+                                               <input type="button" 
name="remove_fence"
+                                                       value="Remove this 
instance"
+                                                       tal:attributes="onclick 
python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+                                       </tal:block>
+                                       <tal:block 
tal:condition="not:exists:cur_fence_instance_id">
+                                               <input type="button" 
name="remove_fence"
+                                                       value="Remove this 
instance" />
+                                       </tal:block>
+                               </div>
+                       </td></tr>
+               </table>
+
+               <input type="hidden" name="option" 
tal:condition="exists:cur_instance"
+                       tal:attributes="value cur_instance/option |nothing" />
+               <input type="hidden" name="fence_type" value="fence_lpar" />
+               <input type="hidden" name="fence_instance" value="1" />
+               <input tal:condition="exists: cur_instance"
+                       type="hidden" name="existing_instance" value="1" />
+               <input type="hidden" name="parent_fencedev"
+                       tal:attributes="value cur_fence_dev_id | nothing" />
+       </div>
+</div>
+
+<div metal:define-macro="fence-instance-form-vmware"
+       tal:omit-tag="exists: cur_fence_dev_id">
+       <div id="fence_vmware_instance" name="fence_vmware" 
class="fencedev_instance"
+               tal:omit-tag="exists: cur_fence_dev_id">
+               <table>
+                       <tr>
+                               <td>Partition</td>
+                               <td>
+                                       <input name="partition" type="text"
+                                               tal:attributes="
+                                                       value 
cur_instance/partition | nothing" />
+                               </td>
+                       </tr>
+
+                       <tr><td colspan="2">
+                               <div class="hbSubmit">
+                                       <tal:block 
tal:condition="exists:cur_fence_instance_id">
+                                               <input type="button" 
name="remove_fence"
+                                                       value="Remove this 
instance"
+                                                       tal:attributes="onclick 
python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+                                       </tal:block>
+                                       <tal:block 
tal:condition="not:exists:cur_fence_instance_id">
+                                               <input type="button" 
name="remove_fence"
+                                                       value="Remove this 
instance" />
+                                       </tal:block>
+                               </div>
+                       </td></tr>
+               </table>
+
+               <input type="hidden" name="option" 
tal:condition="exists:cur_instance"
+                       tal:attributes="value cur_instance/option |nothing" />
+               <input type="hidden" name="fence_type" value="fence_vmware" />
+               <input type="hidden" name="fence_instance" value="1" />
+               <input tal:condition="exists: cur_instance"
+                       type="hidden" name="existing_instance" value="1" />
+               <input type="hidden" name="parent_fencedev"
+                       tal:attributes="value cur_fence_dev_id | nothing" />
+       </div>
+</div>
+
 <div metal:define-macro="fence-instance-form-egenera"
        tal:omit-tag="exists: cur_fence_dev_id">
        <div id="fence_egenera_instance" name="fence_egenera" 
class="fencedev_instance"
@@ -2053,6 +2278,10 @@
        <tal:block
                
metal:use-macro="here/fence-macros/macros/fence-instance-form-egenera" />
        <tal:block
+               
metal:use-macro="here/fence-macros/macros/fence-instance-form-lpar" />
+       <tal:block
+               
metal:use-macro="here/fence-macros/macros/fence-instance-form-vmware" />
+       <tal:block
                
metal:use-macro="here/fence-macros/macros/fence-instance-form-wti" />
        <tal:block
                
metal:use-macro="here/fence-macros/macros/fence-instance-form-brocade" />
@@ -2117,6 +2346,16 @@
                        
metal:use-macro="here/fence-macros/macros/fence-instance-form-egenera" />
        </tal:block>
 
+       <tal:block tal:condition="python: cur_fence_type == 'fence_lpar'">
+               <tal:block
+                       
metal:use-macro="here/fence-macros/macros/fence-instance-form-lpar" />
+       </tal:block>
+
+       <tal:block tal:condition="python: cur_fence_type == 'fence_vmware'">
+               <tal:block
+                       
metal:use-macro="here/fence-macros/macros/fence-instance-form-vmware" />
+       </tal:block>
+
        <tal:block tal:condition="python: cur_fence_type == 'fence_bullpap'">
                <tal:block
                        
metal:use-macro="here/fence-macros/macros/fence-instance-form-bullpap" />
--- 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):

Reply via email to