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: criteria does not work in FetchDVPorts #2733

Closed
Syuparn opened this issue Feb 2, 2022 · 0 comments · Fixed by #2739
Closed

[BUG] vcsim: criteria does not work in FetchDVPorts #2733

Syuparn opened this issue Feb 2, 2022 · 0 comments · Fixed by #2739
Milestone

Comments

@Syuparn
Copy link
Contributor

Syuparn commented Feb 2, 2022

Describe the bug
When FetchDVPorts is requested to vcsim, criteria field is ignored and all ports are responded

To Reproduce
Steps to reproduce the behavior:

  1. Start vcsim
  2. Request FetchDVPorts with criteria as below
var vCenterURL = "https://user:pass@127.0.0.1:8989/sdk"

func main() {
	ctx := context.TODO()
	url, _ := url.Parse(vCenterURL)

	c, _ := govmomi.NewClient(ctx, url, true)
	f := find.NewFinder(c.Client)
	n, _ := f.Network(ctx, "/DC0/network/DVS0")

	dvs := object.NewDistributedVirtualSwitch(c.Client, n.Reference())

	criteria := &types.DistributedVirtualSwitchPortCriteria{
		PortgroupKey: []string{"dvportgroup-11"},
		Inside:       types.NewBool(true),
	}
	ports, err := dvs.FetchDVPorts(ctx, criteria)
	if err != nil {
		fmt.Printf("%+v\n", err)
		return
	}

	for _, port := range ports {
		fmt.Printf("key: %s, portgroupKey: %s\n", port.Key, port.PortgroupKey)
	}
}

Expected behavior
A clear and concise description of what you expected to happen.

  • vcsim responds only ports that belong to portgroups specified in the criteria
> go run main.go
key: 0, portgroupKey: dvportgroup-11

Affected version
Please provide details on the version used, e.g. release tag, commit, module version, etc.

  • vcsim 0.27.2

Screenshots/Debug Output
If applicable, add screenshots or debug output to help explain your problem.

  • vcsim responds all ports in the DVS
> go run main.go
key: dvportgroup-11, portgroupKey:
key: dvportgroup-13, portgroupKey:

Additional context
Add any other context about the problem here.

Syuparn added a commit to Syuparn/govmomi that referenced this issue Feb 5, 2022
Closes: vmware#2733
Signed-off-by: syuparn <s.hello.spagetti@gmail.com>
@dougm dougm added this to the 0.28 milestone Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants