fix(master): canAllocDp compatible with 3.4.0 before

Signed-off-by: chihe <chihe@oppo.com>
This commit is contained in:
chihe 2024-11-21 14:40:27 +08:00 committed by AmazingChi
parent bff1bbca48
commit dee812aded
3 changed files with 9 additions and 6 deletions

View File

@ -280,9 +280,12 @@ func (dataNode *DataNode) canAllocDp() bool {
return false
}
if cnt := dataNode.availableDiskCount(); cnt == 0 {
log.LogWarnf("action[canAllocDp] dataNode [%v] availableDiskCount is 0 ", dataNode.Addr)
return false
// compatible with 3.4.0 before
if len(dataNode.AllDisks) != 0 {
if cnt := dataNode.availableDiskCount(); cnt == 0 {
log.LogWarnf("action[canAllocDp] dataNode [%v] availableDiskCount is 0 ", dataNode.Addr)
return false
}
}
if !dataNode.PartitionCntLimited() {

View File

@ -699,8 +699,8 @@ func (mm *monitorMetrics) setVolMetrics() {
mm.volNames[volName] = struct{}{}
delete(deleteVolNames, volName)
mm.volTotalSpace.SetWithLabelValues(float64(volStatInfo.TotalSize)/float64(util.GB), volName)
mm.volUsedSpace.SetWithLabelValues(float64(volStatInfo.UsedSize)/float64(util.GB), volName)
mm.volTotalSpace.SetWithLabelValues(float64(volStatInfo.TotalSize), volName)
mm.volUsedSpace.SetWithLabelValues(float64(volStatInfo.UsedSize), volName)
usedRatio, e := strconv.ParseFloat(volStatInfo.UsedRatio, 64)
if e == nil {
mm.volUsage.SetWithLabelValues(usedRatio, volName)

View File

@ -22,7 +22,7 @@ import (
)
func TestInodeOnce(t *testing.T) {
ino := &InodeOnce{
ino := &InodeOnceWithVersion{
UniqID: 123,
Inode: 456,
}