Skip to content

Commit

Permalink
Ignore VM Class specified default guestID "otherGuest64"
Browse files Browse the repository at this point in the history
The VM Class specified guestID is not supported. Ignore if set.

The guestID is either specified explicity by
- the VM spec (or)
- falls back to the VM Image/OVF
  • Loading branch information
sreyasn committed Jul 5, 2024
1 parent 123f149 commit 82e7be4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/providers/vsphere/virtualmachine/configspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,8 @@ func CreateConfigSpec(
}
}

// Initially set the guest ID in ConfigSpec to ensure VM is created with the expected guest ID.
// If VM Spec guestID is specified, initially set the guest ID in ConfigSpec to ensure VM is created with the expected guest ID.
// Afterwards, only update it if the VM spec guest ID differs from the VM's existing ConfigInfo.
// If the class also specifies a guest ID, it will be overridden by the VM spec guest ID.
if guestID := vmCtx.VM.Spec.GuestID; guestID != "" {
configSpec.GuestId = guestID
}
Expand Down
1 change: 1 addition & 0 deletions pkg/util/configspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func SanitizeVMClassConfigSpec(
// These are unique for each VM.
configSpec.Uuid = ""
configSpec.InstanceUuid = ""
configSpec.GuestId = ""

// Empty Files as they usually ref files in disk
configSpec.Files = nil
Expand Down
2 changes: 2 additions & 0 deletions pkg/util/configspec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ var _ = Describe("SanitizeVMClassConfigSpec", func() {
Name: "dummy-VM",
Annotation: "test-annotation",
Uuid: "uuid",
GuestId: "dummy-guestID",
InstanceUuid: "instanceUUID",
Files: &vimtypes.VirtualMachineFileInfo{},
VmProfile: []vimtypes.BaseVirtualMachineProfileSpec{
Expand Down Expand Up @@ -344,6 +345,7 @@ var _ = Describe("SanitizeVMClassConfigSpec", func() {
Expect(configSpec.Annotation).To(Equal("test-annotation"))
Expect(configSpec.Uuid).To(BeEmpty())
Expect(configSpec.InstanceUuid).To(BeEmpty())
Expect(configSpec.GuestId).To(BeEmpty())
Expect(configSpec.Files).To(BeNil())
Expect(configSpec.VmProfile).To(BeEmpty())

Expand Down

0 comments on commit 82e7be4

Please sign in to comment.