Skip to content

Commit

Permalink
fix cannot create gpu device issue
Browse files Browse the repository at this point in the history
  • Loading branch information
simonycj committed Jul 10, 2024
1 parent 885b3c1 commit 29782d3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/open-hydra/device-handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,11 @@ func (builder *OpenHydraRouteBuilder) DeviceCreateRouteHandler(request *restful.
if gpuSet.Gpu > 0 {
// go with gpu image
if reqDevice.Spec.GpuDriver == "" {
writeHttpResponseAndLogError(response, http.StatusBadRequest, "gpu driver is empty")
return
if builder.Config.DefaultGpuDriver == "" {
writeHttpResponseAndLogError(response, http.StatusBadRequest, "both gpu driver and DefaultGpuDriver are empty")
return
}
reqDevice.Spec.GpuDriver = builder.Config.DefaultGpuDriver
}

// ensure gpu is allowed
Expand Down

0 comments on commit 29782d3

Please sign in to comment.