diff --git a/cmd/metal-api/internal/service/partition-service.go b/cmd/metal-api/internal/service/partition-service.go index 6d6bc0636..43bad6fba 100644 --- a/cmd/metal-api/internal/service/partition-service.go +++ b/cmd/metal-api/internal/service/partition-service.go @@ -353,10 +353,12 @@ func (r partitionResource) calcPartitionCapacity() ([]v1.PartitionCapacity, erro cap.Allocated++ } else if machineHasIssues(m) { cap.Faulty++ + cap.FaultyMachines = append(cap.FaultyMachines, m.ID) } else if available { cap.Free++ } else { cap.Other++ + cap.OtherMachines = append(cap.OtherMachines, m.ID) } cap.Total++ diff --git a/cmd/metal-api/internal/service/v1/partition.go b/cmd/metal-api/internal/service/v1/partition.go index 78501d469..b8e8e9abf 100644 --- a/cmd/metal-api/internal/service/v1/partition.go +++ b/cmd/metal-api/internal/service/v1/partition.go @@ -40,12 +40,14 @@ type PartitionCapacity struct { } type ServerCapacity struct { - Size string `json:"size" description:"the size of the server"` - Total int `json:"total" description:"total amount of servers with this size"` - Free int `json:"free" description:"free servers with this size"` - Allocated int `json:"allocated" description:"allocated servers with this size"` - Faulty int `json:"faulty" description:"servers with issues with this size"` - Other int `json:"other" description:"servers neither free, allocated or faulty with this size"` + Size string `json:"size" description:"the size of the server"` + Total int `json:"total" description:"total amount of servers with this size"` + Free int `json:"free" description:"free servers with this size"` + Allocated int `json:"allocated" description:"allocated servers with this size"` + Faulty int `json:"faulty" description:"servers with issues with this size"` + FaultyMachines []string `json:"faultymachines" description:"servers with issues with this size"` + Other int `json:"other" description:"servers neither free, allocated or faulty with this size"` + OtherMachines []string `json:"othermachines" description:"servers neither free, allocated or faulty with this size"` } func NewPartitionResponse(p *metal.Partition) *PartitionResponse { diff --git a/spec/metal-api.json b/spec/metal-api.json index 1e9f8821f..8baae7bee 100644 --- a/spec/metal-api.json +++ b/spec/metal-api.json @@ -2558,6 +2558,13 @@ "format": "int32", "type": "integer" }, + "faultymachines": { + "description": "servers with issues with this size", + "items": { + "type": "string" + }, + "type": "array" + }, "free": { "description": "free servers with this size", "format": "int32", @@ -2568,6 +2575,13 @@ "format": "int32", "type": "integer" }, + "othermachines": { + "description": "servers neither free, allocated or faulty with this size", + "items": { + "type": "string" + }, + "type": "array" + }, "size": { "description": "the size of the server", "type": "string" @@ -2581,8 +2595,10 @@ "required": [ "allocated", "faulty", + "faultymachines", "free", "other", + "othermachines", "size", "total" ]