VMware {code} Community
jeyakarthika
Contributor
Contributor

Problem in getting datastore free space using VI SDK

Hi,

In our environment, we have one vCenter which is managing multiple ESX servers. All the ESX servers are sharing one datastore. We have a sample script written in java with VI SDK used to collect free space of datastore. The script is using the object DatastoreSummary.freeSpace. We found that except on two servers where this metric is giving wrong values when compared with VI client. Is this VI SDK problem

Thanks in Advance,

Karthika

Reply
0 Kudos
2 Replies
njain
Expert
Expert

Hi Karthika,

Since multiple hosts are sharing the same datastore, it might be possible that the change occurred in the free capacity of the datastore due to one host is not reflected under other hosts.

Use the "RefreshDatastore" API before collecting value from DatastoreSummary.freeSpace property and see if you get the correct values for the free space, as available in VI Client. This method will explicitly refresh the free space and capacity values under "DatastoreSummary" and "DatastoreInfo" objects and pick up any changes that might have occurred.

Hope this helps.

Reply
0 Kudos
balainfo
Contributor
Contributor

Hi,

Have 75 datastores connected to a vCenter server. I tried using the API call to refresh datastore before we collect disk usage metrics.

If i do this on each of my datastores, it takes a long time to complete. Sometimes, the call just hangs and even if i timeout in my code

and reconnect again, i see an error as follows:

java.net.ConnectException: Connection refused: connect

at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)

at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154)

at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)

at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)

at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)

at org.apache.axis.client.Call.invokeEngine(Call.java:2784)

at org.apache.axis.client.Call.invoke(Call.java:2767)

at org.apache.axis.client.Call.invoke(Call.java:2443)

at org.apache.axis.client.Call.invoke(Call.java:2366)

at org.apache.axis.client.Call.invoke(Call.java:1812)

at com.vmware.vim25.VimBindingStub.refreshDatastore(VimBindingStub.java:38260)

Please help!

Regards,

R.

Reply
0 Kudos