@@ -19,17 +19,19 @@ type AvailableFeatures struct {
1919// conservative when updating this value since doing so unconditionally breaks
2020// operators of older Ironic, even if the feature we need is optional.
2121// Update docs/configuration.md when updating the version.
22- // Version 1.81 allows retrival of Node inventory.
23- const baseline = "1.81"
22+ // Version 1.89 allows attaching and detaching virtual media.
23+ const baseline = 89
24+
25+ var baselineVersionString = fmt .Sprintf ("1.%d" , baseline )
2426
2527func GetAvailableFeatures (ctx context.Context , client * gophercloud.ServiceClient ) (features AvailableFeatures , err error ) {
2628 mvs , err := utils .GetSupportedMicroversions (ctx , client )
2729 if err != nil {
2830 return
2931 }
3032
31- if mvs .MaxMajor != 1 || mvs .MaxMinor < 81 {
32- err = fmt .Errorf ("ironic API 1.81 or newer is required, got %d.%d" , mvs .MaxMajor , mvs .MaxMinor )
33+ if mvs .MaxMajor != 1 || mvs .MaxMinor < baseline {
34+ err = fmt .Errorf ("ironic API 1.%d or newer is required, got %d.%d" , baseline , mvs .MaxMajor , mvs .MaxMinor )
3335 return
3436 }
3537
@@ -42,20 +44,8 @@ func (af AvailableFeatures) Log(logger logr.Logger) {
4244 logger .Info ("supported Ironic API features" ,
4345 "maxVersion" , fmt .Sprintf ("1.%d" , af .MaxVersion ),
4446 "chosenVersion" , af .ChooseMicroversion (),
45- "firmwareUpdates" , af .HasFirmwareUpdates (),
46- "dataImage" , af .HasDataImage ())
47- }
48-
49- func (af AvailableFeatures ) HasFirmwareUpdates () bool {
50- return af .MaxVersion >= 86 //nolint:mnd
51- }
52-
53- func (af AvailableFeatures ) HasServicing () bool {
54- return af .MaxVersion >= 87 //nolint:mnd
55- }
56-
57- func (af AvailableFeatures ) HasDataImage () bool {
58- return af .MaxVersion >= 89 //nolint:mnd
47+ "virtualMediaGET" , af .HasVirtualMediaGetAPI (),
48+ "disablePowerOff" , af .HasDisablePowerOff ())
5949}
6050
6151func (af AvailableFeatures ) HasVirtualMediaGetAPI () bool {
@@ -75,17 +65,5 @@ func (af AvailableFeatures) ChooseMicroversion() string {
7565 return "1.93"
7666 }
7767
78- if af .HasDataImage () {
79- return "1.89"
80- }
81-
82- if af .HasServicing () {
83- return "1.87"
84- }
85-
86- if af .HasFirmwareUpdates () {
87- return "1.86"
88- }
89-
90- return baseline
68+ return baselineVersionString
9169}
0 commit comments