Subversion Repositories havirt

Rev

Rev 8 | Rev 11 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8 Rev 10
Line 42... Line 42...
42
our @ISA = qw( Exporter );
42
our @ISA = qw( Exporter );
43
our @EXPORT = qw( 
43
our @EXPORT = qw( 
44
                  &list
44
                  &list
45
                );
45
                );
46
 
46
 
-
 
47
sub status {
-
 
48
   my $return = '';
-
 
49
   &main::loadVirtDB();
-
 
50
   &main::loadNodePopulations();
-
 
51
   &main::loadNodeDB();
-
 
52
   my @header = ('Node','Threads','Memory','Domains','vcpu','mem_used' );
-
 
53
   my @data;
-
 
54
   my $usedmem = 0;
-
 
55
   my $usedcpu = 0;
-
 
56
   my $availmem = 0;
-
 
57
   my $availcpu = 0;
-
 
58
   my $totalDomains = 0;
-
 
59
   foreach my $node (sort keys %$main::nodeDB ) {
-
 
60
      my $memory = 0;
-
 
61
      my $vcpus = 0;
-
 
62
      my $count = 0;
-
 
63
      foreach my $domain ( keys %{ $main::nodePopulations->{$node}->{'running'} } ) {
-
 
64
         $memory += $main::virtDB->{$domain}->{'memory'};
-
 
65
         $vcpus += $main::virtDB->{$domain}->{'vcpu'};
-
 
66
         $count++;
-
 
67
      }
-
 
68
      push @data, [ $node,$main::nodeDB->{$node}->{cpu_count},$main::nodeDB->{$node}->{memory},$count,$vcpus,$memory ];
-
 
69
      $usedmem += $memory;
-
 
70
      $usedcpu += $vcpus;
-
 
71
      $totalDomains += $count;
-
 
72
      $availmem += $main::nodeDB->{$node}->{memory};
-
 
73
      $availcpu += $main::nodeDB->{$node}->{cpu_count};
-
 
74
   } # outer for
-
 
75
   push @data, [ 'Total',$availcpu,$availmem,$totalDomains,$usedcpu,$usedmem ];
-
 
76
   return &main::report( \@header, \@data );
-
 
77
}