Skip to content

Commit 7b389fc

Browse files
Add erasure info support (#2446)
Make it easier for user to see backend properties like backend-type, Standard storage class Parity and Reduced Redundancy storage class Parity Co-authored-by: Prakash Senthil Vel <[email protected]>
1 parent 86361b6 commit 7b389fc

File tree

7 files changed

+270
-34
lines changed

7 files changed

+270
-34
lines changed

models/admin_info_response.go

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/backend_properties.go

Lines changed: 73 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

portal-ui/src/screens/Console/Dashboard/BasicDashboard/BasicDashboard.tsx

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

1717
import React from "react";
18-
import { Box } from "@mui/material";
18+
import { Box, Grid } from "@mui/material";
1919
import {
2020
ArrowRightIcon,
2121
BucketsIcon,
@@ -25,6 +25,8 @@ import {
2525
ServersIcon,
2626
TotalObjectsIcon,
2727
UptimeIcon,
28+
FormatDrivesIcon,
29+
StorageIcon,
2830
} from "../../../../icons";
2931
import HelpBox from "../../../../common/HelpBox";
3032
import { calculateBytes, representationNumber } from "../../../../common/utils";
@@ -276,6 +278,41 @@ const BasicDashboard = ({ usage }: IDashboardProps) => {
276278
</Box>
277279
</Box>
278280
</Box>
281+
<Grid container spacing={1}>
282+
<Grid item xs={4}>
283+
<TimeStatItem
284+
icon={<StorageIcon />}
285+
label={"Backend type"}
286+
value={
287+
usage?.backend?.backendType
288+
? usage.backend.backendType
289+
: "Unknown"
290+
}
291+
/>
292+
</Grid>
293+
<Grid item xs={4}>
294+
<TimeStatItem
295+
icon={<FormatDrivesIcon />}
296+
label={"Standard storage class parity"}
297+
value={
298+
usage?.backend?.standardSCParity
299+
? usage.backend.standardSCParity.toString()
300+
: "n/a"
301+
}
302+
/>
303+
</Grid>
304+
<Grid item xs={4}>
305+
<TimeStatItem
306+
icon={<FormatDrivesIcon />}
307+
label={"Reduced redundancy storage class parity"}
308+
value={
309+
usage?.backend?.standardSCParity
310+
? usage.backend.rrSCParity.toString()
311+
: "n/a"
312+
}
313+
/>
314+
</Grid>
315+
</Grid>
279316

280317
<Box
281318
sx={{

portal-ui/src/screens/Console/Dashboard/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,19 @@ export interface Usage {
2323
advancedMetricsStatus: "available" | "unavailable" | "not configured";
2424
widgets?: any;
2525
servers: ServerInfo[];
26+
backend: Backend;
2627
//TODO
2728
lastScan: any;
2829
lastHeal: any;
2930
upTime: any;
3031
}
3132

33+
export interface Backend {
34+
backendType: string;
35+
standardSCParity: number;
36+
rrSCParity: number;
37+
}
38+
3239
export interface ServerInfo {
3340
state: string;
3441
endpoint: string;

restapi/admin_info.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ type UsageInfo struct {
6161
DisksUsage int64
6262
Servers []*models.ServerProperties
6363
EndpointNotReady bool
64+
Backend *models.BackendProperties
6465
}
6566

6667
// GetAdminInfo invokes admin info and returns a parsed `UsageInfo` structure
@@ -72,6 +73,25 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
7273
// we are trimming uint64 to int64 this will report an incorrect measurement for numbers greater than
7374
// 9,223,372,036,854,775,807
7475

76+
var backendType string
77+
var rrSCParity float64
78+
var standardSCParity float64
79+
80+
if v, success := serverInfo.Backend.(map[string]interface{}); success {
81+
bt, ok := v["backendType"]
82+
if ok {
83+
backendType = bt.(string)
84+
}
85+
rp, ok := v["rrSCParity"]
86+
if ok {
87+
rrSCParity = rp.(float64)
88+
}
89+
sp, ok := v["standardSCParity"]
90+
if ok {
91+
standardSCParity = sp.(float64)
92+
}
93+
}
94+
7595
var usedSpace int64
7696
for _, serv := range serverInfo.Servers {
7797
for _, disk := range serv.Disks {
@@ -113,12 +133,19 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
113133
serverArray = append(serverArray, newServer)
114134
}
115135

136+
backendData := &models.BackendProperties{
137+
BackendType: backendType,
138+
RrSCParity: int64(rrSCParity),
139+
StandardSCParity: int64(standardSCParity),
140+
}
141+
116142
return &UsageInfo{
117143
Buckets: int64(serverInfo.Buckets.Count),
118144
Objects: int64(serverInfo.Objects.Count),
119145
Usage: int64(serverInfo.Usage.Size),
120146
DisksUsage: usedSpace,
121147
Servers: serverArray,
148+
Backend: backendData,
122149
}, nil
123150
}
124151

@@ -913,6 +940,7 @@ func getUsageWidgetsForDeployment(ctx context.Context, prometheusURL string, mAd
913940
sessionResp.Objects = usage.Objects
914941
sessionResp.Usage = usage.Usage
915942
sessionResp.Servers = usage.Servers
943+
sessionResp.Backend = usage.Backend
916944
}
917945
}()
918946

restapi/embedded_spec.go

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)