Added a -t option to the vmware version of rinv to update the vm table with the values retrieved from vcener for memory and cpu count

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8136 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
cjhardee 2010-11-11 20:49:49 +00:00
parent a0829627bb
commit 2170014aa0
2 changed files with 29 additions and 1 deletions

View File

@ -20,7 +20,7 @@ B<rinv> I<noderange> {B<mtm>|B<serial>|B<mac>|B<bios>|B<diag>|B<mprom>|B<mparom>
=head2 VMware specific:
B<rinv> I<noderange>
B<rinv> I<noderange> [B<-t>]
=head1 B<Description>
@ -94,6 +94,10 @@ Print help.
Print version.
=item B<-t>
Set the values in the vm table to what vCenter has for the indicated nodes.
=back
=head1 B<Examples>

View File

@ -565,6 +565,24 @@ sub inv {
return;
}
}
@ARGV= @{$args{exargs}};
require Getopt::Long;
my $tableUpdate;
my $rc = GetOptions(
't' => \$tableUpdate,
);
$SIG{__WARN__} = 'DEFAULT';
if(@ARGV) {
xCAT::SvrUtils::sendmsg("Invalid arguments: @ARGV", $output_handler);
return;
}
if(!$rc) {
return;
}
my $vmview = $args{vmview};
my $moref = $vmview->{mo_ref}->value;
xCAT::SvrUtils::sendmsg("Managed Object Reference: $moref", $output_handler,$node);
@ -574,6 +592,12 @@ sub inv {
xCAT::SvrUtils::sendmsg("CPUs: $cpuCount", $output_handler,$node);
my $memory = $vmview->config->hardware->memoryMB;
xCAT::SvrUtils::sendmsg("Memory: $memory MB", $output_handler,$node);
if($tableUpdate){
my $vm=xCAT::Table->new('vm',-create=>1);
$vm->setNodeAttribs($node,{cpus=>$cpuCount, memory=>$memory});
}
my $devices = $vmview->config->hardware->device;
my $label;
my $size;