|
|
|
@@ -1110,15 +1110,25 @@ func genClusterResources(cType string, cNum string, s *omodel.Spec) (*collector. |
|
|
|
var cpuCore int64 |
|
|
|
var memGi int64 |
|
|
|
|
|
|
|
// card |
|
|
|
if cNum == "" { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
cardNum, err := strconv.ParseInt(cNum, 10, 64) |
|
|
|
if err != nil { |
|
|
|
cardNum = 0 |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
|
|
|
|
// cpu |
|
|
|
if s.ResourceQuantity.Cpu == "" { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
cpuCore, err = strconv.ParseInt(s.ResourceQuantity.Cpu, 10, 64) |
|
|
|
if err != nil { |
|
|
|
cpuCore = 0 |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
|
|
|
|
//memory |
|
|
|
if s.ResourceQuantity.Memory != "" { |
|
|
|
gi := strings.Split(s.ResourceQuantity.Memory, Gi) |
|
|
|
if len(gi) != 2 { |
|
|
|
@@ -1132,7 +1142,7 @@ func genClusterResources(cType string, cNum string, s *omodel.Spec) (*collector. |
|
|
|
memGi = mGi |
|
|
|
} |
|
|
|
} else { |
|
|
|
memGi = 0 |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
|
|
|
|
card := &collector.Usage{ |
|
|
|
|