Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 230299

How to improve time to fetch VM from vmhost.

$
0
0

Dear All,

 

Here is my code  which return VM count in

 

real0m38.877s
user0m13.869s
sys 0m0.503s

 

 

for below code, how do i improve the time to fetch the results.

 

my $host_name =  Opts::get_option('vmhost');

 

my $host_view = Vim::find_entity_view(view_type => 'HostSystem', filter => {'name' => $host_name});

 

&listVMs($host_view);

 

    sub listVMs {

    # Prints a list of registered VM on the screen.

    # Does not log it's use.

    #

        my ($host_view) = @_;

        my $vms = Vim::get_views(mo_ref_array => $host_view->vm, properties => ['name','runtime.powerState','guest.toolsRunningStatus']);

        my $totalVMs = 0;

        foreach(@$vms) {

            $totalVMs += 1;

            print "VM: ".$_->{'name'}.", ".$_->{'runtime.powerState'}->val.", "

                   .$_->{'guest.toolsRunningStatus'}.", ".$_->{'mo_ref'}->value."\n";

        }

        print "\nTotal ".$totalVMs." VMs found.\n\n"

    }


Viewing all articles
Browse latest Browse all 230299

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>