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] device.info Name / Type not camelCase #3241

Closed
xarem opened this issue Sep 27, 2023 · 2 comments · Fixed by #3247
Closed

[BUG] device.info Name / Type not camelCase #3241

xarem opened this issue Sep 27, 2023 · 2 comments · Fixed by #3247

Comments

@xarem
Copy link
Contributor

xarem commented Sep 27, 2023

Description

In v0.31.0, govmomi made big steps into using camelCase, we're currently updating our application to reflect this. We tried to put our findings in separate issues (#3241, #3242, #3243) because not every issue may be a bug.

We found some exceptions in the API, in device.info are still some keys (Name, Type) PascalCased.

Steps to reproduce

vcsim -api-version 8.0 -dc 0 -l :8989 &
export GOVC_URL=https://user:[email protected]:8989/sdk GOVC_SIM_PID=10
export GOVC_INSECURE=true

govc datacenter.create test-dc
govc cluster.create test-cluster
govc cluster.add -hostname test-host -username user -password pass -noverify
govc datastore.create -type local -name test-ds -path /tmp 'test-cluster/*'
govc vm.create -net="VM Network" -m=4096 -c=1 -g=ubuntu -disk=40G -folder=/test-dc/vm test-vm
govc device.info -json -vm test-vm | jq '.Devices[10]'

Result

{
  "Name": "ide-200",
  "Type": "VirtualIDEController",
  "key": 200,
  "deviceInfo": {
    "label": "IDE 0",
    "summary": "IDE 0"
  },
  "busNumber": 0
}

Expected behavior

  1. it should be govc device.info -json -vm test-vm | jq '.devices[10]' (devices camelCase)
  2. expected output:
{
  "name": "ide-200",
  "type": "VirtualIDEController",
  "key": 200,
  "deviceInfo": {
    "label": "IDE 0",
    "summary": "IDE 0"
  },
  "busNumber": 0
}

Affected version

v0.31.0

@DimitarStefanovMihov
Copy link

Hello, Mr. Xarem
I have started a discussion about import.spec since I am not sure if I need to open a new issue - #3244 . I am almost certain that it is connected to the camelCase issue.

@dougm
Copy link
Member

dougm commented Sep 27, 2023

Indeed:

only applies to the generated vim25/types

Device Name is not a generated field, it is defined here:

govmomi/govc/device/info.go

Lines 168 to 170 in 2fab8d5

type infoDevice struct {
Name string
Type string

dougm added a commit to dougm/govmomi that referenced this issue Sep 27, 2023
PR vmware#3007 added camelCase json tags for generated types
BREAKING: This change adds camelCase (lower-case 1st character) json tags for govc types

Fixes vmware#3243
Fixes vmware#3242
Fixes vmware#3241
dougm added a commit to dougm/govmomi that referenced this issue Sep 27, 2023
PR vmware#3007 added camelCase json tags for generated types
BREAKING: This change adds camelCase (lower-case 1st character) json tags for govc types

Fixes vmware#3243
Fixes vmware#3242
Fixes vmware#3241
dougm added a commit to dougm/govmomi that referenced this issue Sep 27, 2023
PR vmware#3007 added camelCase json tags for generated types
BREAKING: This change adds camelCase (lower-case 1st character) json tags for govc types

Fixes vmware#3243
Fixes vmware#3242
Fixes vmware#3241
priyanka19-98 pushed a commit to priyanka19-98/govmomi that referenced this issue Jan 17, 2024
PR vmware#3007 added camelCase json tags for generated types
BREAKING: This change adds camelCase (lower-case 1st character) json tags for govc types

Fixes vmware#3243
Fixes vmware#3242
Fixes vmware#3241
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.

3 participants