Subversion Repositories havirt

Rev

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

Rev 7 Rev 9
Line 54... Line 54...
54
  'Memory size' => 'memory',
54
  'Memory size' => 'memory',
55
  'NUMA cell(s)' => 'numa_cells',
55
  'NUMA cell(s)' => 'numa_cells',
56
  'Thread(s) per core' => 'threads_per_core'
56
  'Thread(s) per core' => 'threads_per_core'
57
);
57
);
58
 
58
 
-
 
59
# show a help screen
-
 
60
sub help {
-
 
61
   my @return;
-
 
62
   push @return, "node update [nodename|-t nodename]";
-
 
63
   push @return, "\tUpdates capabilities on one or more nodes, default is all nodes";
-
 
64
   push @return, "node list [--format|-f screen|tsv]";
-
 
65
   push @return, "\tLists all nodes with some statistics about them as screen or tsv (default screen)";
-
 
66
   push @return, "node scan [nodename|-t nodename]";
-
 
67
   push @return, "\tUpdates list of domains on one or more existing nodes, default is all nodes";
-
 
68
   return join( "\n", @return ) . "\n";
-
 
69
}
-
 
70
 
-
 
71
 
59
# read the node database into memory, if it was not already loaded
72
# read the node database into memory, if it was not already loaded
60
sub loadNodeDB {
73
sub loadNodeDB {
61
   print "In loadNodeDB, reading $main::nodeDBName\n" if $main::DEBUG > 1;
74
   print "In loadNodeDB, reading $main::nodeDBName\n" if $main::DEBUG > 1;
62
   return if $main::nodeDB;
75
   return if $main::nodeDB;
63
   $main::nodeDB = &main::readDB( $main::nodeDBName );
76
   $main::nodeDB = &main::readDB( $main::nodeDBName );
Line 100... Line 113...
100
   return &main::report( \@header, \@data );
113
   return &main::report( \@header, \@data );
101
}
114
}
102
 
115
 
103
# Get information about a node. Really only needs to be done when a node is
116
# Get information about a node. Really only needs to be done when a node is
104
# first defined, or if there is a hardware upgrade
117
# first defined, or if there is a hardware upgrade
-
 
118
# reads information off of the stack (@_), but will add to that if --target
-
 
119
# was defined
105
sub update {
120
sub update {
106
   &loadNodeDB();
121
   &loadNodeDB();
107
   my $return;
122
   my $return;
108
   my @targets;
123
   my @targets;
109
   if ( $main::targetNode ) {
124
   if ( $main::targetNode ) {
110
      push @targets, $main::targetNode;
125
      push @_, $main::targetNode;
111
   } else {
-
 
112
      @targets = keys %$main::nodeDB;
-
 
113
   }
126
   }
-
 
127
   @_ = keys %$main::nodeDB unless @_;
114
   while ( my $nodename = shift @targets ) {
128
   while ( my $nodename = shift  ) {
115
      print "Updating $nodename\n" if $main::DEBUG;
129
      print "Updating $nodename\n" if $main::DEBUG;
116
      $return = `ssh $nodename 'virsh nodeinfo'`;
130
      $return = `ssh $nodename 'virsh nodeinfo'`;
117
      print "Output of ssh $nodename 'virsh nodeinfo' is\n" . $return if $main::DEBUG;
131
      print "Output of ssh $nodename 'virsh nodeinfo' is\n" . $return if $main::DEBUG;
118
      my @nodeinfo = split( "\n", $return );
132
      my @nodeinfo = split( "\n", $return );
119
      for ( my $i = 0; $i < @nodeinfo; $i++ ) {
133
      for ( my $i = 0; $i < @nodeinfo; $i++ ) {