Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get VmDiskFileInfo.CapacityKb from .vmdk file? #3376

Closed
SoaringAnecdotalBear opened this issue Feb 29, 2024 · 3 comments
Closed

How to get VmDiskFileInfo.CapacityKb from .vmdk file? #3376

SoaringAnecdotalBear opened this issue Feb 29, 2024 · 3 comments

Comments

@SoaringAnecdotalBear
Copy link

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!

Copy link
Contributor

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.

@dougm
Copy link
Member

dougm commented Mar 13, 2024

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"
      }
    ]
  }
]

@SoaringAnecdotalBear
Copy link
Author

@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"
      }
    ]
  }
]

@vmware vmware locked and limited conversation to collaborators May 31, 2024
@tenthirtyam tenthirtyam converted this issue into discussion #3459 May 31, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

2 participants