Active IQ Unified Manager Discussions

Cache Table and vCenter

f_duranti
3,241 Views

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?

1 ACCEPTED SOLUTION

dekel
3,241 Views

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`,    ds.name AS datastore,     hst.data_center_name

FROM vc.data_store AS ds

JOIN vc.lun AS lun

    ON lun.data_store_id = ds.id

JOIN vc.host hst

    ON hst.id = lun.host_id

UNION

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

FROM vc.data_store AS ds

JOIN vc.nas_share AS nas

    ON nas.data_store_id = ds.id

JOIN vc.host hst

    ON hst.id = 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

View solution in original post

3 REPLIES 3

dekel
3,242 Views

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`,    ds.name AS datastore,     hst.data_center_name

FROM vc.data_store AS ds

JOIN vc.lun AS lun

    ON lun.data_store_id = ds.id

JOIN vc.host hst

    ON hst.id = lun.host_id

UNION

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

FROM vc.data_store AS ds

JOIN vc.nas_share AS nas

    ON nas.data_store_id = ds.id

JOIN vc.host hst

    ON hst.id = 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

f_duranti
3,241 Views

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 ...

dekel
3,242 Views

yes, that should work

Public