- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Trying to return the naa.XXX value for the datatores of a VM
I have been unable to return the Device number for the datastores associated with VMs. Our admins poorly named the datastores so the only way to see what array the VMDKs are being housed on is by looking at the device name.
Is a formate like naa.XXXXX etc.
thanks
my $vm_view = Vim::find_entity_views(view_type=>'VirtualMachine',properties=>['name','config'],begin_entity=>$each_host);
print "\n\tVirtual Machines on this Host:\n";
foreach my $each_vm(@$vm_view){
print "\t\t".$each_vm->name."\n";
my $datastore = $each_vm->datastore->name;
print "Datastore:".$datastore;
my $hardware = $each_vm->config->hardware->device;
foreach my $hw(@$hardware){
if(ref $hw eq 'VirtualDisk'){
print "\t\t\tVirtualDisk:".$hw->backing->fileName."\t".length($hw->backing->fileName)."\t\t".$hw->capacityInKB."\n";
if(length($hw->backing->fileName)>$strlen){ $strlen = length($hw->backing->fileName);}
# $query1->execute($each_vm->name,$hw->backing->fileName,($hw->capacityInKB/1024)) or die(storelater());
}
}
}
}