Skip to content

Commit

Permalink
fix code after API changes
Browse files Browse the repository at this point in the history
see opiproject/opi-api#181

Signed-off-by: Boris Glimcher <[email protected]>
  • Loading branch information
glimchb committed Nov 2, 2022
1 parent 780c9eb commit ff63cc8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ filename: frontend.proto
package: opi_api.storage.v1;
service NVMeControllerService {
rpc NVMeControllerCreate(opi_api.storage.v1.NVMeControllerCreateRequest) returns (opi_api.storage.v1.NVMeController) {}
rpc NVMeControllerDelete(opi_api.storage.v1.NVMeControllerDeleteRequest) returns (opi_api.storage.v1.NVMeControllerDeleteResponse) {}
rpc NVMeControllerDelete(opi_api.storage.v1.NVMeControllerDeleteRequest) returns (google.protobuf.Empty) {}
rpc NVMeControllerUpdate(opi_api.storage.v1.NVMeControllerUpdateRequest) returns (opi_api.storage.v1.NVMeControllerUpdateResponse) {}
rpc NVMeControllerList(opi_api.storage.v1.NVMeControllerListRequest) returns (opi_api.storage.v1.NVMeControllerListResponse) {}
rpc NVMeControllerGet(opi_api.storage.v1.NVMeControllerGetRequest) returns (opi_api.storage.v1.NVMeControllerGetResponse) {}
Expand Down
2 changes: 1 addition & 1 deletion client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module opi.storage.v1
go 1.19

require (
github.com/opiproject/opi-api v0.0.0-20221101224637-22b77cdc0625
github.com/opiproject/opi-api v0.0.0-20221102145024-1b5a67ca57ab
google.golang.org/grpc v1.50.1
)

Expand Down
4 changes: 2 additions & 2 deletions client/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/opiproject/opi-api v0.0.0-20221101224637-22b77cdc0625 h1:CPjLzORRn+/k13+WA3m5tI1c/JytSY13Ua6AZcnCNUA=
github.com/opiproject/opi-api v0.0.0-20221101224637-22b77cdc0625/go.mod h1:92pv4ulvvPMuxCJ9ND3aYbmBfEMLx0VCjpkiR7ZTqPY=
github.com/opiproject/opi-api v0.0.0-20221102145024-1b5a67ca57ab h1:U616PUfDkuIq0BMo91SW8rxDJ0LbX3RdML86m2DZ6D4=
github.com/opiproject/opi-api v0.0.0-20221102145024-1b5a67ca57ab/go.mod h1:92pv4ulvvPMuxCJ9ND3aYbmBfEMLx0VCjpkiR7ZTqPY=
golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
Expand Down
25 changes: 13 additions & 12 deletions server/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/ulule/deepcopier"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/emptypb"
)

// ////////////////////////////////////////////////////////
Expand Down Expand Up @@ -41,7 +42,7 @@ func (s *server) NVMeSubsystemCreate(ctx context.Context, in *pb.NVMeSubsystemCr
return response, nil
}

