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 <23444145+prakashsvmx@users.noreply.github.com>
This commit is contained in:
@@ -42,6 +42,9 @@ type AdminInfoResponse struct {
|
|||||||
// Enum: [not configured available unavailable]
|
// Enum: [not configured available unavailable]
|
||||||
AdvancedMetricsStatus string `json:"advancedMetricsStatus,omitempty"`
|
AdvancedMetricsStatus string `json:"advancedMetricsStatus,omitempty"`
|
||||||
|
|
||||||
|
// backend
|
||||||
|
Backend *BackendProperties `json:"backend,omitempty"`
|
||||||
|
|
||||||
// buckets
|
// buckets
|
||||||
Buckets int64 `json:"buckets,omitempty"`
|
Buckets int64 `json:"buckets,omitempty"`
|
||||||
|
|
||||||
@@ -66,6 +69,10 @@ func (m *AdminInfoResponse) Validate(formats strfmt.Registry) error {
|
|||||||
res = append(res, err)
|
res = append(res, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := m.validateBackend(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
if err := m.validateServers(formats); err != nil {
|
if err := m.validateServers(formats); err != nil {
|
||||||
res = append(res, err)
|
res = append(res, err)
|
||||||
}
|
}
|
||||||
@@ -125,6 +132,25 @@ func (m *AdminInfoResponse) validateAdvancedMetricsStatus(formats strfmt.Registr
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *AdminInfoResponse) validateBackend(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.Backend) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Backend != nil {
|
||||||
|
if err := m.Backend.Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("backend")
|
||||||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||||
|
return ce.ValidateName("backend")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (m *AdminInfoResponse) validateServers(formats strfmt.Registry) error {
|
func (m *AdminInfoResponse) validateServers(formats strfmt.Registry) error {
|
||||||
if swag.IsZero(m.Servers) { // not required
|
if swag.IsZero(m.Servers) { // not required
|
||||||
return nil
|
return nil
|
||||||
@@ -181,6 +207,10 @@ func (m *AdminInfoResponse) validateWidgets(formats strfmt.Registry) error {
|
|||||||
func (m *AdminInfoResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
func (m *AdminInfoResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
var res []error
|
var res []error
|
||||||
|
|
||||||
|
if err := m.contextValidateBackend(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
if err := m.contextValidateServers(ctx, formats); err != nil {
|
if err := m.contextValidateServers(ctx, formats); err != nil {
|
||||||
res = append(res, err)
|
res = append(res, err)
|
||||||
}
|
}
|
||||||
@@ -195,6 +225,22 @@ func (m *AdminInfoResponse) ContextValidate(ctx context.Context, formats strfmt.
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *AdminInfoResponse) contextValidateBackend(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
if m.Backend != nil {
|
||||||
|
if err := m.Backend.ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("backend")
|
||||||
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||||
|
return ce.ValidateName("backend")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (m *AdminInfoResponse) contextValidateServers(ctx context.Context, formats strfmt.Registry) error {
|
func (m *AdminInfoResponse) contextValidateServers(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
for i := 0; i < len(m.Servers); i++ {
|
for i := 0; i < len(m.Servers); i++ {
|
||||||
|
|||||||
73
models/backend_properties.go
Normal file
73
models/backend_properties.go
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// This file is part of MinIO Console Server
|
||||||
|
// Copyright (c) 2022 MinIO, Inc.
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
|
||||||
|
package models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// BackendProperties backend properties
|
||||||
|
//
|
||||||
|
// swagger:model BackendProperties
|
||||||
|
type BackendProperties struct {
|
||||||
|
|
||||||
|
// backend type
|
||||||
|
BackendType string `json:"backendType,omitempty"`
|
||||||
|
|
||||||
|
// rr s c parity
|
||||||
|
RrSCParity int64 `json:"rrSCParity,omitempty"`
|
||||||
|
|
||||||
|
// standard s c parity
|
||||||
|
StandardSCParity int64 `json:"standardSCParity,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this backend properties
|
||||||
|
func (m *BackendProperties) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this backend properties based on context it is used
|
||||||
|
func (m *BackendProperties) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *BackendProperties) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *BackendProperties) UnmarshalBinary(b []byte) error {
|
||||||
|
var res BackendProperties
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Box } from "@mui/material";
|
import { Box, Grid } from "@mui/material";
|
||||||
import {
|
import {
|
||||||
ArrowRightIcon,
|
ArrowRightIcon,
|
||||||
BucketsIcon,
|
BucketsIcon,
|
||||||
@@ -25,6 +25,8 @@ import {
|
|||||||
ServersIcon,
|
ServersIcon,
|
||||||
TotalObjectsIcon,
|
TotalObjectsIcon,
|
||||||
UptimeIcon,
|
UptimeIcon,
|
||||||
|
FormatDrivesIcon,
|
||||||
|
StorageIcon,
|
||||||
} from "../../../../icons";
|
} from "../../../../icons";
|
||||||
import HelpBox from "../../../../common/HelpBox";
|
import HelpBox from "../../../../common/HelpBox";
|
||||||
import { calculateBytes, representationNumber } from "../../../../common/utils";
|
import { calculateBytes, representationNumber } from "../../../../common/utils";
|
||||||
@@ -276,6 +278,41 @@ const BasicDashboard = ({ usage }: IDashboardProps) => {
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
<Grid container spacing={1}>
|
||||||
|
<Grid item xs={4}>
|
||||||
|
<TimeStatItem
|
||||||
|
icon={<StorageIcon />}
|
||||||
|
label={"Backend type"}
|
||||||
|
value={
|
||||||
|
usage?.backend?.backendType
|
||||||
|
? usage.backend.backendType
|
||||||
|
: "Unknown"
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={4}>
|
||||||
|
<TimeStatItem
|
||||||
|
icon={<FormatDrivesIcon />}
|
||||||
|
label={"Standard storage class parity"}
|
||||||
|
value={
|
||||||
|
usage?.backend?.standardSCParity
|
||||||
|
? usage.backend.standardSCParity.toString()
|
||||||
|
: "n/a"
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={4}>
|
||||||
|
<TimeStatItem
|
||||||
|
icon={<FormatDrivesIcon />}
|
||||||
|
label={"Reduced redundancy storage class parity"}
|
||||||
|
value={
|
||||||
|
usage?.backend?.standardSCParity
|
||||||
|
? usage.backend.rrSCParity.toString()
|
||||||
|
: "n/a"
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
|
|||||||
@@ -23,12 +23,19 @@ export interface Usage {
|
|||||||
advancedMetricsStatus: "available" | "unavailable" | "not configured";
|
advancedMetricsStatus: "available" | "unavailable" | "not configured";
|
||||||
widgets?: any;
|
widgets?: any;
|
||||||
servers: ServerInfo[];
|
servers: ServerInfo[];
|
||||||
|
backend: Backend;
|
||||||
//TODO
|
//TODO
|
||||||
lastScan: any;
|
lastScan: any;
|
||||||
lastHeal: any;
|
lastHeal: any;
|
||||||
upTime: any;
|
upTime: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Backend {
|
||||||
|
backendType: string;
|
||||||
|
standardSCParity: number;
|
||||||
|
rrSCParity: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ServerInfo {
|
export interface ServerInfo {
|
||||||
state: string;
|
state: string;
|
||||||
endpoint: string;
|
endpoint: string;
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ type UsageInfo struct {
|
|||||||
DisksUsage int64
|
DisksUsage int64
|
||||||
Servers []*models.ServerProperties
|
Servers []*models.ServerProperties
|
||||||
EndpointNotReady bool
|
EndpointNotReady bool
|
||||||
|
Backend *models.BackendProperties
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAdminInfo invokes admin info and returns a parsed `UsageInfo` structure
|
// GetAdminInfo invokes admin info and returns a parsed `UsageInfo` structure
|
||||||
@@ -72,6 +73,25 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
|
|||||||
// we are trimming uint64 to int64 this will report an incorrect measurement for numbers greater than
|
// we are trimming uint64 to int64 this will report an incorrect measurement for numbers greater than
|
||||||
// 9,223,372,036,854,775,807
|
// 9,223,372,036,854,775,807
|
||||||
|
|
||||||
|
var backendType string
|
||||||
|
var rrSCParity float64
|
||||||
|
var standardSCParity float64
|
||||||
|
|
||||||
|
if v, success := serverInfo.Backend.(map[string]interface{}); success {
|
||||||
|
bt, ok := v["backendType"]
|
||||||
|
if ok {
|
||||||
|
backendType = bt.(string)
|
||||||
|
}
|
||||||
|
rp, ok := v["rrSCParity"]
|
||||||
|
if ok {
|
||||||
|
rrSCParity = rp.(float64)
|
||||||
|
}
|
||||||
|
sp, ok := v["standardSCParity"]
|
||||||
|
if ok {
|
||||||
|
standardSCParity = sp.(float64)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var usedSpace int64
|
var usedSpace int64
|
||||||
for _, serv := range serverInfo.Servers {
|
for _, serv := range serverInfo.Servers {
|
||||||
for _, disk := range serv.Disks {
|
for _, disk := range serv.Disks {
|
||||||
@@ -113,12 +133,19 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
|
|||||||
serverArray = append(serverArray, newServer)
|
serverArray = append(serverArray, newServer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
backendData := &models.BackendProperties{
|
||||||
|
BackendType: backendType,
|
||||||
|
RrSCParity: int64(rrSCParity),
|
||||||
|
StandardSCParity: int64(standardSCParity),
|
||||||
|
}
|
||||||
|
|
||||||
return &UsageInfo{
|
return &UsageInfo{
|
||||||
Buckets: int64(serverInfo.Buckets.Count),
|
Buckets: int64(serverInfo.Buckets.Count),
|
||||||
Objects: int64(serverInfo.Objects.Count),
|
Objects: int64(serverInfo.Objects.Count),
|
||||||
Usage: int64(serverInfo.Usage.Size),
|
Usage: int64(serverInfo.Usage.Size),
|
||||||
DisksUsage: usedSpace,
|
DisksUsage: usedSpace,
|
||||||
Servers: serverArray,
|
Servers: serverArray,
|
||||||
|
Backend: backendData,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -913,6 +940,7 @@ func getUsageWidgetsForDeployment(ctx context.Context, prometheusURL string, mAd
|
|||||||
sessionResp.Objects = usage.Objects
|
sessionResp.Objects = usage.Objects
|
||||||
sessionResp.Usage = usage.Usage
|
sessionResp.Usage = usage.Usage
|
||||||
sessionResp.Servers = usage.Servers
|
sessionResp.Servers = usage.Servers
|
||||||
|
sessionResp.Backend = usage.Backend
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
@@ -4864,6 +4864,20 @@ func init() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
"BackendProperties": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"backendType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"rrSCParity": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"standardSCParity": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"SubnetRegTokenResponse": {
|
"SubnetRegTokenResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -5129,6 +5143,9 @@ func init() {
|
|||||||
"unavailable"
|
"unavailable"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"backend": {
|
||||||
|
"$ref": "#/definitions/BackendProperties"
|
||||||
|
},
|
||||||
"buckets": {
|
"buckets": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
@@ -13002,6 +13019,20 @@ func init() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
"BackendProperties": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"backendType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"rrSCParity": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"standardSCParity": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"BucketDetails": {
|
"BucketDetails": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -13393,6 +13424,9 @@ func init() {
|
|||||||
"unavailable"
|
"unavailable"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"backend": {
|
||||||
|
"$ref": "#/definitions/BackendProperties"
|
||||||
|
},
|
||||||
"buckets": {
|
"buckets": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4248,6 +4248,8 @@ definitions:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: "#/definitions/serverProperties"
|
$ref: "#/definitions/serverProperties"
|
||||||
|
backend:
|
||||||
|
$ref: "#/definitions/BackendProperties"
|
||||||
serverProperties:
|
serverProperties:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
@@ -4294,6 +4296,15 @@ definitions:
|
|||||||
type: integer
|
type: integer
|
||||||
availableSpace:
|
availableSpace:
|
||||||
type: integer
|
type: integer
|
||||||
|
BackendProperties:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
backendType:
|
||||||
|
type: string
|
||||||
|
rrSCParity:
|
||||||
|
type: integer
|
||||||
|
standardSCParity:
|
||||||
|
type: integer
|
||||||
arnsResponse:
|
arnsResponse:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
@@ -5437,40 +5448,40 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
|
|
||||||
kmsDescribeIdentityResponse:
|
kmsDescribeIdentityResponse:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
policy:
|
policy:
|
||||||
type: string
|
type: string
|
||||||
identity:
|
identity:
|
||||||
type: string
|
type: string
|
||||||
admin:
|
admin:
|
||||||
type: boolean
|
type: boolean
|
||||||
createdAt:
|
createdAt:
|
||||||
type: string
|
type: string
|
||||||
createdBy:
|
createdBy:
|
||||||
type: string
|
type: string
|
||||||
kmsDescribeSelfIdentityResponse:
|
kmsDescribeSelfIdentityResponse:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
identity:
|
identity:
|
||||||
type: string
|
type: string
|
||||||
policyName:
|
policyName:
|
||||||
type: string
|
type: string
|
||||||
admin:
|
admin:
|
||||||
type: boolean
|
type: boolean
|
||||||
createdAt:
|
createdAt:
|
||||||
type: string
|
type: string
|
||||||
createdBy:
|
createdBy:
|
||||||
type: string
|
type: string
|
||||||
policy:
|
policy:
|
||||||
$ref: "#/definitions/kmsGetPolicyResponse"
|
$ref: "#/definitions/kmsGetPolicyResponse"
|
||||||
kmsListIdentitiesResponse:
|
kmsListIdentitiesResponse:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
results:
|
results:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: "#/definitions/kmsIdentityInfo"
|
$ref: "#/definitions/kmsIdentityInfo"
|
||||||
kmsIdentityInfo:
|
kmsIdentityInfo:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
@@ -5514,7 +5525,7 @@ definitions:
|
|||||||
errorEvents:
|
errorEvents:
|
||||||
type: integer
|
type: integer
|
||||||
latencyHistogram:
|
latencyHistogram:
|
||||||
$ref: "#/definitions/kmsLatencyHistogram"
|
$ref: "#/definitions/kmsLatencyHistogram"
|
||||||
uptime:
|
uptime:
|
||||||
type: integer
|
type: integer
|
||||||
cpus:
|
cpus:
|
||||||
|
|||||||
Reference in New Issue
Block a user