From 2170014aa0fd334d7f785a8bdad5a839d10a4c27 Mon Sep 17 00:00:00 2001 From: cjhardee Date: Thu, 11 Nov 2010 20:49:49 +0000 Subject: [PATCH] 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 --- xCAT-client/pods/man1/rinv.1.pod | 6 +++++- xCAT-server/lib/xcat/plugins/esx.pm | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/xCAT-client/pods/man1/rinv.1.pod b/xCAT-client/pods/man1/rinv.1.pod index 17628b828..551976e18 100644 --- a/xCAT-client/pods/man1/rinv.1.pod +++ b/xCAT-client/pods/man1/rinv.1.pod @@ -20,7 +20,7 @@ B I {B|B|B|B|B|B|B =head2 VMware specific: -B I +B I [B<-t>] =head1 B @@ -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 diff --git a/xCAT-server/lib/xcat/plugins/esx.pm b/xCAT-server/lib/xcat/plugins/esx.pm index a96074473..a8ecb8af6 100644 --- a/xCAT-server/lib/xcat/plugins/esx.pm +++ b/xCAT-server/lib/xcat/plugins/esx.pm @@ -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;