Slide 24
Slide 24 text
【実装】デバイスの割り当て pkg/edgetpu/coral/beta_plugin.go
func (s *pluginServiceV1Beta1) Allocate(ctx context.Context, requests *pluginapi.AllocateRequest) (*pluginapi.AllocateResponse,
error) {
resps := new(pluginapi.AllocateResponse)
for _, rqt := range requests.ContainerRequests {
resp := new(pluginapi.ContainerAllocateResponse)
for _, id := range rqt.DevicesIDs {
resp.Devices = append(resp.Devices, &pluginapi.DeviceSpec{
HostPath: path.Join(s.cem.devDirectory, id),
ContainerPath: path.Join(s.cem.devDirectory, id), // コンテナ上でもホストと同一パスにマウント
Permissions: "mrw", // 権限フルオープン
})
}
resps.ContainerResponses = append(resps.ContainerResponses, resp)
}
return resps, nil
}
24