aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_cluster_check.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-04-12 08:47:27 -0700
committerchrislu <chris.lu@gmail.com>2022-04-12 08:47:27 -0700
commit1f03fcccb1eb916cdd5d03432da2981588ef8130 (patch)
treea9e183b0b1a47b14b4043423610a28560f1748b8 /weed/shell/command_cluster_check.go
parentdd13764a5c12cd63e79cd733f973de9f758029e1 (diff)
downloadseaweedfs-1f03fcccb1eb916cdd5d03432da2981588ef8130.tar.xz
seaweedfs-1f03fcccb1eb916cdd5d03432da2981588ef8130.zip
fix nil in cluster_check shell command
fix https://github.com/chrislusf/seaweedfs/issues/2905
Diffstat (limited to 'weed/shell/command_cluster_check.go')
-rw-r--r--weed/shell/command_cluster_check.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/shell/command_cluster_check.go b/weed/shell/command_cluster_check.go
index f841bd224..c8fe110ba 100644
--- a/weed/shell/command_cluster_check.go
+++ b/weed/shell/command_cluster_check.go
@@ -48,7 +48,10 @@ func (c *commandClusterCheck) Do(args []string, commandEnv *CommandEnv, writer i
emptyDiskTypeDiskInfo, emptyDiskTypeFound := topologyInfo.DiskInfos[""]
hddDiskTypeDiskInfo, hddDiskTypeFound := topologyInfo.DiskInfos["hdd"]
- if !emptyDiskTypeFound && !hddDiskTypeFound || emptyDiskTypeDiskInfo.VolumeCount == 0 && hddDiskTypeDiskInfo.VolumeCount == 0 {
+ if !emptyDiskTypeFound && !hddDiskTypeFound {
+ return fmt.Errorf("Need to a hdd disk type!")
+ }
+ if emptyDiskTypeFound && emptyDiskTypeDiskInfo.VolumeCount == 0 || hddDiskTypeFound && hddDiskTypeDiskInfo.VolumeCount == 0 {
return fmt.Errorf("Need to a hdd disk type!")
}