mirror of
https://github.com/minio/minio.git
synced 2025-11-20 09:56:07 -05:00
move madmin to github.com/minio/madmin-go (#12239)
This commit is contained in:
@@ -31,13 +31,14 @@ import (
|
||||
"github.com/dswarbrick/smart/ioctl"
|
||||
"github.com/dswarbrick/smart/scsi"
|
||||
"github.com/dswarbrick/smart/utils"
|
||||
"github.com/minio/madmin-go"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
// GetInfo - gets info about device
|
||||
func GetInfo(device string) (Info, error) {
|
||||
info := Info{
|
||||
func GetInfo(device string) (madmin.SmartInfo, error) {
|
||||
info := madmin.SmartInfo{
|
||||
Device: device,
|
||||
}
|
||||
|
||||
@@ -89,9 +90,9 @@ func GetInfo(device string) (Info, error) {
|
||||
return info, nil
|
||||
}
|
||||
|
||||
func getNvmeInfo(d *NVMeDevice) (*NvmeInfo, error) {
|
||||
func getNvmeInfo(d *NVMeDevice) (*madmin.SmartNvmeInfo, error) {
|
||||
buf := make([]byte, 4096)
|
||||
nvmeInfo := &NvmeInfo{}
|
||||
nvmeInfo := &madmin.SmartNvmeInfo{}
|
||||
|
||||
cmd := nvmePassthruCommand{
|
||||
opcode: NvmeAdminIdentify,
|
||||
@@ -145,10 +146,10 @@ func getNvmeInfo(d *NVMeDevice) (*NvmeInfo, error) {
|
||||
return nvmeInfo, nil
|
||||
}
|
||||
|
||||
func getScsiInfo(d *scsi.SCSIDevice) (*ScsiInfo, error) {
|
||||
return &ScsiInfo{}, nil
|
||||
func getScsiInfo(d *scsi.SCSIDevice) (*madmin.SmartScsiInfo, error) {
|
||||
return &madmin.SmartScsiInfo{}, nil
|
||||
}
|
||||
|
||||
func getAtaInfo(d *scsi.SATDevice) (*AtaInfo, error) {
|
||||
return &AtaInfo{}, nil
|
||||
func getAtaInfo(d *scsi.SATDevice) (*madmin.SmartAtaInfo, error) {
|
||||
return &madmin.SmartAtaInfo{}, nil
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
|
||||
package smart
|
||||
|
||||
import "math/big"
|
||||
|
||||
// Defined in <linux/nvme_ioctl.h>
|
||||
//nolint:structcheck,deadcode
|
||||
type nvmePassthruCommand struct {
|
||||
@@ -182,62 +180,3 @@ type NVMeDevice struct {
|
||||
Name string
|
||||
fd int
|
||||
}
|
||||
|
||||
// Info contains S.M.A.R.T data about the drive
|
||||
type Info struct {
|
||||
Device string `json:"device"`
|
||||
|
||||
Scsi *ScsiInfo `json:"scsi,omitempty"`
|
||||
Nvme *NvmeInfo `json:"nvme,omitempty"`
|
||||
Ata *AtaInfo `json:"ata,omitempty"`
|
||||
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// AtaInfo contains ATA drive info
|
||||
type AtaInfo struct {
|
||||
LUWWNDeviceID string `json:"scsiLuWWNDeviceID,omitempty"`
|
||||
SerialNum string `json:"serialNum,omitempty"`
|
||||
ModelNum string `json:"modelNum,omitempty"`
|
||||
FirmwareRevision string `json:"firmwareRevision,omitempty"`
|
||||
RotationRate string `json:"RotationRate,omitempty"`
|
||||
ATAMajorVersion string `json:"MajorVersion,omitempty"`
|
||||
ATAMinorVersion string `json:"MinorVersion,omitempty"`
|
||||
SmartSupportAvailable bool `json:"smartSupportAvailable,omitempty"`
|
||||
SmartSupportEnabled bool `json:"smartSupportEnabled,omitempty"`
|
||||
ErrorLog string `json:"smartErrorLog,omitempty"`
|
||||
Transport string `json:"transport,omitempty"`
|
||||
}
|
||||
|
||||
// ScsiInfo contains SCSI drive Info
|
||||
type ScsiInfo struct {
|
||||
CapacityBytes int64 `json:"scsiCapacityBytes,omitempty"`
|
||||
ModeSenseBuf string `json:"scsiModeSenseBuf,omitempty"`
|
||||
RespLen int64 `json:"scsirespLen,omitempty"`
|
||||
BdLen int64 `json:"scsiBdLen,omitempty"`
|
||||
Offset int64 `json:"scsiOffset,omitempty"`
|
||||
RPM int64 `json:"sciRpm,omitempty"`
|
||||
}
|
||||
|
||||
// NvmeInfo contains NVMe drive info
|
||||
type NvmeInfo struct {
|
||||
SerialNum string `json:"serialNum,omitempty"`
|
||||
VendorID string `json:"vendorId,omitempty"`
|
||||
FirmwareVersion string `json:"firmwareVersion,omitempty"`
|
||||
ModelNum string `json:"modelNum,omitempty"`
|
||||
SpareAvailable string `json:"spareAvailable,omitempty"`
|
||||
SpareThreshold string `json:"spareThreshold,omitempty"`
|
||||
Temperature string `json:"temperature,omitempty"`
|
||||
CriticalWarning string `json:"criticalWarning,omitempty"`
|
||||
|
||||
MaxDataTransferPages int `json:"maxDataTransferPages,omitempty"`
|
||||
ControllerBusyTime *big.Int `json:"controllerBusyTime,omitempty"`
|
||||
PowerOnHours *big.Int `json:"powerOnHours,omitempty"`
|
||||
PowerCycles *big.Int `json:"powerCycles,omitempty"`
|
||||
UnsafeShutdowns *big.Int `json:"unsafeShutdowns,omitempty"`
|
||||
MediaAndDataIntegrityErrors *big.Int `json:"mediaAndDataIntgerityErrors,omitempty"`
|
||||
DataUnitsReadBytes *big.Int `json:"dataUnitsReadBytes,omitempty"`
|
||||
DataUnitsWrittenBytes *big.Int `json:"dataUnitsWrittenBytes,omitempty"`
|
||||
HostReadCommands *big.Int `json:"hostReadCommands,omitempty"`
|
||||
HostWriteCommands *big.Int `json:"hostWriteCommands,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user