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.
master
Shireesh Anjal 4 years ago committed by GitHub
parent 93eb549a83
commit 5a18d437ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      cmd/healthinfo_linux.go

@ -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),
}
}
smartInfo.Error = fmt.Sprintf("smart: %v", err)
}
partition := madmin.PartitionStat{
Device: part.Device,

Loading…
Cancel
Save