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] VirtualDisk's capacityInBytes not works for vm.AddDevice #2805

Closed
beorereleverion opened this issue Mar 31, 2022 · 4 comments · Fixed by #2814
Closed

[BUG] VirtualDisk's capacityInBytes not works for vm.AddDevice #2805

beorereleverion opened this issue Mar 31, 2022 · 4 comments · Fixed by #2814

Comments

@beorereleverion
Copy link

beorereleverion commented Mar 31, 2022

Describe the bug
VirtualDisk's capacityInKB attribute is deprecated in vSphere API 5.5 but without this vm.AddDevice doesn't work

Disk didn't created.

To Reproduce
create new disk for vm with funciton like in govc(https://github.com/vmware/govmomi/blob/master/govc/vm/disk/create.go#L166)
but change string 166 disk.CapacityInBytes = int64(cmd.Bytes)

Expected behavior
disk created and added to VM

Affected version
github.com/vmware/govmomi v0.27.1

@github-actions
Copy link
Contributor

Howdy 🖐   beorereleverion ! 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.

@beorereleverion beorereleverion changed the title [BUG] [BUG] VirtualDisk's capacityInBytes not works for vm.AddDevice Mar 31, 2022
@HakanSunay
Copy link
Member

create new disk for vm with funciton like in govc(https://github.com/vmware/govmomi/blob/master/govc/vm/disk/create.go#L166)

Let's clarify one thing - did you use:

$ govc vm.disk.create -vm $name -name $name/disk1 -size 10G

or you've written code similar to govc/vm.disk/create.go and observed that vm.AddDevice doesn't work if capacityInBytes is not specified?

@beorereleverion
Copy link
Author

I wrote a code where capacityInBytes is used. That doesn't work.
Then I wrote the code where capacityInKB is used. That's how it worked.
But capacityInKB deprecated - vmware-doc

dougm added a commit to dougm/govmomi that referenced this issue Apr 22, 2022
Config spec helpers have logic to clear the DiskFileOperation for existing disks,
when 'CapacityInKB' is '0'. But we also need to check 'Capacity'.

Refactor some duplicate code into a separate function.

Closes vmware#2805
dougm added a commit to dougm/govmomi that referenced this issue Apr 25, 2022
Config spec helpers have logic to clear the DiskFileOperation for existing disks,
when 'CapacityInKB' is '0'. But we also need to check 'Capacity'.

Refactor some duplicate code into a separate function.

Closes vmware#2805
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.

2 participants