CVSROOT:        /cvs/cluster
Module name:    conga
Changes by:     [EMAIL PROTECTED]       2007-07-27 16:43:47

Modified files:
        luci/cluster   : form-macros index_html validate_fence.js 
        luci/homebase  : validate_cluster_add.js 
        luci/site/luci/Extensions: FenceHandler.py LuciClusterActions.py 
                                   LuciClusterInfo.py LuciDB.py 
                                   LuciZope.py PropsObject.py 
                                   RicciQueries.py StorageReport.py 
                                   cluster_adapters.py 
                                   conga_constants.py 
        ricci/common   : XML.cpp 
        ricci/test_suite/cluster: generate_xvm_key.xml 

Log message:
        Fixes from the RHEL5 branch

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.204&r2=1.205
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/index_html.diff?cvsroot=cluster&r1=1.36&r2=1.37
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_fence.js.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_cluster_add.js.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterActions.py.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciDB.py.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZope.py.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/PropsObject.py.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/RicciQueries.py.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/StorageReport.py.diff?cvsroot=cluster&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.262&r2=1.263
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.41&r2=1.42
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/XML.cpp.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test_suite/cluster/generate_xvm_key.xml.diff?cvsroot=cluster&r1=1.1&r2=1.2

--- conga/luci/cluster/index_html       2007/07/12 02:42:42     1.36
+++ conga/luci/cluster/index_html       2007/07/27 16:43:47     1.37
@@ -44,7 +44,7 @@
                        <tal:block tal:condition="firsttime">
                                <tal:block tal:define="global busywaiting 
python:True" />
                                <meta http-equiv="refresh"
-                                       tal:attributes="content 
isBusy/refreshurl | python:'3%surl=/luci/cluster' % chr(0x3b)" />
+                                       tal:attributes="content 
isBusy/refreshurl | python:'5%surl=/luci/cluster' % chr(0x3b)" />
                        </tal:block>
 
                        <tal:block tal:define="global busy isBusy/busy | 
nothing" />
@@ -52,7 +52,7 @@
                        <tal:block tal:condition="busy">
                                <tal:block tal:define="global busywaiting 
python:True" />
                                <meta http-equiv="refresh"
-                                       tal:attributes="content 
isBusy/refreshurl | python:'3%surl=/luci/cluster' % chr(0x3b)" />
+                                       tal:attributes="content 
isBusy/refreshurl | python:'5%surl=/luci/cluster' % chr(0x3b)" />
                        </tal:block>
                </tal:block>
     </metal:headslot>
--- conga/luci/cluster/validate_fence.js        2007/07/23 18:53:08     1.10
+++ conga/luci/cluster/validate_fence.js        2007/07/27 16:43:47     1.11
@@ -51,12 +51,22 @@
 }
 
 function validate_field_passwd(form, form_elem) {
+       var errors = [];
        if (form_elem.disabled) {
                clr_form_err(form_elem);
                return (null);
        }
 
-       var errors = validate_field_str(form, form_elem);
+       if (!form_elem || !form_elem.value) {
+               if (!form_elem) {
+                       errors.push('No value was given for this field.');
+               } else {
+                       set_form_err(form_elem);
+                       errors.push(form_elem.name + ' values must not be 
empty.');
+               }
+               return (errors);
+       }
+
        if (errors && errors.length > 0 && form.passwd_script && 
!str_is_blank(form.passwd_script.value))
        {
                clr_form_err(form_elem);
--- conga/luci/homebase/validate_cluster_add.js 2007/07/11 22:47:07     1.10
+++ conga/luci/homebase/validate_cluster_add.js 2007/07/27 16:43:47     1.11
@@ -43,9 +43,13 @@
        if (!view_certs || !view_certs.checked) {
                var confirm_str = '';
                if (form.addnode) {
-                       confirm_str = 'Add ' + (added_storage.length > 1 ? 
'these nodes' : 'this node') + ' to the \"' + clustername + '\" cluster?';
+                       confirm_str = 'Add ' + (added_storage.length > 1 ? 
'these nodes' : 'this node') + ' to the \"' + clustername + '\" cluster?\nEach 
node added will be rebooted during this process.';
                } else {
-                       confirm_str = 'Add the cluster \"' + clustername + '\" 
to the Luci management interface?';
+                       if (form.cluster_create) {
+                               confirm_str = 'All nodes added to this cluster 
will be rebooted as part of this process.\n\nCreate cluster \"' + clustername + 
'\"?';
+                       } else {
+                               confirm_str = 'Add the cluster \"' + 
clustername + '\" to the Luci management interface?';
+                       }
                }
 
                if (confirm(confirm_str)) {
--- conga/luci/site/luci/Extensions/FenceHandler.py     2007/07/12 15:44:43     
1.20
+++ conga/luci/site/luci/Extensions/FenceHandler.py     2007/07/27 16:43:47     
1.21
@@ -772,7 +772,12 @@
        try:
                pwd = form['passwd'].strip()
                if not pwd:
-                       raise Exception, 'blank'
+                       if form['passwd']:
+                               # allow passwords consisting of nothing but 
whitespace
+                               fencedev.addAttribute('passwd', form['passwd'])
+                       else:
+                               raise Exception, 'blank'
+
                fencedev.addAttribute('passwd', pwd)
                has_passwd = True
        except Exception, e:
@@ -1152,6 +1157,11 @@
        fenceinst = Device()
        fenceinst.addAttribute('name', parent_name)
 
+       if form.has_key('option'):
+               option = form['option'].strip()
+               if option:
+                       fenceinst.addAttribute('option', option)
+
        try:
                ret = FI_VALIDATE[fence_agent](form, fenceinst)
                if len(ret) > 0:
--- conga/luci/site/luci/Extensions/LuciClusterActions.py       2007/06/25 
16:11:30     1.3
+++ conga/luci/site/luci/Extensions/LuciClusterActions.py       2007/07/27 
16:43:47     1.4
@@ -245,7 +245,11 @@
                return None
        return True
 
-def NodeLeaveCluster(self, rc, clustername, nodename_resolved):
+def NodeLeaveCluster(  self,
+                                               rc,
+                                               clustername,
+                                               nodename_resolved,
+                                               stop_cluster=False):
        reported_cluname = None
        try:
                cluster_info = rc.cluster_info()
@@ -266,7 +270,7 @@
                                % nodename_resolved)
                return None
 
-       batch_number, result = rq.nodeLeaveCluster(rc)
+       batch_number, result = rq.nodeLeaveCluster(rc, 
cluster_shutdown=stop_cluster)
        if batch_number is None or result is None:
                if LUCI_DEBUG_MODE is True:
                        luci_log.debug_verbose('NLC2: %s: batch_number or 
result is None' \
@@ -367,7 +371,7 @@
        # First, delete cluster.conf from node to be deleted.
        # next, have node leave cluster.
 
-       batch_number, result = rq.nodeLeaveCluster(rc, purge=False)
+       batch_number, result = rq.nodeLeaveCluster(rc, purge=True)
        if batch_number is None or result is None:
                if LUCI_DEBUG_MODE is True:
                        luci_log.debug_verbose('ND5: batch_number and/or result 
is None')
@@ -505,7 +509,8 @@
                                        luci_log.debug_verbose('CStop1: [1] 
nodeDelete failed')
                                errors += 1
                else:
-                       ret = NodeLeaveCluster(self, rc, clustername, 
nodename_resolved)
+                       ret = NodeLeaveCluster(self, rc, clustername,
+                                       nodename_resolved, stop_cluster=True)
                        if ret is None:
                                if LUCI_DEBUG_MODE is True:
                                        luci_log.debug_verbose('CStop2: [0] 
nodeLeave %s' \
--- conga/luci/site/luci/Extensions/LuciClusterInfo.py  2007/07/12 22:35:40     
1.7
+++ conga/luci/site/luci/Extensions/LuciClusterInfo.py  2007/07/27 16:43:47     
1.8
@@ -817,22 +817,19 @@
        found = False
        for item in status:
                if (item['type'] == 'node') and (item['name'] == nodename):
+                       if item['online'] == 'false':
+                               nodestate = NODE_UNKNOWN
+                       elif item['clustered'] == 'true':
+                               nodestate = NODE_ACTIVE
+                       else:
+                               nodestate = NODE_INACTIVE
                        found = True
                        break
 
        if found is False:
-               item = {}
                if LUCI_DEBUG_MODE is True:
-                       luci_log.debug_verbose('getNodeInfo1: Unable to resolve 
node name in cluster status')
-               return item
-
-       # Now determine state of node...
-       if item['online'] == 'false':
+                       luci_log.debug_verbose('getNodeInfo1: Unable to find 
node "%s" in cluster status' % nodename)
                nodestate = NODE_UNKNOWN
-       elif item['clustered'] == 'true':
-               nodestate = NODE_ACTIVE
-       else:
-               nodestate = NODE_INACTIVE
 
        infohash['nodestate'] = nodestate
        infohash['nodename'] = nodename
@@ -899,12 +896,10 @@
 
        infohash['fdoms'] = fdom_dict_list
 
-       # return infohash
        infohash['d_states'] = None
-
        nodename_resolved = resolve_nodename(self, clustername, nodename)
+
        if nodestate == NODE_ACTIVE or nodestate == NODE_INACTIVE:
-       # call service module on node and find out which daemons are running
                try:
                        rc = RicciCommunicator(nodename_resolved)
                        if not rc:
@@ -916,6 +911,7 @@
                                % (nodename_resolved, str(e)))
 
                if rc is not None:
+                       # call service module on node and find out which 
daemons are running
                        dlist = list()
                        dlist.append('ccsd')
                        if not gulm_cluster:
--- conga/luci/site/luci/Extensions/LuciDB.py   2007/07/12 22:35:40     1.5
+++ conga/luci/site/luci/Extensions/LuciDB.py   2007/07/27 16:43:47     1.6
@@ -825,6 +825,7 @@
                                if LUCI_DEBUG_MODE is True:
                                        luci_log.debug_verbose('GRA8: cluster 
name is none for %s' \
                                                % ricci_hostname)
+                               raise Exception, '%s not in a cluster' % 
ricci_hostname
 
                        cur_alias = str(clu_info[1]).strip().lower()
                        if not cur_alias:
@@ -931,7 +932,7 @@
                        luci_log.debug_verbose('GCF0: cluster %s [%s] folder 
missing: %r %s -- returning empty map' % (cluname, path, e, str(e)))
        return None
 
-def getClusterStatusDB(self, clustername, errmsg=None):
+def getClusterStatusDB(self, clustername):
        results = list()
        vals = {}
 
@@ -942,8 +943,6 @@
        vals['quorate'] = '[unknown]'
        vals['votes'] = '[unknown]'
        vals['minQuorum'] = '[unknown]'
-       if errmsg:
-               vals['errmsg'] = errmsg
        results.append(vals)
 
        nodelist = getClusterDBNodes(self, clustername)
--- conga/luci/site/luci/Extensions/LuciZope.py 2007/06/25 16:03:38     1.2
+++ conga/luci/site/luci/Extensions/LuciZope.py 2007/07/27 16:43:47     1.3
@@ -128,11 +128,11 @@
        ret = {}
        for i in varlist:
                pval = None
-               if req.has_key(i):
+               if req and req.has_key(i):
                        pval = req[i].strip()
                        if not pval:
                                pval = None
-               if pval is None:
+               if req and pval is None:
                        if req.form and req.form.has_key(i):
                                pval = req.form[i].strip()
                                if not pval:
--- conga/luci/site/luci/Extensions/PropsObject.py      2007/07/12 22:35:40     
1.6
+++ conga/luci/site/luci/Extensions/PropsObject.py      2007/07/27 16:43:47     
1.7
@@ -7,6 +7,7 @@
 
 from Variable import parse_variable
 from ricci_defines import PROPS_TAG
+import xml
 import xml.dom
 
 class PropsObject:
@@ -26,7 +27,7 @@
         return self.__vars
 
     def export_xml(self, doc, parent_node):
-        props = doc.createElement(PROPS_TAG)
+        props = doc.createElement(str(PROPS_TAG))
         parent_node.appendChild(props)
         for var in self.__vars:
             props.appendChild(self.__vars[var].export_xml(doc))
@@ -36,7 +37,7 @@
         props = None
         for node in parent_node.childNodes:
             if node.nodeType == xml.dom.Node.ELEMENT_NODE:
-                if node.nodeName == PROPS_TAG:
+                if node.nodeName == str(PROPS_TAG):
                     props = node
         if props is None:
             return self
@@ -47,3 +48,4 @@
             except:
                 continue
         return self
+
--- conga/luci/site/luci/Extensions/RicciQueries.py     2007/07/12 22:35:40     
1.4
+++ conga/luci/site/luci/Extensions/RicciQueries.py     2007/07/27 16:43:47     
1.5
@@ -701,17 +701,19 @@
 
        try:
                ret = rc.process_batch(batch)
+               if not ret:
+                       raise Exception, 'no XML response'
        except Exception, e:
                if LUCI_DEBUG_MODE is True:
                        luci_log.debug_verbose('GCC1: process_batch error for 
%s: %r %s' \
                                % (system_info, e, str(e)))
                return None
 
-       if not ret:
-               return None
-
        var_nodes = ret.getElementsByTagName('var')
        for i in var_nodes:
                if i.getAttribute('name') == 'cluster.conf':
                        return i.childNodes[0]
+
+       if LUCI_DEBUG_MODE is True:
+               luci_log.debug_verbose('GCC2: no conf node found')
        return None
--- conga/luci/site/luci/Extensions/StorageReport.py    2007/06/25 16:03:38     
1.24
+++ conga/luci/site/luci/Extensions/StorageReport.py    2007/07/27 16:43:47     
1.25
@@ -2000,7 +2000,7 @@
                                            'id'   : '%s_origin' % bd['path'],
                                            'type' : 'snapshot-origin'})
                 for snap in bd['snapshots']:
-                    high_list[d['id']].append('%s_snapshot', snap['path'])
+                    high_list[d['id']].append('%s_snapshot' % snap['path'])
 
 
 
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2007/07/23 18:53:08     
1.262
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2007/07/27 16:43:47     
1.263
@@ -1749,7 +1749,7 @@
 
        ret = propagateClusterConfAsync(self, model, None, FENCEDEV_NODE_CONFIG,
                        'Updating fence configuration for node "%s"' % 
fvar['nodename'])
-       if ret[1] is not True:
+       if ret[0] is not True:
                return ret
 
        
request.RESPONSE.redirect('%s?pagetype=%s&clustername=%s&nodename=%s&busyfirst=true'
 % (baseurl, NODE, clustername, nodename))
@@ -2123,10 +2123,18 @@
                % (baseurl, SERVICES, clustername))
 
 def process_cluster_conf_editor(self, req):
-       clustername = req['clustername']
+       if req.has_key('clustername'):
+               clustername = req['clustername'].strip() or None
+       else:
+               clustername = None
+
+       if clustername is None:
+               return { 'msg': 'No cluster name was given', 'cluster_conf': '' 
}
+
        msg_list = list(('\n'))
-       cc = ''
-       if 'new_cluster_conf' in req:
+
+       cc = None
+       if req.has_key('new_cluster_conf'):
                cc = req['new_cluster_conf']
                msg_list.append('Checking if valid XML - ')
                cc_xml = None
@@ -2147,12 +2155,10 @@
                                msg_list.append('Fix the error and try 
again:\n')
                        else:
                                msg_list.append('PASSED\n')
-
-                               msg_list.append('Incrementing the cluster 
version number - ')
                                model.setModified(True)
                                msg_list.append('DONE\n')
-
                                msg_list.append('Propagating the new 
cluster.conf')
+
                                rc = getRicciAgent(self, clustername)
                                if not rc:
                                        if LUCI_DEBUG_MODE is True:
--- conga/luci/site/luci/Extensions/conga_constants.py  2007/06/25 16:11:30     
1.41
+++ conga/luci/site/luci/Extensions/conga_constants.py  2007/07/27 16:43:47     
1.42
@@ -134,7 +134,7 @@
        'A problem occurred when starting this node: %s'
 ]
 
-REDIRECT_SEC = 3
+REDIRECT_SEC = 5
 
 # cluster/node create error status messages
 PRE_INSTALL = 'The install state is not yet complete.'
--- conga/ricci/common/XML.cpp  2007/06/25 16:03:42     1.9
+++ conga/ricci/common/XML.cpp  2007/07/27 16:43:47     1.10
@@ -119,15 +119,15 @@
     xml += " " + name + "=\"" + value + "\"";
   }
   if (children().empty())
-    xml += "/>";
+    xml += "/>\n";
   else {
-    xml += ">";
+    xml += ">\n";
     for (list<XMLObject>::const_iterator iter = children().begin();
         iter != children().end();
         iter++) {
-      iter->generate_xml(xml, indent);
+      iter->generate_xml(xml, indent + "\t");
     }
-    xml += indent + "</" + _tag + ">";
+    xml += indent + "</" + _tag + ">\n";
   }
 }
 
--- conga/ricci/test_suite/cluster/generate_xvm_key.xml 2007/07/23 18:47:51     
1.1
+++ conga/ricci/test_suite/cluster/generate_xvm_key.xml 2007/07/27 16:43:47     
1.2
@@ -4,7 +4,9 @@
 
 <module name="cluster">
 <request sequence="1254" API_version="1.0">
-<function_call name="generate_xvm_key" />
+<function_call name="generate_xvm_key">
+       <var mutable="false" name="size" type="int" value="4096" />
+</function_call>
 </request>
 </module>
 

Reply via email to