Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Solved! See The Solution
1 ACCEPTED SOLUTION
migration has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
3 REPLIES 3
migration has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, that should work
