Skip to content

Commit

Permalink
Update GoVmomi to b1027ba34d97 from main
Browse files Browse the repository at this point in the history
This patch updates the GoVmomi dependency to b1027ba34d97 to eagerly
handle some issues it presents:

* the OVF package had some breaking changes
* there was a change in GoVmomi that resulted in the vC Sim datacenter
  MoID changing from datacenter-2 to datacenter-1. The simulated MoIDs
  are not stable, so it should not be hard-coded in VM Op's tests.
* the fallout from the unstable datacenter MoID also impacted the
  backup/restore tests since the UUID for the PVC disk was based on
  the datacenter MoID. This has been addressed as well, albeit with
  another hard-coded value (for now). A fix is needed in GoVmomi
  before it can be used to lookup the actual value.
  • Loading branch information
akutz committed Dec 13, 2024
1 parent 5960911 commit 0ad2242
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 24 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ require (
github.com/vmware-tanzu/vm-operator/external/tanzu-topology v0.0.0-00010101000000-000000000000
github.com/vmware-tanzu/vm-operator/pkg/backup/api v0.0.0-00010101000000-000000000000
github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels v0.0.0-00010101000000-000000000000
github.com/vmware/govmomi v0.31.1-0.20241031174243-82b4ad661180
github.com/vmware/govmomi v0.47.0-alpha.0.0.20241212200752-b1027ba34d97
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc
// * https://github.com/vmware-tanzu/vm-operator/security/dependabot/24
golang.org/x/text v0.19.0
golang.org/x/text v0.21.0
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d
k8s.io/api v0.31.0
k8s.io/apiextensions-apiserver v0.31.0
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/vmware-tanzu/image-registry-operator-api v0.0.0-20240509202721-f6552612433a h1:DWa7KUbaOs89ggmKDjiwBBuuR1ewUbN/U071O79W6v4=
github.com/vmware-tanzu/image-registry-operator-api v0.0.0-20240509202721-f6552612433a/go.mod h1:zn/ponkeFUViyBDhYp9OKFPqEGWYrsR71Pn9/aTCvSI=
github.com/vmware-tanzu/net-operator-api v0.0.0-20240523152550-862e2c4eb0e0 h1:ymNjvIbvYrk+hyNw6+Gat7XI/8z/15eqSD7CLG7VkOI=
github.com/vmware-tanzu/net-operator-api v0.0.0-20240523152550-862e2c4eb0e0/go.mod h1:w6QJGm3crIA16ZIz1FVQXD2NVeJhOgGXxW05RbVTSTo=
github.com/vmware-tanzu/nsx-operator/pkg/apis v0.0.0-20241112044858-9da8637c1b0d h1:z9lrzKVtNlujduv9BilzPxuge/LE2F0N1ms3TP4JZvw=
github.com/vmware-tanzu/nsx-operator/pkg/apis v0.0.0-20241112044858-9da8637c1b0d/go.mod h1:Q4JzNkNMvjo7pXtlB5/R3oME4Nhah7fAObWgghVmtxk=
github.com/vmware/govmomi v0.31.1-0.20241031174243-82b4ad661180 h1:EnF983cbd8pmpi1tvADVIQst/YMlU6tEZYF192gWsho=
github.com/vmware/govmomi v0.31.1-0.20241031174243-82b4ad661180/go.mod h1:uoLVU9zlXC4p4GmLVG+ZJmBC0Gn3Q7mytOJvi39OhxA=
github.com/vmware/govmomi v0.47.0-alpha.0.0.20241212200752-b1027ba34d97 h1:cU+/GAgXM2PvaynD0SE/SmQrATKoH1BHYr8aLif0fC4=
github.com/vmware/govmomi v0.47.0-alpha.0.0.20241212200752-b1027ba34d97/go.mod h1:bYwUHpGpisE4AOlDl5eph90T+cjJMIcKx/kaa5v5rQM=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down Expand Up @@ -155,8 +155,8 @@ golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA=
golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/vsphere/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ var _ = Describe("Client", Label(testlabels.VCSim), Ordered /* Avoided race for
},
CAFilePath: serverCertFile,
InsecureSkipTLSVerify: false,
Datacenter: "datacenter-2",
Datacenter: simulator.Map.Any("Datacenter").Reference().Value,
}
})

Expand Down
4 changes: 2 additions & 2 deletions pkg/providers/vsphere/contentlibrary/content_library_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ func initImageStatusFromOVFVirtualSystem(
}

// Use operating system info from the first os section in the VM image, if one exists.
if os := ovfVirtualSystem.OperatingSystem; len(os) > 0 {
o := os[0]
if os := ovfVirtualSystem.OperatingSystem; os != nil {
o := os

osInfo := &imageStatus.OSInfo
osInfo.ID = strconv.Itoa(int(o.ID))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,10 @@ var _ = Describe("UpdateVmiWithOvfEnvelope", func() {
},
},
},
OperatingSystem: []ovf.OperatingSystemSection{
{
OSType: ptr.To("dummy_os_type"),
ID: int16(100),
Version: ptr.To("dummy_version"),
},
OperatingSystem: &ovf.OperatingSystemSection{
OSType: ptr.To("dummy_os_type"),
ID: int16(100),
Version: ptr.To("dummy_version"),
},
VirtualHardware: []ovf.VirtualHardwareSection{
{
Expand Down
14 changes: 11 additions & 3 deletions pkg/providers/vsphere/virtualmachine/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml"

"github.com/go-logr/logr"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/vmware/govmomi/object"
Expand All @@ -26,6 +27,7 @@ import (
"github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/virtualmachine"
pkgutil "github.com/vmware-tanzu/vm-operator/pkg/util"
"github.com/vmware-tanzu/vm-operator/test/builder"
"github.com/vmware-tanzu/vm-operator/test/testutil"
)

//nolint:gocyclo
Expand All @@ -34,8 +36,13 @@ func backupTests() {
// These are the default values of the vcsim VM that are used to
// construct the expected backup data in the following tests.
vcSimVMPath = "DC0_C0_RP0_VM0"
vcSimDiskUUID = "be8d2471-f32e-5c7e-a89b-22cb8e533890"
vcSimDiskFileName = "[LocalDS_0] DC0_C0_RP0_VM0/disk1.vmdk"

// TODO(akutz) Do not hard-code this value. Instead use
// QueryVirtualDiskUuid to find it from the file name.
// However, there is a bug in vC Sim's implementation of
// this function, so hard-code for now.
vcSimDiskUUID = "60c03576-c448-58e1-a47a-1165dd2c4120"
// dummy backup versions at timestamp t1, t2, t3.
vT1 = "1001"
vT2 = "1002"
Expand Down Expand Up @@ -84,9 +91,10 @@ func backupTests() {
vcVM, err = ctx.Finder.VirtualMachine(ctx, "DC0_C0_RP0_VM0")
Expect(err).NotTo(HaveOccurred())

logger := testutil.GinkgoLogr(5)
vmCtx = pkgctx.VirtualMachineContext{
Context: ctx,
Logger: suite.GetLogger().WithValues("vmName", vcVM.Name()),
Context: logr.NewContext(ctx, logger),
Logger: logger.WithValues("vmName", vcVM.Name()),
VM: builder.DummyVirtualMachine(),
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/util/ovfcache/internal/ovfcache_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ var _ = Describe("GetOVFEnvelope", func() {
ctx,
func(ctx context.Context, itemID string) (*ovf.Envelope, error) {
return &ovf.Envelope{
Product: &ovf.ProductSection{},
References: []ovf.File{},
}, nil
})
})
It("should return env", func() {
env, err := internal.GetOVFEnvelope(ctx, fakeString, "v1")
Expect(err).ToNot(HaveOccurred())
Expect(env).To(Equal(&ovf.Envelope{
Product: &ovf.ProductSection{},
References: []ovf.File{},
}))

// Change what the getter returns.
Expand All @@ -200,7 +200,7 @@ var _ = Describe("GetOVFEnvelope", func() {
env, err = internal.GetOVFEnvelope(ctx, fakeString, "v1")
Expect(err).ToNot(HaveOccurred())
Expect(env).To(Equal(&ovf.Envelope{
Product: &ovf.ProductSection{},
References: []ovf.File{},
}))
})
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/vsphere/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ var _ = Describe("Client", Label(testlabels.VCSim), Ordered /* Avoided race for
Password: expectedPassword,
CAFilePath: serverCertFile,
Insecure: false,
Datacenter: "datacenter-2",
Datacenter: simulator.Map.Any("Datacenter").Reference().Value,
}
})

Expand Down

0 comments on commit 0ad2242

Please sign in to comment.