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 does not answer govc find after deleting a resource pool which had a child resource pool #3396

Closed
chrischdi opened this issue Mar 28, 2024 · 2 comments · Fixed by #3399

Comments

@chrischdi
Copy link
Member

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

To Reproduce
Steps to reproduce the behavior:

  1. govc pool.create /DC0/host/DC0_C0/Resources/foo
  2. govc pool.create /DC0/host/DC0_C0/Resources/foo/bar
  3. govc find -l /DC0/host/DC0_C0/Resources
  4. govc pool.destroy /DC0/host/DC0_C0/Resources/foo
  5. govc find -l /DC0/host/DC0_C0/Resources

govc command will be stuck forever and not return or exit.

Expected behavior
Find returns the list of still existing objects.

Affected version

❯ govc version
govc 0.36.2

❯ vcsim version
Build Version: 0.36.2
Build Commit: f2a87d75
Build Date: 2024-03-27T04:34:21Z

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

Additional context

This command still works after govc pool.destroy /DC0/host/DC0_C0/Resources/foo:

❯ govc ls '/DC0/host/DC0_C0/Resources/*'
/DC0/host/DC0_C0/Resources/bar

The same happens when using govc object.destroy.

It does not happen for folders.

@chrischdi
Copy link
Member Author

Unittest which could get used in simulator/finder_test.go for reproduction:

func TestFinderDestroyedParentResourcePool(t *testing.T) {
	ctx := context.Background()

	m := VPX()
	m.Datacenter = 3
	m.Folder = 2
	m.Pool = 1

	defer m.Remove()

	err := m.Create()
	if err != nil {
		t.Fatal(err)
	}

	s := m.Service.NewServer()
	defer s.Close()

	client, err := govmomi.NewClient(ctx, s.URL, true)
	if err != nil {
		t.Fatal(err)
	}

	finder := find.NewFinder(client.Client, false)
	dc, _ := finder.Datacenter(ctx, "/F0/DC1")
	finder.SetDatacenter(dc)

	rp, err := finder.ResourcePool(ctx, "/DC0/host/DC0_C0/Resources")
	if err != nil {
		t.Fatal(err)
	}

	foo, err := rp.Create(ctx, "foo", types.DefaultResourceConfigSpec())
	if err != nil {
		t.Fatal(err)
	}

	bar, err := foo.Create(ctx, "bar", types.DefaultResourceConfigSpec())
	if err != nil {
		t.Fatal(err)
	}

	task, err := foo.Destroy(ctx)
	if err != nil {
		t.Fatal(err)
	}
	if err := task.WaitEx(ctx); err != nil {
		t.Fatal(err)
	}

	if _, err := finder.Element(ctx, bar.Reference()); err != nil {
		t.Fatal(err)
	}
}

@chrischdi chrischdi changed the title [BUG] vcsim find fails after deleting a resource pool which had children [BUG] vcsim does not answer govc find after deleting a resource pool which had a child resource pool Mar 28, 2024
dougm added a commit to dougm/govmomi that referenced this issue Apr 2, 2024
@dougm
Copy link
Member

dougm commented Apr 2, 2024

Thank you @chrischdi for the test cases to reproduce, fix opened for review #3399

dougm added a commit to dougm/govmomi that referenced this issue Apr 2, 2024
dougm added a commit to dougm/govmomi that referenced this issue Apr 2, 2024
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