Changeset 562 for trunk


Ignore:
Timestamp:
01/22/09 10:54:22 (15 years ago)
Author:
ramonb
Message:

web2/addons/job_monarch/libtoga.php:

  • once and for all REALLY fixed hostname FQDN detection
  • fixed owner filtering of nodes when multiple jobs present with different owners

web2/addons/job_monarch/jobstore.php:

  • removed domain/hostname FQDN handling: is now all done in libtoga

web2/addons/job_monarch/js/jobgrid.js:

  • test alert
Location:
trunk/web2/addons/job_monarch
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/web2/addons/job_monarch/jobstore.php

    r553 r562  
    251251                                        foreach( $jobattrs[nodes] as $mynode )
    252252                                        {
    253                                                 if( $use_fqdn == 1)
    254                                                 {
    255                                                         $mynode = $mynode.".".$jobattrs[domain];
    256                                                 }
     253                                                //if( $use_fqdn == 1)
     254                                                //{
     255                                                //      $mynode = $mynode.".".$jobattrs[domain];
     256                                                //}
    257257                                                $mynodehosts[]  = $mynode;
    258258                                        }
  • trunk/web2/addons/job_monarch/js/jobgrid.js

    r561 r562  
    507507                                                        }
    508508                                                        win.show( this );
     509                                                        alert( CheckJobs.getSelections() );
    509510                                                }
    510511                                        }
  • trunk/web2/addons/job_monarch/libtoga.php

    r549 r562  
    591591                $offline_nodes          = array();
    592592                $this->clustername      = $clustername;
    593                 $this->fqdn             = 1;
     593                $this->fqdn             = 0;
     594                $this->fqdnFound        = 0;
    594595        }
    595596
     
    634635                $nodes = &$this->nodes;
    635636
    636                 $fqdn = 1;
    637 
    638                 //$tdomain = explode( '.', $thostname );
    639                 //
    640                 // TODO?: extract domain from hostname or something?
    641 
    642                 if( $tdomain )
    643                 {
    644                         $domain_len     = 0 - strlen( $tdomain );
    645 
    646                         // Let's see if Ganglia use's FQDN or short hostnames
    647                         //
    648                         foreach( $nodes as $hostname => $nimage )
    649                         {
    650                                 if( substr( $hostname, $domain_len ) != $tdomain )
    651                                 {
    652                                         $fqdn   = 0;
    653                                 }
    654                         }
    655                 }
    656                 else
    657                 {
    658                         $fqdn   = 0;
    659                 }
     637                $domain_len     = 0 - strlen( $tdomain );
    660638       
    661                 if( $tdomain && $fqdn )
     639                if( $tdomain && $this->fqdn )
    662640                {
    663641                        if( substr( $thostname, $domain_len ) != $tdomain )
     
    665643                                $thostname = $thostname . '.'.$tdomain;
    666644                        }
    667                         else
    668                         {
    669                                 $thostname = $thostname;
    670                         }
    671645                }
    672646
     
    697671                {
    698672                        $hostname = $attrs[NAME];
     673
     674                        // Assume to use FQDN if we find a '.' in the hostname
     675                        //
     676                        if( strpos( $hostname, '.' ) !== false )
     677                        {
     678                                if( !$this->fqdnFound )
     679                                {
     680                                        $this->fqdn             = 1;
     681                                        $this->fqdnFound        = 1;
     682                                }
     683                        }
     684                        else
     685                        {
     686                                if( !$this->fqdnFound )
     687                                {
     688                                        $this->fqdn             = 0;
     689                                        $this->fqdnFound        = 1;
     690                                }
     691                        }
    699692
    700693                        $location = $attrs[LOCATION];
     
    746739                                        }
    747740                                }
     741                                $down_nodes     = $nodes_down;
     742
     743                                foreach( $down_nodes as $node )
     744                                {
     745                                        $nodes_down[] = $this->makeHostname( $node, $down_domain );
     746                                }
    748747                        }
    749748                        else if( strstr( $attrs[NAME], 'MONARCH-OFFLINE' ) )
     
    782781                                        }
    783782                                }
     783                                $offline_nodes  = $nodes_offline;
     784
     785                                foreach( $offline_nodes as $node )
     786                                {
     787                                        $nodes_offline[] = $this->makeHostname( $node, $offline_domain );
     788                                }
    784789                        }
    785790                        else if( strstr( $attrs[NAME], 'MONARCH-JOB' ) )
     
    838843                                        if( $jobs[$jobid][status] == 'R' )
    839844                                        {
    840 
    841845                                                if( isset( $jobs[$jobid][domain] ) )
    842846                                                {
    843847                                                        $domain         = $jobs[$jobid][domain];
    844                                                         $domain_len     = 0 - strlen( $domain );
    845 
    846                                                         // Let's see if Ganglia use's FQDN or short hostnames
    847                                                         //
    848                                                         foreach( $nodes as $hostname => $nimage )
    849                                                         {
    850                                        
    851                                                                 if( substr( $hostname, $domain_len ) != $domain )
    852                                                                 {
    853                                                                         $this->fqdn     = 0;
    854                                                                 }
    855                                                         }
    856848                                                }
    857                                                 else
    858                                                 {
    859                                                         $this->fqdn     = 0;
    860                                                 }
     849                                                $job_nodes      = array();
    861850
    862851                                                foreach( $jobs[$jobid][nodes] as $node )
    863852                                                {
    864 
    865853                                                        // Only add domain name to the hostname if Ganglia is doing that too
    866854                                                        //
    867                                                         if( $this->fqdn && isset( $jobs[$jobid][domain] ) )
    868                                                         {
    869                                                                 if( substr( $node, $domain_len ) != $domain )
    870                                                                 {
    871                                                                         $host = $node. '.'.$domain;
    872                                                                 } else
    873                                                                 {
    874                                                                         $host = $node;
    875                                                                 }
    876                                                         }
    877                                                         else
    878                                                         {
    879                                                                 $host   = $node;
    880                                                         }
     855                                                        $host   = $this->makeHostname( $node, $domain );
    881856
    882857                                                        if( !isset( $nodes[$host] ) )
     
    901876                                                        }
    902877
    903                                                         $nodes[$host] = $my_node;
     878                                                        $nodes[$host]   = $my_node;
     879                                                        $job_nodes[]    = $host;
    904880                                                }
     881                                                $jobs[$jobid][nodes]    = $job_nodes;
    905882                                        }
    906883                                }
     
    13711348                                                                if( $filtername != 'jobid' && $filtername != 'host' )
    13721349                                                                {
    1373                                                                         if( $jobs[$myjob][$filtername] != $filtervalue )
     1350                                                                        //if( $filtername == 'owner' )
     1351                                                                        //{
     1352                                                                        //      printf( "%s ?= %s\n", $jobs[$myjob][$filtername], $filtervalue );
     1353                                                                        //}
     1354                                                                        if( $jobs[$myjob][$filtername] == $filtervalue )
     1355                                                                        {
     1356                                                                                $addhost = 1;
     1357                                                                                continue;
     1358                                                                        }
     1359                                                                        else if( $jobs[$myjob][$filtername] != $filtervalue )
    13741360                                                                        {
    13751361                                                                                $addhost = 0;
     1362                                                                        //      printf( "vergeet host\n" );
    13761363                                                                        }
    13771364                                                                }
Note: See TracChangeset for help on using the changeset viewer.