Skip to content

Commit

Permalink
refactor(storage): rename volume_id -> volume_name_ref
Browse files Browse the repository at this point in the history
Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
  • Loading branch information
glimchb committed Aug 3, 2023
1 parent 0ad494e commit a58c5d7
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 110 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ services:
test: grpcurl -plaintext localhost:50051 list || exit 1

opi-spdk-client:
image: ghcr.io/opiproject/godpu:main@sha256:f9ed4453b1f43e896f2ae05d2d57fbd62fd8891716efd9cc3dba49557dce3bbb
image: ghcr.io/opiproject/godpu:main@sha256:532b641df768a345b12d6e5fae481ab90394fd40cb3a21aa77791418b13e29a1
networks:
- opi
depends_on:
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/digitalocean/go-qemu v0.0.0-20230711162256-2e3d0186973e
github.com/google/uuid v1.3.0
github.com/opiproject/gospdk v0.0.0-20230724125810-f9b59208a93e
github.com/opiproject/opi-api v0.0.0-20230802143709-76c2f23d70d5
github.com/opiproject/opi-api v0.0.0-20230803153709-1e58d25ae2be
go.einride.tech/aip v0.61.0
google.golang.org/grpc v1.57.0
google.golang.org/protobuf v1.31.0
Expand All @@ -18,7 +18,7 @@ require (
golang.org/x/net v0.13.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
google.golang.org/genproto v0.0.0-20230731193218-e0aa005b6bdf // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230731193218-e0aa005b6bdf // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731193218-e0aa005b6bdf // indirect
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5 // indirect
)
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/opiproject/gospdk v0.0.0-20230724125810-f9b59208a93e h1:y27NgCS0+ESFLR40iwWm7OM0qi++zTjRDuQt09+iie8=
github.com/opiproject/gospdk v0.0.0-20230724125810-f9b59208a93e/go.mod h1:RqA5Ix7+x0Is8UckJE+6Ji5kCfk6yujWWaTMoRlZv3w=
github.com/opiproject/opi-api v0.0.0-20230802143709-76c2f23d70d5 h1:L0TDC4GEqKUpoiZAqEezI/Cha5sstiXg4ZNqLgYUPn0=
github.com/opiproject/opi-api v0.0.0-20230802143709-76c2f23d70d5/go.mod h1:92pv4ulvvPMuxCJ9ND3aYbmBfEMLx0VCjpkiR7ZTqPY=
github.com/opiproject/opi-api v0.0.0-20230803153709-1e58d25ae2be h1:YwIWGD+r0FHjuAjLq+ISExvm39bBpipZdAYe0cM5D9I=
github.com/opiproject/opi-api v0.0.0-20230803153709-1e58d25ae2be/go.mod h1:92pv4ulvvPMuxCJ9ND3aYbmBfEMLx0VCjpkiR7ZTqPY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down Expand Up @@ -52,12 +52,12 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto v0.0.0-20230731193218-e0aa005b6bdf h1:v5Cf4E9+6tawYrs/grq1q1hFpGtzlGFzgWHqwt6NFiU=
google.golang.org/genproto v0.0.0-20230731193218-e0aa005b6bdf/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8=
google.golang.org/genproto/googleapis/api v0.0.0-20230731193218-e0aa005b6bdf h1:xkVZ5FdZJF4U82Q/JS+DcZA83s/GRVL+QrFMlexk9Yo=
google.golang.org/genproto/googleapis/api v0.0.0-20230731193218-e0aa005b6bdf/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731193218-e0aa005b6bdf h1:guOdSPaeFgN+jEJwTo1dQ71hdBm+yKSCCKuTRkJzcVo=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731193218-e0aa005b6bdf/go.mod h1:zBEcrKX2ZOcEkHWxBPAIvYUWOKKMIhYcmNiUIu2ji3I=
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g=
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8=
google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 h1:nIgk/EEq3/YlnmVVXVnm14rC2oxgs1o0ong4sD/rd44=
google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5 h1:eSaPbMR4T7WfH9FvABk36NBMacoTUKdWCvV0dx+KfOg=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5/go.mod h1:zBEcrKX2ZOcEkHWxBPAIvYUWOKKMIhYcmNiUIu2ji3I=
google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
Expand Down
15 changes: 6 additions & 9 deletions pkg/middleend/qos.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (s *Server) CreateQosVolume(_ context.Context, in *pb.CreateQosVolumeReques
return volume, nil
}

if err := s.setMaxLimit(in.QosVolume.VolumeId.Value, in.QosVolume.MaxLimit); err != nil {
if err := s.setMaxLimit(in.QosVolume.VolumeNameRef, in.QosVolume.MaxLimit); err != nil {
return nil, err
}

Expand Down Expand Up @@ -93,7 +93,7 @@ func (s *Server) DeleteQosVolume(_ context.Context, in *pb.DeleteQosVolumeReques
return nil, err
}

if err := s.cleanMaxLimit(qosVolume.VolumeId.Value); err != nil {
if err := s.cleanMaxLimit(qosVolume.VolumeNameRef); err != nil {
return nil, err
}

Expand Down Expand Up @@ -122,14 +122,14 @@ func (s *Server) UpdateQosVolume(_ context.Context, in *pb.UpdateQosVolumeReques
return nil, status.Errorf(codes.NotFound, "unable to find key %s", name)
}

if volume.VolumeId.Value != in.QosVolume.VolumeId.Value {
if volume.VolumeNameRef != in.QosVolume.VolumeNameRef {
msg := fmt.Sprintf("Change of underlying volume %v to a new one %v is forbidden",
volume.VolumeId.Value, in.QosVolume.VolumeId.Value)
volume.VolumeNameRef, in.QosVolume.VolumeNameRef)
log.Println("error:", msg)
return nil, status.Errorf(codes.InvalidArgument, msg)
}
log.Println("Set new max limit values")
if err := s.setMaxLimit(in.QosVolume.VolumeId.Value, in.QosVolume.MaxLimit); err != nil {
if err := s.setMaxLimit(in.QosVolume.VolumeNameRef, in.QosVolume.MaxLimit); err != nil {
return nil, err
}

Expand Down Expand Up @@ -213,7 +213,7 @@ func (s *Server) StatsQosVolume(_ context.Context, in *pb.StatsQosVolumeRequest)
return nil, err
}
params := spdk.BdevGetIostatParams{
Name: volume.VolumeId.Value,
Name: volume.VolumeNameRef,
}
var result spdk.BdevGetIostatResult
err := s.rpc.Call("bdev_get_iostat", &params, &result)
Expand Down Expand Up @@ -249,9 +249,6 @@ func (s *Server) verifyQosVolume(volume *pb.QosVolume) error {
if err := resourcename.Validate(volume.Name); err != nil {
return err
}
if volume.VolumeId == nil || volume.VolumeId.Value == "" {
return fmt.Errorf("volume_id cannot be empty")
}

if volume.MinLimit != nil {
return fmt.Errorf("QoS volume min_limit is not supported")
Expand Down
Loading

0 comments on commit a58c5d7

Please sign in to comment.