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

🐛 Remove updates to DeviceGroups #270

Merged
merged 1 commit into from
Nov 13, 2023
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
14 changes: 0 additions & 14 deletions pkg/vmprovider/providers/vsphere/session/session_vm_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,19 +440,6 @@ func UpdateConfigSpecFirmware(
}
}

// UpdateConfigSpecDeviceGroups sets the desired config spec device groups to reconcile by differencing the
// current VM config and the class config spec device groups.
func UpdateConfigSpecDeviceGroups(
config *vimTypes.VirtualMachineConfigInfo,
configSpec, classConfigSpec *vimTypes.VirtualMachineConfigSpec) {

if classConfigSpec.DeviceGroups != nil {
if config.DeviceGroups == nil || !reflect.DeepEqual(classConfigSpec.DeviceGroups.DeviceGroup, config.DeviceGroups.DeviceGroup) {
configSpec.DeviceGroups = classConfigSpec.DeviceGroups
}
}
}

// updateConfigSpec overlays the VM Class spec with the provided ConfigSpec to form a desired
// ConfigSpec that will be used to reconfigure the VM.
func updateConfigSpec(
Expand Down Expand Up @@ -480,7 +467,6 @@ func updateConfigSpec(
vmCtx.VM, updateArgs.ExtraConfig, updateArgs.VirtualMachineImageV1Alpha1Compatible)
UpdateConfigSpecChangeBlockTracking(config, configSpec, updateArgs.ConfigSpec, vmCtx.VM.Spec)
UpdateConfigSpecFirmware(config, configSpec, vmCtx.VM)
UpdateConfigSpecDeviceGroups(config, configSpec, updateArgs.ConfigSpec)

return configSpec
}
Expand Down
53 changes: 0 additions & 53 deletions pkg/vmprovider/providers/vsphere/session/session_vm_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,59 +807,6 @@ var _ = Describe("Update ConfigSpec", func() {

})

Context("DeviceGroups", func() {
var classConfigSpec *vimTypes.VirtualMachineConfigSpec

BeforeEach(func() {
classConfigSpec = &vimTypes.VirtualMachineConfigSpec{}
})

It("No DeviceGroups set in class config spec", func() {
session.UpdateConfigSpecDeviceGroups(config, configSpec, classConfigSpec)
Expect(configSpec.DeviceGroups).To(BeNil())
})

It("DeviceGroups set in class config spec", func() {
classConfigSpec.DeviceGroups = &vimTypes.VirtualMachineVirtualDeviceGroups{
DeviceGroup: []vimTypes.BaseVirtualMachineVirtualDeviceGroupsDeviceGroup{
&vimTypes.VirtualMachineVirtualDeviceGroupsDeviceGroup{
GroupInstanceKey: int32(400),
},
},
}

session.UpdateConfigSpecDeviceGroups(config, configSpec, classConfigSpec)
Expect(configSpec.DeviceGroups).NotTo(BeNil())
Expect(configSpec.DeviceGroups.DeviceGroup).To(HaveLen(1))
deviceGroup := configSpec.DeviceGroups.DeviceGroup[0].GetVirtualMachineVirtualDeviceGroupsDeviceGroup()
Expect(deviceGroup.GroupInstanceKey).To(Equal(int32(400)))
})

It("configInfo DeviceGroups set with vals different than the class config spec", func() {
classConfigSpec.DeviceGroups = &vimTypes.VirtualMachineVirtualDeviceGroups{
DeviceGroup: []vimTypes.BaseVirtualMachineVirtualDeviceGroupsDeviceGroup{
&vimTypes.VirtualMachineVirtualDeviceGroupsDeviceGroup{
GroupInstanceKey: int32(400),
},
},
}

config.DeviceGroups = &vimTypes.VirtualMachineVirtualDeviceGroups{
DeviceGroup: []vimTypes.BaseVirtualMachineVirtualDeviceGroupsDeviceGroup{
&vimTypes.VirtualMachineVirtualDeviceGroupsDeviceGroup{
GroupInstanceKey: int32(500),
},
},
}

session.UpdateConfigSpecDeviceGroups(config, configSpec, classConfigSpec)
Expect(configSpec.DeviceGroups).NotTo(BeNil())
Expect(configSpec.DeviceGroups.DeviceGroup).To(HaveLen(1))
deviceGroup := configSpec.DeviceGroups.DeviceGroup[0].GetVirtualMachineVirtualDeviceGroupsDeviceGroup()
Expect(deviceGroup.GroupInstanceKey).To(Equal(int32(400)))
})
})

