I am trying to write a perl script to compare the cpuFeatureMask on the VMs to standard.
I can get the VM view , but I get an problem trying to access the cpuFeatureMask.
Here is the code:
my $result = get_entities(view_type => 'VirtualMachine',
obj => $host);
foreach (@$result) {
my $obj_content = $_;
my $mob = $obj_content->obj;
my $obj = Vim::get_view(mo_ref=>$mob);
my $pobj = Vim::get_view(mo_ref=>$obj->parent);
print "VM :" . $obj->config->name . " \t ";
print "CpuMask :" . $obj->config->cpuFeatureMask . "\n";
Using the above, I get:
CpuMask :ARRAY(0x3bb510c)
If I try to use - print "CpuMask :" . $obj->config->cpuFeatureMask->[1] . "\n"; I get:
CpuMask :HostCpuIdInfo=HASH(0x3bbab3c)
Sorry, but I am not an experianced perl programmer.
Thanks for your help.
David
Using the above, I get:
Hi David,
You can try this:
my $dObj = $obj->config->cpuFeatureMask->[1];
print "\n====\n";
foreach (keys %$dObj) {
print $_ . " => ". $dObj->{$_}."\n";
};
print "\n====\n";
Hope the above helps
~ Sidharth
Hi David,
You can try this:
my $dObj = $obj->config->cpuFeatureMask->[1];
print "\n====\n";
foreach (keys %$dObj) {
print $_ . " => ". $dObj->{$_}."\n";
};
print "\n====\n";
Hope the above helps
~ Sidharth
opps, double post, sorry
Thanks,
That works great !!
David