Skip to content
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

[BUG] vcsim: ReconfigVM_Task incompletely updates disk's capacity #2889

Closed
Syuparn opened this issue Jun 27, 2022 · 0 comments · Fixed by #2890
Closed

[BUG] vcsim: ReconfigVM_Task incompletely updates disk's capacity #2889

Syuparn opened this issue Jun 27, 2022 · 0 comments · Fixed by #2890

Comments

@Syuparn
Copy link
Contributor

Syuparn commented Jun 27, 2022

Describe the bug
A clear and concise description of what the bug is.

VirtualDisk has two fields which show the disk's capacity, capacityInKB and capacityInBytes.
ReconfigVM_Task allows either one (or both) and reconfigured disk will have both fields updated.
However, vcsim only updates the specified field and the other one remains 0.

To Reproduce

  1. run vcsim without any options
  2. exec govc command below
$ govc vm.disk.create -vm DC0_H0_VM0 -name DC0_H0_VM0/disk2 -size 1G
[24-06-22 21:52:06] Creating disk
# fetch created capacity fields
$ govc device.info -json -vm DC0_H0_VM0 disk-202-1 | jq ".Devices[] | {CapacityInKB, CapacityInBytes}"

Expected behavior

Both fields represent 1GB.

$ govc device.info -json -vm DC0_H0_VM0 disk-202-1 | jq ".Devices[] | {CapacityInKB, CapacityInBytes}"
{
  "CapacityInKB": 1048576,
  "CapacityInBytes": 1073741824
}

Affected version

  • vcsim: 0.28.0

Screenshots/Debug Output

CapacityInBytes is not set.

$ govc device.info -json -vm DC0_H0_VM0 disk-202-1 | jq ".Devices[] | {CapacityInKB, CapacityInBytes}"
{
  "CapacityInKB": 1048576,
  "CapacityInBytes": 0
}

Additional context
Add any other context about the problem here.

If capacityInBytes and CapacityInKB in ReconfigVM_Task represent different capacity, CapacityInBytes takes precedence (in vSphere 7.0u3).

disk.CapacityInBytes = 512 * 1024
disk.CapacityInKB = 1024

err = vm.AddDevice(ctx, disk)
// ...
$ govc device.info -json -vm myvm disk-1000-1 | grep CapacityIn
      "CapacityInKB": 512,
      "CapacityInBytes": 524288,
Syuparn added a commit to Syuparn/govmomi that referenced this issue Jun 27, 2022
Closes: vmware#2889
Signed-off-by: syuparn <s.hello.spagetti@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant