Use a GetMinimumCompatibleHardwareVersion for configSpec devices
Please describe the solution you would like.
Implement a GetMinimumCompatibleHardwareVersion with args configSpec and floorHardwareVersion int32 as the known, minimum hardware version in pkg/util/vsphere/vm.
This function can then be used to determine the minimum, compatible hardware version for the provided configSpec with a value that cannot be less than the provided floorHardwareVersion. The caller will then determine what value to send in for floorHardwareVersion by determining:
For example, in HardwareVersionForPVCandPCIDevices
if the VM Op VM has PVCs, then floorHardwareVersion is the larger value between MinSupportedHWVersionForPVC and imageHWVersion if the VM Op VM does not have PVCs then floorHardwareVersion is imageHWVersion This way the renamed GetMinimumCompatibleHardwareVersion becomes a useful function that is not tied to the VM Op API schemas and can be reused elsewhere.
Similarly for PCI devices send in MinSupportedHWVersionForPCIDevices or the imageHWVersion.
Is there anything else you would like to add? For more context refer : https://github.com/vmware-tanzu/vm-operator/pull/160#discussion_r1227004712