Skip to content

Commit

Permalink
feat(disk driver): set env DRIVER_OVERRIDE if provided
Browse files Browse the repository at this point in the history
Longhorn 8813

Signed-off-by: Derek Su <[email protected]>
  • Loading branch information
derekbit committed Jul 26, 2024
1 parent 85e5737 commit 274e737
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/cmd/spdksetup/spdksetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func diskStatusCmd(c *cli.Context) error {
return err
}

fmt.Println(output)
fmt.Println(string(output))

return nil
}
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ require (
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
)

replace github.com/longhorn/go-common-libs v0.0.0-20240720044518-32fc527fe868 => github.com/derekbit/go-common-libs v0.0.0-20240726044555-d6c576d61bf3
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/derekbit/go-common-libs v0.0.0-20240726044555-d6c576d61bf3 h1:KywgsVPOhK5YfODjnmkMCR2YcLVKXvClxZUAI5l6Xd0=
github.com/derekbit/go-common-libs v0.0.0-20240726044555-d6c576d61bf3/go.mod h1:o01gaAiKE5NCd8+5i6csJSU4ELlW0Yn8GQ9U7pbXG9w=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
Expand All @@ -18,8 +20,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/longhorn/go-common-libs v0.0.0-20240720044518-32fc527fe868 h1:B1L6EGHroqnGUC5shcoNJsLPRpfBa8c01/TPO68G0GI=
github.com/longhorn/go-common-libs v0.0.0-20240720044518-32fc527fe868/go.mod h1:o01gaAiKE5NCd8+5i6csJSU4ELlW0Yn8GQ9U7pbXG9w=
github.com/longhorn/nsfilelock v0.0.0-20200723175406-fa7c83ad0003 h1:Jw9uANsGcHTxp6HcC++/vN17LfeuDmozHI2j6DoZf5E=
github.com/longhorn/nsfilelock v0.0.0-20200723175406-fa7c83ad0003/go.mod h1:0CLeXlf59Lg6C0kjLSDf47ft73Dh37CwymYRKWwAn04=
github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc=
Expand Down
8 changes: 5 additions & 3 deletions pkg/spdk/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"fmt"
"strings"

commonNs "github.com/longhorn/go-common-libs/ns"
"github.com/pkg/errors"

commonNs "github.com/longhorn/go-common-libs/ns"

"github.com/longhorn/go-spdk-helper/pkg/types"
)

Expand All @@ -22,12 +23,13 @@ func Bind(deviceAddr, deviceDriver string, executor *commonNs.Executor) (string,

envs := []string{
fmt.Sprintf("%s=%s", "PCI_ALLOWED", deviceAddr),
fmt.Sprintf("%s=%s", "DRIVER_OVERRIDE", deviceDriver),
}
if deviceDriver != "" {
envs = append(envs, fmt.Sprintf("%s=%s", "DRIVER_OVERRIDE", deviceDriver))
}

cmdArgs := []string{
spdkSetupPath,
"bind",
}

outputStr, err := executor.Execute(envs, "bash", cmdArgs, types.ExecuteTimeout)
Expand Down

0 comments on commit 274e737

Please sign in to comment.