[master] refactor func ShouldGrowVolumes (#5884)

This commit is contained in:
Konstantin Lebedev
2024-09-04 20:16:44 +05:00
committed by GitHub
parent eb02946c97
commit 67a252ee8a
6 changed files with 121 additions and 62 deletions

View File

@@ -13,6 +13,11 @@ type TopologyInfo struct {
Layouts []VolumeLayoutInfo `json:"Layouts"`
}
type VolumeLayoutCollection struct {
Collection string
VolumeLayout *VolumeLayout
}
func (t *Topology) ToInfo() (info TopologyInfo) {
info.Max = t.diskUsages.GetMaxVolumeCount()
info.Free = t.diskUsages.FreeSpace()
@@ -42,10 +47,12 @@ func (t *Topology) ToInfo() (info TopologyInfo) {
return
}
func (t *Topology) ListVolumeLayouts() (volumeLayouts []*VolumeLayout) {
func (t *Topology) ListVolumeLayoutCollections() (volumeLayouts []*VolumeLayoutCollection) {
for _, col := range t.collectionMap.Items() {
for _, volumeLayout := range col.(*Collection).storageType2VolumeLayout.Items() {
volumeLayouts = append(volumeLayouts, volumeLayout.(*VolumeLayout))
volumeLayouts = append(volumeLayouts,
&VolumeLayoutCollection{col.(*Collection).Name, volumeLayout.(*VolumeLayout)},
)
}
}
return volumeLayouts