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 <Boris.Glimcher@emc.com>
  • Loading branch information
glimchb committed Nov 2, 2022
1 parent 780c9eb commit f36628c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 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
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

0 comments on commit f36628c

Please # to comment.