Accepted Solution

Cache Table and vCenter

Just a quick question... Checking cache table for vmware it seems that the information related to location of object is not present. Let me say I have 4 vcenter and i need to check if a datastore exists on a specific vcenter (I need it to provision gold images on view). It seems that this information is not present.

There's something planned on the cache table for vmware in the next versions?

Re: Cache Table and vCenter

The "host"  table in vc schema has a field called "data_center_name" .

The "datastore" linked  to host via the lun or via the nfs share

So you can union the two queries

SELECT DISTINCT    'nfs' AS `type`, AS datastore,     hst.data_center_name

FROM vc.data_store AS ds

JOIN vc.lun AS lun

    ON lun.data_store_id =

JOIN hst

    ON = lun.host_id


SELECT DISTINCT    'scsi' AS `type`,,     hst.data_center_name

FROM vc.data_store AS ds

JOIN vc.nas_share AS nas

    ON nas.data_store_id =

JOIN hst

    ON = nas.host_id;

another option is use the virtual machines tables but than you have two assume existence of VMs on the datastore  -and I am not sure you can assume it

hope it helps

Re: Cache Table and vCenter

This is great Thanks

I suppose i should do the same if i want to check a VM presence in a specific vcenter: join between vm and host and check the vcenter in host ...

Re: Cache Table and vCenter

yes, that should work