mirror of
https://github.com/intel/intel-device-plugins-for-kubernetes.git
synced 2025-06-03 03:59:37 +00:00
Merge pull request #366 from uniemimu/master
topology: avoid unnecessary warning prints
This commit is contained in:
commit
0a7b6a7ea0
@ -270,17 +270,19 @@ func GetTopologyInfo(devs []string) (*pluginapi.TopologyInfo, error) {
|
||||
}
|
||||
|
||||
for _, hint := range hints {
|
||||
for _, nNode := range strings.Split(hint.NUMAs, ",") {
|
||||
nNodeID, err := strconv.ParseInt(strings.TrimSpace(nNode), 10, 64)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "unable to convert numa node %s into int64", nNode)
|
||||
}
|
||||
if nNodeID < 0 {
|
||||
return nil, errors.Wrapf(err, "numa node is negative: %d", nNodeID)
|
||||
}
|
||||
if _, ok := nodeIDs[nNodeID]; !ok {
|
||||
result.Nodes = append(result.Nodes, &pluginapi.NUMANode{ID: nNodeID})
|
||||
nodeIDs[nNodeID] = struct{}{}
|
||||
if hint.NUMAs != "" {
|
||||
for _, nNode := range strings.Split(hint.NUMAs, ",") {
|
||||
nNodeID, err := strconv.ParseInt(strings.TrimSpace(nNode), 10, 64)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "unable to convert numa node %s into int64", nNode)
|
||||
}
|
||||
if nNodeID < 0 {
|
||||
return nil, errors.Wrapf(err, "numa node is negative: %d", nNodeID)
|
||||
}
|
||||
if _, ok := nodeIDs[nNodeID]; !ok {
|
||||
result.Nodes = append(result.Nodes, &pluginapi.NUMANode{ID: nNodeID})
|
||||
nodeIDs[nNodeID] = struct{}{}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -373,10 +373,10 @@ func TestGetTopologyInfo(t *testing.T) {
|
||||
expectedErr: true,
|
||||
},
|
||||
{
|
||||
name: "incorrect numa node ID",
|
||||
name: "valid: missing numa node ID",
|
||||
input: []string{"/dev/random"},
|
||||
output: nil,
|
||||
expectedErr: true,
|
||||
output: &pluginapi.TopologyInfo{},
|
||||
expectedErr: false,
|
||||
},
|
||||
}
|
||||
for _, test := range cases {
|
||||
|
Loading…
Reference in New Issue
Block a user