vmware / govmomi

Go library for the VMware vSphere API
Apache License 2.0
2.32k stars 913 forks source link

[BUG] DatacentersFolders.VmFolder is not a complete path when datacenter is in a datacenter folder. #3523

Closed jcpowermac closed 3 months ago

jcpowermac commented 3 months ago

Describe the bug

DatacentersFolders.VmFolder is not a complete path when datacenter is in a datacenter folder.

using this snipit and output as the example

    dc, err := finder.Datacenter(ctx, failureDomain.Topology.Datacenter)
        if err != nil {
                return err
        }

        dcFolders, err := dc.Folders(ctx)
        if err != nil {
                return fmt.Errorf("unable to get datacenter folder: %w", err)
        }

        logrus.Debugf("datacenter inventory path: %s", dc.InventoryPath)

        logrus.Debugf("datacenter vm folder inventory path: %s\n", folderPath)

output

DEBUG datacenter inventory path: /dcfolder/dcfolder1/dcfolder2/nested8-datacenter 
DEBUG datacenter vm folder inventory path: /nested8-datacenter/vm/jcallen3-rlr9v 

To Reproduce Steps to reproduce the behavior:

  1. always, see above

Expected behavior

The DatacenterFolders.VmFolder is the full complete path to /vm (for our example that is /dcfolder/dcfolder1/dcfolder2/nested8-datacenter/vm)

Affected version github.com/vmware/govmomi v0.37.2

github-actions[bot] commented 3 months ago

Howdy 🖐   jcpowermac ! 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 commented 3 months ago

@jcpowermac , looks like you already worked around, but fix is merged. This bug has been there almost 9 years, sigh.

jcpowermac commented 3 months ago

Thanks @dougm !