VMware {code} Community
ChaitanyaS
Contributor
Contributor

Gathering details of all DataStores

hi,

Is it possible to gather details of all the datastores using web services?

In my client application. i want to keep details of all available data stores in my database.

Can one virtula machine use many disks? ( As per my knowledge, one disk can be shared by multiple virtual machines., Am i right?)

(I've referred to DataStore managed object from the documentation. What i understand is data store is independent of hosts (ESX servers) and the virtual machines. Many hosts can connect to one data store. Similarly one data store can have many virtual disks i.e. virtual machines. )

Reply
0 Kudos
2 Replies
lamw
Community Manager
Community Manager

Yes I VM can have it's virtual disk spread across multiple datastores. I would not hardcode any of the datastore names unless you know for fact it will not be changing that often, else a simple query against a datacenter/cluster could return you all datastores.

If you're using vSphere 4.0, you can look at a new parameter that is part of the virtual machine called storageInfo which provides you with all the virtual disks for a given VM is located at and how much is being consumed

Depending on what you're trying to accomplish, all this data is available and may be available in different parts of the infrastructure.

Here are a few sample scripts involving datastores and various tasks/operations that may help get you started:

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

ChaitanyaS
Contributor
Contributor

Thank you very much. It's helpful. I'll look into it.

Reply
0 Kudos