Subversion Repositories havirt

Rev

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

Rev 44 Rev 46
Line 84... Line 84...
84
   push @return, "\toff of it and balance them on the other nodes";
84
   push @return, "\toff of it and balance them on the other nodes";
85
 
85
 
86
   return join( "\n", @return ) . "\n";
86
   return join( "\n", @return ) . "\n";
87
}
87
}
88
 
88
 
-
 
89
# status
-
 
90
# Reports the current status of all nodes in the cluster.
-
 
91
# Gathers information about each node, including:
-
 
92
#   - Number of threads (vCPUs)
-
 
93
#   - Total memory
-
 
94
#   - Number of running domains
-
 
95
#   - Total vCPUs and memory used by running domains
-
 
96
#   - Node status (Maintenance or Online)
-
 
97
# Aggregates totals for all nodes and returns a formatted report.
89
sub status {
98
sub status {
90
   my $return = '';
99
   my $return = '';
91
   &main::readDB();
100
   &main::readDB();
92
   my @header = ('Node','Threads','Memory','Domains','vcpu','mem_used', 'Status' );
101
   my @header = ('Node','Threads','Memory','Domains','vcpu','mem_used', 'Status' );
93
   my @data;
102
   my @data;
Line 110... Line 119...
110
      $usedmem += $memory;
119
      $usedmem += $memory;
111
      $usedcpu += $vcpus;
120
      $usedcpu += $vcpus;
112
      $totalDomains += $count;
121
      $totalDomains += $count;
113
      $availmem += $main::statusDB->{'node'}->{$node}->{memory};
122
      $availmem += $main::statusDB->{'node'}->{$node}->{memory};
114
      $availcpu += $main::statusDB->{'node'}->{$node}->{cpu_count};
123
      $availcpu += $main::statusDB->{'node'}->{$node}->{cpu_count};
115
      $maintenance += $main::statusDB->{'node'}->{$node}->{maintenance} ? 0 : 1;
124
      $maintenance += $main::statusDB->{'node'}->{$node}->{'maintenance'} ? 0 : 1;
116
   } # outer for
125
   } # outer for
117
   push @data, [ 'Total',$availcpu,$availmem,$totalDomains,$usedcpu,$usedmem, $maintenance ];
126
   push @data, [ 'Total',$availcpu,$availmem,$totalDomains,$usedcpu,$usedmem, $maintenance ];
118
   return &main::report( \@header, \@data );
127
   return &main::report( \@header, \@data );
119
}
128
}
120
 
129