VMware {code} Community
vmal
Contributor
Contributor

How to get the actual size of vmdk files

When exporting a VM, it needs to update the lease with a percentage. In order to calculate the percentage, total size of vmdk files has to be extracted. httpNfcLeaseInfo.getTotalDiskCapacityInKB() doesn't report the actual size of all vmdk files, is there any other way? Noticed that in vSphere client, the percentage report during VM export is pretty accurate, so I assumed that there should be some way to get an accurate total size of vmdk files of a VM.

0 Kudos
3 Replies
Steve_Jin
Expert
Expert

Hi Vmal,

I found the same issue while working on the OVF export sample. The disk capacity could be many times more than the actual size downloaded. This makes the progress monitoring not quite accurate as you would expect. It doesn't make any substantial impact on the exporting. The following sample works just fine.

http://vijava.svn.sourceforge.net/viewvc/vijava/trunk/src/com/vmware/vim25/mo/samples/ovf/ExportOvfT...

If you very much care about the accuracy, you could find other ways to add up sizes.


Steve JIN

Author of VMware VI and vSphere SDK (Prentice Hall)

Creator of open source vSphere (VI) Java API(Tutorial, Testimonials, Download, Samples, Forum)

Blog: DoubleCloud.ORG ( Top 10 Best Practices,[Object Model|http://www.doublecloud.org/2010/02/object-model-of-vmware-vsphere-api-a-big-picture-in-2-minutes/],[Common Mistakes|http://www.doublecloud.org/2010/01/31/common-mistakes-using-vmware-vi-and-vsphere-sdk/], Tiny REST API, Cloud Application Architecture)

Twitter: @sjin2008

Steve JIN Author of VMware VI and vSphere SDK; Creator of open source VI Java API (http://vijava.sf.net); Blogger at http://www.doublecloud.org
0 Kudos
vmal
Contributor
Contributor

Thanks Steve. Yes, we do care about the accurancy because we need to report the progress similar to what's in vSphere client. What's "the other ways" to add up sizes?

0 Kudos
vmal
Contributor
Contributor

Hi Steve,

Can you elaborate on "the other ways" described in your reply ealier?

Thanks!

0 Kudos