From cab44f445e4502d53bc311091fe2cfb7a54c9617 Mon Sep 17 00:00:00 2001 From: Jack Lin Date: Wed, 4 Dec 2024 10:27:29 +0800 Subject: [PATCH] feat: add scheduled backing image to node api resource ref: longhorn/longhorn 8757 Signed-off-by: Jack Lin --- api/model.go | 26 ++++++++++++++------------ client/generated_disk_info.go | 2 ++ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/api/model.go b/api/model.go index 60df599c22..89c15d242e 100644 --- a/api/model.go +++ b/api/model.go @@ -430,12 +430,13 @@ type Node struct { } type DiskStatus struct { - Conditions map[string]longhorn.Condition `json:"conditions"` - StorageAvailable int64 `json:"storageAvailable"` - StorageScheduled int64 `json:"storageScheduled"` - StorageMaximum int64 `json:"storageMaximum"` - ScheduledReplica map[string]int64 `json:"scheduledReplica"` - DiskUUID string `json:"diskUUID"` + Conditions map[string]longhorn.Condition `json:"conditions"` + StorageAvailable int64 `json:"storageAvailable"` + StorageScheduled int64 `json:"storageScheduled"` + StorageMaximum int64 `json:"storageMaximum"` + ScheduledReplica map[string]int64 `json:"scheduledReplica"` + ScheduledBackingImage map[string]int64 `json:"scheduledBackingImage"` + DiskUUID string `json:"diskUUID"` } type DiskInfo struct { @@ -2080,12 +2081,13 @@ func toNodeResource(node *longhorn.Node, address string, apiContext *api.ApiCont } if node.Status.DiskStatus != nil && node.Status.DiskStatus[name] != nil { di.DiskStatus = DiskStatus{ - Conditions: sliceToMap(node.Status.DiskStatus[name].Conditions), - StorageAvailable: node.Status.DiskStatus[name].StorageAvailable, - StorageScheduled: node.Status.DiskStatus[name].StorageScheduled, - StorageMaximum: node.Status.DiskStatus[name].StorageMaximum, - ScheduledReplica: node.Status.DiskStatus[name].ScheduledReplica, - DiskUUID: node.Status.DiskStatus[name].DiskUUID, + Conditions: sliceToMap(node.Status.DiskStatus[name].Conditions), + StorageAvailable: node.Status.DiskStatus[name].StorageAvailable, + StorageScheduled: node.Status.DiskStatus[name].StorageScheduled, + StorageMaximum: node.Status.DiskStatus[name].StorageMaximum, + ScheduledReplica: node.Status.DiskStatus[name].ScheduledReplica, + ScheduledBackingImage: node.Status.DiskStatus[name].ScheduledBackingImage, + DiskUUID: node.Status.DiskStatus[name].DiskUUID, } } disks[name] = di diff --git a/client/generated_disk_info.go b/client/generated_disk_info.go index 7ead2efc33..65a94934cd 100644 --- a/client/generated_disk_info.go +++ b/client/generated_disk_info.go @@ -19,6 +19,8 @@ type DiskInfo struct { Path string `json:"path,omitempty" yaml:"path,omitempty"` + ScheduledBackingImage map[string]string `json:"scheduledBackingImage,omitempty" yaml:"scheduled_backing_image,omitempty"` + ScheduledReplica map[string]string `json:"scheduledReplica,omitempty" yaml:"scheduled_replica,omitempty"` StorageAvailable int64 `json:"storageAvailable,omitempty" yaml:"storage_available,omitempty"`