https://github.com/opiproject/godpu
Go library and cli to communicate with DPUs and IPUs
https://github.com/opiproject/godpu
Last synced: 11 months ago
JSON representation
Go library and cli to communicate with DPUs and IPUs
- Host: GitHub
- URL: https://github.com/opiproject/godpu
- Owner: opiproject
- License: apache-2.0
- Created: 2022-09-15T17:34:48.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-20T16:47:16.000Z (over 1 year ago)
- Last Synced: 2025-04-07T20:56:15.555Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 608 KB
- Stars: 9
- Watchers: 1
- Forks: 18
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# godpu
[](https://github.com/opiproject/godpu/actions/workflows/linters.yml)
[](https://github.com/opiproject/godpu/actions/workflows/codeql.yml)
[](https://securityscorecards.dev/viewer/?platform=github.com&org=opiproject&repo=godpu)
[](https://github.com/opiproject/godpu/actions/workflows/go.yml)
[](https://github.com/opiproject/godpu/actions/workflows/docker-publish.yml)
[](https://github.com/opiproject/godpu/blob/master/LICENSE)
[](https://codecov.io/gh/opiproject/godpu)
[](https://goreportcard.com/report/github.com/opiproject/godpu)
[](http://godoc.org/github.com/opiproject/godpu)
[](https://hub.docker.com/r/opiproject/godpu)
[](https://github.com/opiproject/godpu/releases)
[](https://github.com/opiproject/godpu)
[](https://github.com/opiproject/godpu/graphs/contributors)
Go library and cli to communicate with DPUs and IPUs.
## I Want To Contribute
This project welcomes contributions and suggestions. We are happy to have the
Community involved via submission of **Issues and Pull Requests** (with
substantive content or even just fixes). We are hoping for the documents,
test framework, etc. to become a community process with active engagement.
PRs can be reviewed by any number of people, and a maintainer may accept.
See [CONTRIBUTING](https://github.com/opiproject/opi/blob/main/CONTRIBUTING.md)
and [GitHub Basic Process](https://github.com/opiproject/opi/blob/main/doc-github-rules.md)
for more details.
## Installation
There are several ways of running this CLI.
### Docker
```sh
docker pull opiproject/godpu:
```
You can specify a version like `0.1.1` or use `latest` to get the most up-to-date version.
Run latest version of the CLI in a container:
```sh
docker run --rm opiproject/godpu:latest --help
```
Replace `--help` with any `godpu` command, without `godpu` itself.
### Golang
```sh
go install -v github.com/opiproject/godpu@latest
```
or import
```go
import (
"github.com/opiproject/godpu"
)
```
## Tests
Test your APIs even if unmerged using your private fork like this:
```bash
chmod a+w go.*
docker run --rm -it -v `pwd`:/app -w /app golang:alpine go mod edit -replace github.com/opiproject/opi-api@main=github.com/YOURUSERNAME/opi-api@main
docker run --rm -it -v `pwd`:/app -w /app golang:alpine go get -u github.com/YOURUSERNAME/opi-api/storage/v1alpha1/gen/go@a98ca449468a
docker run --rm -it -v `pwd`:/app -w /app golang:alpine go mod tidy
```
Generate mocks like this:
```bash
go install github.com/vektra/mockery/v2@latest
make mock-generate
```
## CLI
### Storage
```bash
alias dpu="docker run --rm --network host ghcr.io/opiproject/godpu:main"
# connect to remote nvme/tcp controller
nvmf0=$(dpu storage create backend nvme controller --id nvmf0 --multipath disable)
path0=$(dpu storage create backend nvme path tcp --controller "$nvmf0" --id path0 --ip "11.11.11.2" --port 4444 --nqn nqn.2016-06.io.spdk:cnode1 --hostnqn nqn.2014-08.org.nvmexpress:uuid:feb98abe-d51f-40c8-b348-2753f3571d3c)
dpu storage get backend nvme controller --name $nvmf0
dpu storage get backend nvme path --name $path0
# connect to local nvme/pcie ssd controller
nvmf1=$(dpu storage create backend nvme controller --id nvmf1 --multipath disable)
path1=$(dpu storage create backend nvme path pcie --controller "$nvmf1" --id path1 --bdf "0000:40:00.0")
dpu storage get backend nvme controller --name $nvmf1
dpu storage get backend nvme path --name $path1
# expose volume over nvme/tcp controller
ss0=$(dpu storage create frontend nvme subsystem --id subsys0 --nqn "nqn.2022-09.io.spdk:opitest0")
ns0=$(dpu storage create frontend nvme namespace --id namespace0 --volume "Malloc0" --subsystem "$ss0")
ctrl0=$(dpu storage create frontend nvme controller tcp --id ctrl0 --ip "127.0.0.1" --port 4420 --subsystem "$ss0")
# expose volume over emulated nvme/pcie controller
ss1=$(dpu storage create frontend nvme subsystem --id subsys1 --nqn "nqn.2022-09.io.spdk:opitest1")
ns1=$(dpu storage create frontend nvme namespace --id namespace1 --volume "Malloc1" --subsystem "$ss1")
ctrl1=$(dpu storage create frontend nvme controller pcie --id ctrl1 --port 0 --pf 0 --vf 0 --subsystem "$ss1")
# delete emulated nvme/pcie controller
dpu storage delete frontend nvme controller --name "$ctrl1"
dpu storage delete frontend nvme namespace --name "$ns1"
dpu storage delete frontend nvme subsystem --name "$ss1"
# delete nvme/tcp controller
dpu storage delete frontend nvme controller --name "$ctrl0"
dpu storage delete frontend nvme namespace --name "$ns0"
dpu storage delete frontend nvme subsystem --name "$ss0"
# disconnect from local nvme/pcie ssd controller
dpu storage delete backend nvme path --name "$path1"
dpu storage delete backend nvme controller --name "$nvmf1"
# disconnect from remote nvme/tcp controller
dpu storage delete backend nvme path --name "$path0"
dpu storage delete backend nvme controller --name "$nvmf0"
```