Context("Ethernet Card Changes", func() {
var expectedList object.VirtualDeviceList
var currentList object.VirtualDeviceList
Expand Down
14 changes: 0 additions & 14 deletions pkg/vmprovider/providers/vsphere2/session/session_vm_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,19 +435,6 @@ func UpdateConfigSpecFirmware(
}
}

// UpdateConfigSpecDeviceGroups sets the desired config spec device groups to reconcile by differencing the
// current VM config and the class config spec device groups.
func UpdateConfigSpecDeviceGroups(
config *vimTypes.VirtualMachineConfigInfo,
configSpec, classConfigSpec *vimTypes.VirtualMachineConfigSpec) {

if classConfigSpec.DeviceGroups != nil {
if config.DeviceGroups == nil || !reflect.DeepEqual(classConfigSpec.DeviceGroups.DeviceGroup, config.DeviceGroups.DeviceGroup) {
configSpec.DeviceGroups = classConfigSpec.DeviceGroups
}
}
}

// updateConfigSpec overlays the VM Class spec with the provided ConfigSpec to form a desired
// ConfigSpec that will be used to reconfigure the VM.
func updateConfigSpec(
Expand Down Expand Up @@ -475,7 +462,6 @@ func updateConfigSpec(
vmCtx.VM, updateArgs.ExtraConfig, updateArgs.VirtualMachineImageV1Alpha1Compatible)
UpdateConfigSpecChangeBlockTracking(config, configSpec, updateArgs.ConfigSpec, vmCtx.VM.Spec)
UpdateConfigSpecFirmware(config, configSpec, vmCtx.VM)
UpdateConfigSpecDeviceGroups(config, configSpec, updateArgs.ConfigSpec)

return configSpec
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,59 +647,6 @@ var _ = Describe("Update ConfigSpec", func() {
})
})

Context("DeviceGroups", func() {
var classConfigSpec *vimTypes.VirtualMachineConfigSpec

BeforeEach(func() {
classConfigSpec = &vimTypes.VirtualMachineConfigSpec{}
})

It("No DeviceGroups set in class config spec", func() {
session.UpdateConfigSpecDeviceGroups(config, configSpec, classConfigSpec)
Expect(configSpec.DeviceGroups).To(BeNil())
})

It("DeviceGroups set in class config spec", func() {
classConfigSpec.DeviceGroups = &vimTypes.VirtualMachineVirtualDeviceGroups{
DeviceGroup: []vimTypes.BaseVirtualMachineVirtualDeviceGroupsDeviceGroup{
&vimTypes.VirtualMachineVirtualDeviceGroupsDeviceGroup{
GroupInstanceKey: int32(400),
},
},
}

session.UpdateConfigSpecDeviceGroups(config, configSpec, classConfigSpec)
Expect(configSpec.DeviceGroups).NotTo(BeNil())
Expect(configSpec.DeviceGroups.DeviceGroup).To(HaveLen(1))
deviceGroup := configSpec.DeviceGroups.DeviceGroup[0].GetVirtualMachineVirtualDeviceGroupsDeviceGroup()
Expect(deviceGroup.GroupInstanceKey).To(Equal(int32(400)))
})

It("configInfo DeviceGroups set with vals different than the class config spec", func() {
classConfigSpec.DeviceGroups = &vimTypes.VirtualMachineVirtualDeviceGroups{
DeviceGroup: []vimTypes.BaseVirtualMachineVirtualDeviceGroupsDeviceGroup{
&vimTypes.VirtualMachineVirtualDeviceGroupsDeviceGroup{
GroupInstanceKey: int32(400),
},
},
}

config.DeviceGroups = &vimTypes.VirtualMachineVirtualDeviceGroups{
DeviceGroup: []vimTypes.BaseVirtualMachineVirtualDeviceGroupsDeviceGroup{
&vimTypes.VirtualMachineVirtualDeviceGroupsDeviceGroup{
GroupInstanceKey: int32(500),
},
},
}

session.UpdateConfigSpecDeviceGroups(config, configSpec, classConfigSpec)
Expect(configSpec.DeviceGroups).NotTo(BeNil())
Expect(configSpec.DeviceGroups.DeviceGroup).To(HaveLen(1))
deviceGroup := configSpec.DeviceGroups.DeviceGroup[0].GetVirtualMachineVirtualDeviceGroupsDeviceGroup()
Expect(deviceGroup.GroupInstanceKey).To(Equal(int32(400)))
})
})

Context("Ethernet Card Changes", func() {
var expectedList object.VirtualDeviceList
var currentList object.VirtualDeviceList
Expand Down
Loading