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] pbmClient.QueryAssociatedEntity hangs forever #2929

Closed
johananl opened this issue Aug 19, 2022 · 13 comments
Closed

[BUG] pbmClient.QueryAssociatedEntity hangs forever #2929

johananl opened this issue Aug 19, 2022 · 13 comments

Comments

@johananl
Copy link

johananl commented Aug 19, 2022

Describe the bug
The following query hangs forever:

pbmClient.QueryAssociatedEntity(ctx, types.PbmProfileId{UniqueId: storageProfileID}, "virtualDiskId")

To Reproduce
Steps to reproduce the behavior:

Run the following snippet against a vSphere instance which has some storage policy defined (set the 4 env vars below to values which match your environment):

package main

import (
	"context"
	"fmt"
	"log"
	"net/url"
	"os"

	"github.com/vmware/govmomi"
	"github.com/vmware/govmomi/pbm"
	"github.com/vmware/govmomi/pbm/types"
	"github.com/vmware/govmomi/session"
	"github.com/vmware/govmomi/vim25"
	"github.com/vmware/govmomi/vim25/soap"
)

func main() {
	ctx := context.Background()

	server := os.Getenv("VSPHERE_SERVER")
	user := os.Getenv("VSPHERE_USERNAME")
	password := os.Getenv("VSPHERE_PASSWORD")
	storagePolicy := os.Getenv("VSPHERE_STORAGE_POLICY")

	serverURL, err := soap.ParseURL(server)
	if err != nil {
		log.Fatalf("Error parsing server URL: %s", err)
	}

	serverURL.User = url.UserPassword(user, password)

	soapClient := soap.NewClient(serverURL, true)

	vimClient, err := vim25.NewClient(ctx, soapClient)
	if err != nil {
		log.Fatalf("Error creating VIM client: %s", err)
	}

	vsphereClient := &govmomi.Client{
		Client:         vimClient,
		SessionManager: session.NewManager(vimClient),
	}

	if err := vsphereClient.Login(ctx, url.UserPassword(user, password)); err != nil {
		log.Fatalf("Error logging in: %s", err)
	}

	pbmClient, err := pbm.NewClient(ctx, vimClient)
	if err != nil {
		log.Fatalf("Error creating PBM client: %s", err)
	}

	storageProfileID, err := pbmClient.ProfileIDByName(ctx, storagePolicy)
	if err != nil {
		log.Fatalf("Error getting storage profile ID: %s", err)
	}

	fmt.Printf("Storage profile ID: %s\n", storageProfileID)

	entities, err := pbmClient.QueryAssociatedEntity(ctx, types.PbmProfileId{UniqueId: storageProfileID}, "virtualDiskId")
	if err != nil {
		log.Fatalf("Error querying associated entities: %s", err)
	}

	fmt.Println(entities)
}

Expected behavior
I expect to get a list of entities. Instead, the library hangs forever on the pbmClient.QueryAssociatedEntity() call.

Affected version

  • govmomi: latest master which is currently at f036314
  • vCenter: 7.0.1 build 16858589
  • ESXi: VMware ESXi, 7.0.2, 17630552

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

Additional context
I am not sure if the behavior is caused by a bug in govmomi or the server side. Maybe there is a way to replicate the issue using govc to isolate the problem.

@github-actions
Copy link
Contributor

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

@dougm
Copy link
Member

dougm commented Aug 22, 2022

@divyenpatel @SandeepPissay any pointers on how to debug this?

@SandeepPissay
Copy link
Contributor

@dougm it's hard to tell without the vCenter support bundle. @johananl can you file a ticket with VMware GSS along with the vCenter support bundle?

@johananl
Copy link
Author

@SandeepPissay thanks, I'm looking into it.

@johananl
Copy link
Author

@SandeepPissay we've opened a ticket with GSS. Right now they're trying to figure out whether we are "entitled" to get support for SDK issues... 🤷 If you have a way to reach out to the relevant folks internally and tell them the request to open the ticket came from you, that could probably speed things up.

@johananl
Copy link
Author

@SandeepPissay looks like GSS wouldn't help us due to some red tape issue. Maybe this needs to be handled internally at VMware. If there is anything else I can do to help debug this, please let me know.

@github-actions
Copy link
Contributor

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Mark as fresh by adding the comment /remove-lifecycle stale.

@johananl
Copy link
Author

/remove-lifecycle stale

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2023

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Mark as fresh by adding the comment /remove-lifecycle stale.

@johananl
Copy link
Author

johananl commented Mar 2, 2023

/remove-lifecycle stale

@github-actions
Copy link
Contributor

github-actions bot commented Jun 2, 2023

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Mark as fresh by adding the comment /remove-lifecycle stale.

@johananl
Copy link
Author

johananl commented Jun 2, 2023

/remove-lifecycle stale

@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2023

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Mark as fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants