VMware {code} Community
Dwhit
Contributor
Contributor
Jump to solution

Trying to get cpuFeatureMask info

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:

Tags (3)
Reply
0 Kudos
1 Solution

Accepted Solutions
ssurana
VMware Employee
VMware Employee
Jump to solution

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

View solution in original post

Reply
0 Kudos
3 Replies
ssurana
VMware Employee
VMware Employee
Jump to solution

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

Reply
0 Kudos
Dwhit
Contributor
Contributor
Jump to solution

opps, double post, sorry

Reply
0 Kudos
Dwhit
Contributor
Contributor
Jump to solution

Thanks,

That works great !!

David

Reply
0 Kudos