gpu_plugin: reduce topology scanning for high shared dev count

For every created device info, a new topology scan is performed in
the filesystem. The shared dev count was implemented so that for each
shared device, a new device info was created, which resulted in the
topology scan happening as many times per Scan-round, as there were
shared devs.

This fixes the issue by making the device info to be shared among the
shared devices.

Signed-off-by: Ukri Niemimuukko <ukri.niemimuukko@intel.com>
This commit is contained in:
Ukri Niemimuukko 2020-09-08 18:57:29 +03:00
parent 9bdf3a4def
commit b2991b94e1

View File

@ -148,11 +148,12 @@ func (dp *devicePlugin) scan() (dpapi.DeviceTree, error) {
}
if len(nodes) > 0 {
deviceInfo := dpapi.NewDeviceInfo(pluginapi.Healthy, nodes, nil, nil)
for i := 0; i < dp.sharedDevNum; i++ {
devID := fmt.Sprintf("%s-%d", f.Name(), i)
// Currently only one device type (i915) is supported.
// TODO: check model ID to differentiate device models.
devTree.AddDevice(deviceType, devID, dpapi.NewDeviceInfo(pluginapi.Healthy, nodes, nil, nil))
devTree.AddDevice(deviceType, devID, deviceInfo)
}
}
}