fix: drive hw info incomplete when smartinfo fails (#11509)

Collection of SMART information doesn't work in certain scenarios e.g.
in a container based setup. In such cases, instead of returning an error
(without any data), we should only set the error on the smartinfo
struct, so that other important drive hw info like device, mountpoint,
etc is retained in the output.
This commit is contained in:
Shireesh Anjal 2021-02-10 22:18:14 +05:30 committed by GitHub
parent 93eb549a83
commit 5a18d437ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,6 @@ import (
"fmt"
"net/http"
"strings"
"syscall"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/minio/pkg/smart"
@ -99,14 +98,7 @@ func getLocalDiskHwInfo(ctx context.Context, r *http.Request) madmin.ServerDiskH
paths = append(paths, path)
smartInfo, err := smart.GetInfo(device)
if err != nil {
if syscall.EACCES == err {
smartInfo.Error = fmt.Sprintf("smart: %v", err)
} else {
return madmin.ServerDiskHwInfo{
Addr: addr,
Error: fmt.Sprintf("smart: %v", err),
}
}
}
partition := madmin.PartitionStat{
Device: part.Device,