Closed chrischdi closed 3 months ago
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)
}
}
Thank you @chrischdi for the test cases to reproduce, fix opened for review #3399
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
govc pool.create /DC0/host/DC0_C0/Resources/foo
govc pool.create /DC0/host/DC0_C0/Resources/foo/bar
govc find -l /DC0/host/DC0_C0/Resources
govc pool.destroy /DC0/host/DC0_C0/Resources/foo
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
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
:The same happens when using
govc object.destroy
.It does not happen for folders.