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

OCPBUGS-38599: incorrect folder gen, workaround govmomi vm folder path bug #8861

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions pkg/infrastructure/vsphere/clusterapi/clusterapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ func initializeFoldersAndTemplates(ctx context.Context, cachedImage string, fail
if err != nil {
return err
}
dcFolders, err := dc.Folders(ctx)
if err != nil {
return fmt.Errorf("unable to get datacenter folder: %w", err)
}

folderPath := path.Join(dcFolders.VmFolder.InventoryPath, clusterID)
// Upstream govmomi bug, workaround
// https://github.com/vmware/govmomi/issues/3523
folderPath := path.Join(dc.InventoryPath, "vm", clusterID)

// we must set the Folder to the infraId somewhere, we will need to remove that.
// if we are overwriting folderPath it needs to have a slash (path)
Expand Down
2 changes: 2 additions & 0 deletions pkg/infrastructure/vsphere/clusterapi/folder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"path"

"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/vmware/govmomi/find"
"github.com/vmware/govmomi/object"
"sigs.k8s.io/cluster-api-provider-vsphere/pkg/session"
Expand Down Expand Up @@ -47,6 +48,7 @@ func createFolder(ctx context.Context, fullpath string, session *session.Session
}

if folder != nil && err == nil {
logrus.Debugf("creating folder %s in vcenter", base)
return folder.CreateFolder(ctx, base)
}
return folder, err
Expand Down