diff --git a/cmd/metal-api/internal/metal/switch.go b/cmd/metal-api/internal/metal/switch.go index d49db89b1..58ac1d320 100644 --- a/cmd/metal-api/internal/metal/switch.go +++ b/cmd/metal-api/internal/metal/switch.go @@ -26,8 +26,9 @@ type Switch struct { type Switches []Switch type SwitchOS struct { - Vendor string `rethinkdb:"vendor" json:"vendor"` - Version string `rethinkdb:"version" json:"version"` + Vendor string `rethinkdb:"vendor" json:"vendor"` + Version string `rethinkdb:"version" json:"version"` + MetalCoreVersion string `rethinkdb:"metal_core_version" json:"metal_core_version"` } // Connection between switch port and machine. diff --git a/cmd/metal-api/internal/service/switch-service.go b/cmd/metal-api/internal/service/switch-service.go index ab86f6ef2..81395a795 100644 --- a/cmd/metal-api/internal/service/switch-service.go +++ b/cmd/metal-api/internal/service/switch-service.go @@ -373,6 +373,7 @@ func (r *switchResource) registerSwitch(request *restful.Request, response *rest } s.OS.Vendor = spec.OS.Vendor s.OS.Version = spec.OS.Version + s.OS.MetalCoreVersion = spec.OS.MetalCoreVersion } s.ManagementIP = spec.ManagementIP s.ManagementUser = spec.ManagementUser diff --git a/cmd/metal-api/internal/service/v1/switch.go b/cmd/metal-api/internal/service/v1/switch.go index 1cbbd7735..34ea3197e 100644 --- a/cmd/metal-api/internal/service/v1/switch.go +++ b/cmd/metal-api/internal/service/v1/switch.go @@ -18,8 +18,9 @@ type SwitchBase struct { } type SwitchOS struct { - Vendor string `json:"vendor" description:"the operating system vendor the switch currently has" optional:"true"` - Version string `json:"version" description:"the operating system version the switch currently has" optional:"true"` + Vendor string `json:"vendor" description:"the operating system vendor the switch currently has" optional:"true"` + Version string `json:"version" description:"the operating system version the switch currently has" optional:"true"` + MetalCoreVersion string `json:"metal_core_version" description:"the version of metal-core running" optional:"true"` } type SwitchNics []SwitchNic @@ -115,8 +116,9 @@ func NewSwitchResponse(s *metal.Switch, p *metal.Partition, nics SwitchNics, con var os *SwitchOS if s.OS != nil { os = &SwitchOS{ - Vendor: s.OS.Vendor, - Version: s.OS.Version, + Vendor: s.OS.Vendor, + Version: s.OS.Version, + MetalCoreVersion: s.OS.MetalCoreVersion, } } @@ -174,8 +176,9 @@ func NewSwitch(r SwitchRegisterRequest) *metal.Switch { var os *metal.SwitchOS if r.OS != nil { os = &metal.SwitchOS{ - Vendor: r.OS.Vendor, - Version: r.OS.Version, + Vendor: r.OS.Vendor, + Version: r.OS.Version, + MetalCoreVersion: r.OS.MetalCoreVersion, } } diff --git a/spec/metal-api.json b/spec/metal-api.json index ec7e06a9d..3b18ab17a 100644 --- a/spec/metal-api.json +++ b/spec/metal-api.json @@ -4360,6 +4360,10 @@ }, "v1.SwitchOS": { "properties": { + "metal_core_version": { + "description": "the version of metal-core running", + "type": "string" + }, "vendor": { "description": "the operating system vendor the switch currently has", "type": "string"