func (s *server) NVMeSubsystemDelete(ctx context.Context, in *pb.NVMeSubsystemDeleteRequest) (*pb.NVMeSubsystemDeleteResponse, error) {
func (s *server) NVMeSubsystemDelete(ctx context.Context, in *pb.NVMeSubsystemDeleteRequest) (*emptypb.Empty, error) {
log.Printf("NVMeSubsystemDelete: Received from client: %v", in)
subsys, ok := subsystems[in.SubsystemId.Value]
if !ok {
Expand All @@ -63,7 +64,7 @@ func (s *server) NVMeSubsystemDelete(ctx context.Context, in *pb.NVMeSubsystemDe
log.Printf("Could not delete: %v", in)
}
delete(subsystems, subsys.Id.Value)
return &pb.NVMeSubsystemDeleteResponse{}, nil
return &emptypb.Empty{}, nil
}

func (s *server) NVMeSubsystemUpdate(ctx context.Context, in *pb.NVMeSubsystemUpdateRequest) (*pb.NVMeSubsystemUpdateResponse, error) {
Expand Down Expand Up @@ -143,14 +144,14 @@ func (s *server) NVMeControllerCreate(ctx context.Context, in *pb.NVMeController
return response, nil
}

func (s *server) NVMeControllerDelete(ctx context.Context, in *pb.NVMeControllerDeleteRequest) (*pb.NVMeControllerDeleteResponse, error) {
func (s *server) NVMeControllerDelete(ctx context.Context, in *pb.NVMeControllerDeleteRequest) (*emptypb.Empty, error) {
log.Printf("Received from client: %v", in.ControllerId)
controller, ok := controllers[in.ControllerId.Value]
if !ok {
return nil, fmt.Errorf("error finding controller %s", in.ControllerId.Value)
}
delete(controllers, controller.Id.Value)
return &pb.NVMeControllerDeleteResponse{}, nil
return &emptypb.Empty{}, nil
}

func (s *server) NVMeControllerUpdate(ctx context.Context, in *pb.NVMeControllerUpdateRequest) (*pb.NVMeControllerUpdateResponse, error) {
Expand Down Expand Up @@ -219,7 +220,7 @@ func (s *server) NVMeNamespaceCreate(ctx context.Context, in *pb.NVMeNamespaceCr
return response, nil
}

func (s *server) NVMeNamespaceDelete(ctx context.Context, in *pb.NVMeNamespaceDeleteRequest) (*pb.NVMeNamespaceDeleteResponse, error) {
func (s *server) NVMeNamespaceDelete(ctx context.Context, in *pb.NVMeNamespaceDeleteRequest) (*emptypb.Empty, error) {
log.Printf("NVMeNamespaceDelete: Received from client: %v", in)
namespace, ok := namespaces[in.NamespaceId.Value]
if !ok {
Expand All @@ -246,7 +247,7 @@ func (s *server) NVMeNamespaceDelete(ctx context.Context, in *pb.NVMeNamespaceDe
}
log.Printf("Received from SPDK: %v", result)
delete(namespaces, namespace.Id.Value)
return &pb.NVMeNamespaceDeleteResponse{}, nil
return &emptypb.Empty{}, nil
}

func (s *server) NVMeNamespaceUpdate(ctx context.Context, in *pb.NVMeNamespaceUpdateRequest) (*pb.NVMeNamespaceUpdateResponse, error) {
Expand Down Expand Up @@ -366,7 +367,7 @@ func (s *server) VirtioBlkCreate(ctx context.Context, in *pb.VirtioBlkCreateRequ
return &pb.VirtioBlk{}, nil
}

func (s *server) VirtioBlkDelete(ctx context.Context, in *pb.VirtioBlkDeleteRequest) (*pb.VirtioBlkDeleteResponse, error) {
func (s *server) VirtioBlkDelete(ctx context.Context, in *pb.VirtioBlkDeleteRequest) (*emptypb.Empty, error) {
log.Printf("VirtioBlkDelete: Received from client: %v", in)
params := VhostDeleteControllerParams{
Ctrlr: fmt.Sprint("VirtioBlk", in.GetControllerId()),
Expand All @@ -381,7 +382,7 @@ func (s *server) VirtioBlkDelete(ctx context.Context, in *pb.VirtioBlkDeleteRequ
if !result {
log.Printf("Could not delete: %v", in)
}
return &pb.VirtioBlkDeleteResponse{}, nil
return &emptypb.Empty{}, nil
}

func (s *server) VirtioBlkUpdate(ctx context.Context, in *pb.VirtioBlkUpdateRequest) (*pb.VirtioBlkUpdateResponse, error) {
Expand Down Expand Up @@ -451,7 +452,7 @@ func (s *server) VirtioScsiControllerCreate(ctx context.Context, in *pb.VirtioSc
return &pb.VirtioScsiController{}, nil
}

func (s *server) VirtioScsiControllerDelete(ctx context.Context, in *pb.VirtioScsiControllerDeleteRequest) (*pb.VirtioScsiControllerDeleteResponse, error) {
func (s *server) VirtioScsiControllerDelete(ctx context.Context, in *pb.VirtioScsiControllerDeleteRequest) (*emptypb.Empty, error) {
log.Printf("VirtioScsiControllerDelete: Received from client: %v", in)
params := VhostDeleteControllerParams{
Ctrlr: fmt.Sprint("OPI-VirtioScsi", in.GetControllerId()),
Expand All @@ -466,7 +467,7 @@ func (s *server) VirtioScsiControllerDelete(ctx context.Context, in *pb.VirtioSc
if !result {
log.Printf("Could not delete: %v", in)
}
return &pb.VirtioScsiControllerDeleteResponse{}, nil
return &emptypb.Empty{}, nil
}

func (s *server) VirtioScsiControllerUpdate(ctx context.Context, in *pb.VirtioScsiControllerUpdateRequest) (*pb.VirtioScsiControllerUpdateResponse, error) {
Expand Down Expand Up @@ -539,7 +540,7 @@ func (s *server) VirtioScsiLunCreate(ctx context.Context, in *pb.VirtioScsiLunCr
return &pb.VirtioScsiLun{}, nil
}

func (s *server) VirtioScsiLunDelete(ctx context.Context, in *pb.VirtioScsiLunDeleteRequest) (*pb.VirtioScsiLunDeleteResponse, error) {
func (s *server) VirtioScsiLunDelete(ctx context.Context, in *pb.VirtioScsiLunDeleteRequest) (*emptypb.Empty, error) {
log.Printf("VirtioScsiLunDelete: Received from client: %v", in)
params := struct {
Name string `json:"ctrlr"`
Expand All @@ -558,7 +559,7 @@ func (s *server) VirtioScsiLunDelete(ctx context.Context, in *pb.VirtioScsiLunDe
if !result {
log.Printf("Could not delete: %v", in)
}
return &pb.VirtioScsiLunDeleteResponse{}, nil
return &emptypb.Empty{}, nil
}

func (s *server) VirtioScsiLunUpdate(ctx context.Context, in *pb.VirtioScsiLunUpdateRequest) (*pb.VirtioScsiLunUpdateResponse, error) {
Expand Down
2 changes: 1 addition & 1 deletion server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module opi.storage.v1
go 1.19

require (
github.com/opiproject/opi-api v0.0.0-20221101224637-22b77cdc0625
github.com/opiproject/opi-api v0.0.0-20221102145024-1b5a67ca57ab
github.com/ulule/deepcopier v0.0.0-20200430083143-45decc6639b6
google.golang.org/grpc v1.50.1
google.golang.org/protobuf v1.28.1
Expand Down
4 changes: 2 additions & 2 deletions server/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/opiproject/opi-api v0.0.0-20221101224637-22b77cdc0625 h1:CPjLzORRn+/k13+WA3m5tI1c/JytSY13Ua6AZcnCNUA=
github.com/opiproject/opi-api v0.0.0-20221101224637-22b77cdc0625/go.mod h1:92pv4ulvvPMuxCJ9ND3aYbmBfEMLx0VCjpkiR7ZTqPY=
github.com/opiproject/opi-api v0.0.0-20221102145024-1b5a67ca57ab h1:U616PUfDkuIq0BMo91SW8rxDJ0LbX3RdML86m2DZ6D4=
github.com/opiproject/opi-api v0.0.0-20221102145024-1b5a67ca57ab/go.mod h1:92pv4ulvvPMuxCJ9ND3aYbmBfEMLx0VCjpkiR7ZTqPY=
github.com/ulule/deepcopier v0.0.0-20200430083143-45decc6639b6 h1:TtyC78WMafNW8QFfv3TeP3yWNDG+uxNkk9vOrnDu6JA=
github.com/ulule/deepcopier v0.0.0-20200430083143-45decc6639b6/go.mod h1:h8272+G2omSmi30fBXiZDMkmHuOgonplfKIKjQWzlfs=
golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0=
Expand Down

0 comments on commit ff63cc8

Please sign in to comment.