From a8560d1037590d4d25ccf62a23fa6b61bf76678a Mon Sep 17 00:00:00 2001 From: Boris Glimcher Date: Wed, 2 Nov 2022 02:03:59 +0200 Subject: [PATCH] fix code after API changes see opiproject/opi-api#181 Signed-off-by: Boris Glimcher --- README.md | 2 +- client/go.mod | 2 +- client/go.sum | 4 ++-- server/frontend.go | 25 +++++++++++++------------ server/go.mod | 2 +- server/go.sum | 4 ++-- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 171ad5f0..9bbab4d6 100644 --- a/README.md +++ b/README.md @@ -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) {} diff --git a/client/go.mod b/client/go.mod index 040f1244..4bee2eb3 100644 --- a/client/go.mod +++ b/client/go.mod @@ -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 ) diff --git a/client/go.sum b/client/go.sum index bda11dfd..bbeee06e 100644 --- a/client/go.sum +++ b/client/go.sum @@ -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= diff --git a/server/frontend.go b/server/frontend.go index b1226e44..502c6a41 100644 --- a/server/frontend.go +++ b/server/frontend.go @@ -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" ) // //////////////////////////////////////////////////////// @@ -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 { @@ -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) { @@ -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) { @@ -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 { @@ -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) { @@ -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()), @@ -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) { @@ -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()), @@ -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) { @@ -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"` @@ -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) { diff --git a/server/go.mod b/server/go.mod index 68080c12..f0b8f8f3 100644 --- a/server/go.mod +++ b/server/go.mod @@ -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 diff --git a/server/go.sum b/server/go.sum index c83ca7d0..a0f7e971 100644 --- a/server/go.sum +++ b/server/go.sum @@ -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=