Skip to content

Commit

Permalink
feat: add scheduled backing image to node api resource
Browse files Browse the repository at this point in the history
ref: longhorn/longhorn 8757

Signed-off-by: Jack Lin <[email protected]>
  • Loading branch information
ChanYiLin authored and derekbit committed Dec 4, 2024
1 parent 5682847 commit cab44f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
26 changes: 14 additions & 12 deletions api/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions client/generated_disk_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit cab44f4

Please sign in to comment.