Skip to content

Commit f89a9d8

Browse files
Add NewDeviceInfoWithTopologyHints() constructor that allows to pass custom topology info
1 parent 0288f24 commit f89a9d8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/deviceplugin/api.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ func NewDeviceInfo(state string, nodes []pluginapi.DeviceSpec, mounts []pluginap
6666
return deviceInfo
6767
}
6868

69+
// NewDeviceInfoWithTopologyHints makes DeviceInfo struct with topology information provided to it.
70+
func NewDeviceInfoWithTopologyHints(state string, nodes []pluginapi.DeviceSpec, mounts []pluginapi.Mount, envs map[string]string,
71+
topology *pluginapi.TopologyInfo) DeviceInfo {
72+
return DeviceInfo{
73+
state: state,
74+
nodes: nodes,
75+
mounts: mounts,
76+
envs: envs,
77+
topology: topology,
78+
}
79+
}
80+
6981
// DeviceTree contains a tree-like structure of device type -> device ID -> device info.
7082
type DeviceTree map[string]map[string]DeviceInfo
7183

0 commit comments

Comments
 (0)