Closed SoaringAnecdotalBear closed 1 month ago
Howdy 🖐 SoaringAnecdotalBear ! Thank you for your interest in this project. We value your feedback and will respond soon.
If you want to contribute to this project, please make yourself familiar with the CONTRIBUTION
guidelines.
That TODO is part of the simulator, do you need that or the client side against a real vCenter?
For real vCenter, you can use VM's devices VirtualDisk.CapacityKb
, for example:
% govc device.info -dump -vm MinIO disk-*
...
BaseVirtualDevice: &types.VirtualDisk{
...
CapacityInKB: 16777216,
...
Or you can use HostDatastoreBrowser to get a .vmdk's capacity directly, for example:
% govc datastore.ls -l MinIO/*.vmdk
16.0GB Wed Mar 13 17:31:51 2024 MinIO.vmdk
% govc datastore.ls -json -l MinIO/*.vmdk
[
{
"datastore": {
"type": "Datastore",
"value": "datastore-12"
},
"folderPath": "[datastore1] MinIO/",
"file": [
{
"path": "MinIO.vmdk",
"fileSize": 17179869184,
"modification": "2024-03-13T17:31:51Z",
"owner": "root"
}
]
}
]
@dougm thks for your reply The last way seems to get the physical capacity, and the first way needs that the disk was attached to one vm. But I want to get the logical capacity for vmdk which is not attached to any vm.
That TODO is part of the simulator, do you need that or the client side against a real vCenter? For real vCenter, you can use VM's devices
VirtualDisk.CapacityKb
, for example:% govc device.info -dump -vm MinIO disk-* ... BaseVirtualDevice: &types.VirtualDisk{ ... CapacityInKB: 16777216, ...
Or you can use HostDatastoreBrowser to get a .vmdk's capacity directly, for example:
% govc datastore.ls -l MinIO/*.vmdk 16.0GB Wed Mar 13 17:31:51 2024 MinIO.vmdk % govc datastore.ls -json -l MinIO/*.vmdk [ { "datastore": { "type": "Datastore", "value": "datastore-12" }, "folderPath": "[datastore1] MinIO/", "file": [ { "path": "MinIO.vmdk", "fileSize": 17179869184, "modification": "2024-03-13T17:31:51Z", "owner": "root" } ] } ]
How to get VmDiskFileInfo.CapacityKb from .vmdk file? I found a TODO here(host_datastore_browser.go 89-91). Does it means Govmomi is unable to get VmDiskFileInfo.CapacityKb? Or is there a other way to get VmDiskFileInfo.CapacityKb? thanks!