Skip to content

Commit

Permalink
fix: update code with changes in opi api
Browse files Browse the repository at this point in the history
Signed-off-by: Artsiom Koltun <[email protected]>
  • Loading branch information
artek-koltun committed Jan 23, 2024
1 parent 0745b7a commit 85da9f7
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ docker run --network=host --rm -it namely/grpc-cli ls --json_input --json_outp
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 CreateNvmeSubsystem "{nvme_subsystem : {spec : {nqn: 'nqn.2022-09.io.spdk:opitest2', serial_number: 'myserial2', model_number: 'mymodel2', max_namespaces: 11} }, nvme_subsystem_id : 'subsystem2' }"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 ListNvmeSubsystems "{}"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 GetNvmeSubsystem "{name : '//storage.opiproject.org/subsystems/subsystem2'}"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 CreateNvmeController "{parent: '//storage.opiproject.org/subsystems/subsystem2', nvme_controller : {spec : {nvme_controller_id: 2, pcie_id : {physical_function : 0, virtual_function : 0, port_id: 0}, max_nsq:5, max_ncq:5, 'trtype': 'NVME_TRANSPORT_PCIE' } }, nvme_controller_id : 'controller1'}"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 CreateNvmeController "{parent: '//storage.opiproject.org/subsystems/subsystem2', nvme_controller : {spec : {nvme_controller_id: 2, pcie_id : {physical_function : 0, virtual_function : 0, port_id: 0}, max_nsq:5, max_ncq:5, 'trtype': 'NVME_TRANSPORT_TYPE_PCIE' } }, nvme_controller_id : 'controller1'}"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 ListNvmeControllers "{parent : '//storage.opiproject.org/subsystems/subsystem2'}"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 GetNvmeController "{name : '//storage.opiproject.org/subsystems/subsystem2/controllers/controller1'}"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 CreateNvmeNamespace "{parent: '//storage.opiproject.org/subsystems/subsystem2', nvme_namespace : {spec : {volume_name_ref : 'Malloc0', 'host_nsid' : '10', uuid:{value : '1b4e28ba-2fa1-11d2-883f-b9a761bde3fb'}, nguid: '1b4e28ba-2fa1-11d2-883f-b9a761bde3fb', eui64: 1967554867335598546 } }, nvme_namespace_id: 'namespace1'}"
Expand All @@ -96,9 +96,9 @@ docker run --network=host --rm -it namely/grpc-cli call --json_input --json_outp
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 CreateNvmeRemoteController "{nvme_remote_controller : {multipath: 'NVME_MULTIPATH_MULTIPATH'}, nvme_remote_controller_id: 'nvmetcp12'}"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 ListNvmeRemoteControllers "{parent : 'todo'}"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 GetNvmeRemoteController "{name: '//storage.opiproject.org/volumes/nvmetcp12'}"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 CreateNvmePath "{nvme_path : {controller_name_ref: '//storage.opiproject.org/volumes/nvmetcp12', traddr:'11.11.11.2', trtype:'NVME_TRANSPORT_TCP', fabrics: {adrfam:'NVME_ADRFAM_IPV4', subnqn:'nqn.2016-06.com.opi.spdk.target0', trsvcid:'4444', hostnqn:'nqn.2014-08.org.nvmexpress:uuid:feb98abe-d51f-40c8-b348-2753f3571d3c'}}, nvme_path_id: 'nvmetcp12path0'}"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 CreateNvmePath "{nvme_path : {controller_name_ref: '//storage.opiproject.org/volumes/nvmetcp12', traddr:'11.11.11.2', trtype:'NVME_TRANSPORT_TYPE_TCP', fabrics: {adrfam:'NVME_ADDRESS_FAMILY_IPV4', subnqn:'nqn.2016-06.com.opi.spdk.target0', trsvcid:'4444', hostnqn:'nqn.2014-08.org.nvmexpress:uuid:feb98abe-d51f-40c8-b348-2753f3571d3c'}}, nvme_path_id: 'nvmetcp12path0'}"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 CreateNvmeRemoteController "{nvme_remote_controller : {multipath: 'NVME_MULTIPATH_DISABLE'}, nvme_remote_controller_id: 'nvmepcie13'}"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 CreateNvmePath "{nvme_path : {controller_name_ref: '//storage.opiproject.org/volumes/nvmepcie13', traddr:'0000:01:00.0', trtype:'NVME_TRANSPORT_PCIE'}, nvme_path_id: 'nvmepcie13path0'}"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 CreateNvmePath "{nvme_path : {controller_name_ref: '//storage.opiproject.org/volumes/nvmepcie13', traddr:'0000:01:00.0', trtype:'NVME_TRANSPORT_TYPE_PCIE'}, nvme_path_id: 'nvmepcie13path0'}"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 ListNvmePaths "{parent : 'todo'}"
docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 DeleteNvmePath "{name: '//storage.opiproject.org/volumes/nvmepcie13path0'}"
Expand Down
2 changes: 1 addition & 1 deletion pkg/frontend/frontend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ var (
VirtualFunction: wrapperspb.Int32(2),
PortId: wrapperspb.Int32(0)},
},
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_PCIE,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE,
NvmeControllerId: proto.Int32(17),
},
}
Expand Down
36 changes: 18 additions & 18 deletions pkg/frontend/nvme_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestFrontEnd_CreateNvmeController(t *testing.T) {
t.Cleanup(checkGlobalTestProtoObjectsNotChanged(t, t.Name()))
spec := &pb.NvmeControllerSpec{
Endpoint: testController.Spec.Endpoint,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_PCIE,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE,
NvmeControllerId: proto.Int32(1),
MaxNsq: 5,
MaxNcq: 6,
Expand Down Expand Up @@ -112,7 +112,7 @@ func TestFrontEnd_CreateNvmeController(t *testing.T) {
Name: testControllerName,
Spec: &pb.NvmeControllerSpec{
Endpoint: testController.Spec.Endpoint,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_PCIE,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE,
NvmeControllerId: proto.Int32(17),
MaxNsq: 5,
MaxNcq: 6,
Expand All @@ -124,7 +124,7 @@ func TestFrontEnd_CreateNvmeController(t *testing.T) {
Name: testControllerName,
Spec: &pb.NvmeControllerSpec{
Endpoint: testController.Spec.Endpoint,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_PCIE,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE,
NvmeControllerId: proto.Int32(17),
MaxNsq: 5,
MaxNcq: 6,
Expand Down Expand Up @@ -157,7 +157,7 @@ func TestFrontEnd_CreateNvmeController(t *testing.T) {
in: &pb.NvmeController{
Spec: &pb.NvmeControllerSpec{
Endpoint: testController.Spec.Endpoint,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_PCIE,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE,
NvmeControllerId: proto.Int32(1),
},
},
Expand All @@ -182,7 +182,7 @@ func TestFrontEnd_CreateNvmeController(t *testing.T) {
id: testControllerID,
in: &pb.NvmeController{
Spec: &pb.NvmeControllerSpec{
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_PCIE,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE,
NvmeControllerId: proto.Int32(1),
},
},
Expand All @@ -201,17 +201,17 @@ func TestFrontEnd_CreateNvmeController(t *testing.T) {
FabricsId: &pb.FabricsEndpoint{
Traddr: "127.0.0.1",
Trsvcid: "4420",
Adrfam: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4,
Adrfam: pb.NvmeAddressFamily_NVME_ADDRESS_FAMILY_IPV4,
},
},
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TCP,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP,
NvmeControllerId: proto.Int32(1),
},
},
out: nil,
spdk: []string{},
errCode: codes.Unknown,
errMsg: fmt.Sprintf("not supported transport type: %v", pb.NvmeTransportType_NVME_TRANSPORT_TCP),
errMsg: fmt.Sprintf("not supported transport type: %v", pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP),
exist: false,
subsys: testSubsystemName,
},
Expand All @@ -223,10 +223,10 @@ func TestFrontEnd_CreateNvmeController(t *testing.T) {
FabricsId: &pb.FabricsEndpoint{
Traddr: "127.0.0.1",
Trsvcid: "4420",
Adrfam: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4,
Adrfam: pb.NvmeAddressFamily_NVME_ADDRESS_FAMILY_IPV4,
},
},
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_PCIE,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE,
NvmeControllerId: proto.Int32(1),
},
},
Expand Down Expand Up @@ -396,7 +396,7 @@ func TestFrontEnd_DeleteNvmeController(t *testing.T) {
func TestFrontEnd_UpdateNvmeController(t *testing.T) {
spec := &pb.NvmeControllerSpec{
Endpoint: testController.Spec.Endpoint,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_PCIE,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE,
NvmeControllerId: proto.Int32(1),
MaxNsq: 5,
MaxNcq: 6,
Expand Down Expand Up @@ -475,7 +475,7 @@ func TestFrontEnd_UpdateNvmeController(t *testing.T) {
Name: testControllerName,
Spec: &pb.NvmeControllerSpec{
Endpoint: testController.Spec.Endpoint,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_PCIE,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE,
NvmeControllerId: proto.Int32(17),
MaxNsq: 5,
MaxNcq: 6,
Expand All @@ -487,7 +487,7 @@ func TestFrontEnd_UpdateNvmeController(t *testing.T) {
Name: testControllerName,
Spec: &pb.NvmeControllerSpec{
Endpoint: testController.Spec.Endpoint,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_PCIE,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE,
NvmeControllerId: proto.Int32(17),
MaxNsq: 5,
MaxNcq: 6,
Expand Down Expand Up @@ -530,17 +530,17 @@ func TestFrontEnd_UpdateNvmeController(t *testing.T) {
FabricsId: &pb.FabricsEndpoint{
Traddr: "127.0.0.1",
Trsvcid: "4420",
Adrfam: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4,
Adrfam: pb.NvmeAddressFamily_NVME_ADDRESS_FAMILY_IPV4,
},
},
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TCP,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP,
NvmeControllerId: proto.Int32(1),
},
},
out: nil,
spdk: []string{},
errCode: codes.Unknown,
errMsg: fmt.Sprintf("not supported transport type: %v", pb.NvmeTransportType_NVME_TRANSPORT_TCP),
errMsg: fmt.Sprintf("not supported transport type: %v", pb.NvmeTransportType_NVME_TRANSPORT_TYPE_TCP),
},
"not corresponding endpoint for pcie transport type": {
mask: nil,
Expand All @@ -550,10 +550,10 @@ func TestFrontEnd_UpdateNvmeController(t *testing.T) {
FabricsId: &pb.FabricsEndpoint{
Traddr: "127.0.0.1",
Trsvcid: "4420",
Adrfam: pb.NvmeAddressFamily_NVME_ADRFAM_IPV4,
Adrfam: pb.NvmeAddressFamily_NVME_ADDRESS_FAMILY_IPV4,
},
},
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_PCIE,
Trtype: pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE,
NvmeControllerId: proto.Int32(1),
},
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/frontend/nvme_controller_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (s *Server) validateCreateNvmeControllerRequest(in *pb.CreateNvmeController
}
}

if in.NvmeController.Spec.Trtype != pb.NvmeTransportType_NVME_TRANSPORT_PCIE {
if in.NvmeController.Spec.Trtype != pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE {
return fmt.Errorf("not supported transport type: %v", in.NvmeController.Spec.Trtype)
}

Expand All @@ -54,7 +54,7 @@ func (s *Server) validateUpdateNvmeControllerRequest(in *pb.UpdateNvmeController
return err
}

if in.NvmeController.Spec.Trtype != pb.NvmeTransportType_NVME_TRANSPORT_PCIE {
if in.NvmeController.Spec.Trtype != pb.NvmeTransportType_NVME_TRANSPORT_TYPE_PCIE {
return fmt.Errorf("not supported transport type: %v", in.NvmeController.Spec.Trtype)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/frontend/nvme_namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (s *Server) CreateNvmeNamespace(ctx context.Context, in *pb.CreateNvmeNames
Subnqn: subsys.Spec.Nqn,
Nguid: in.NvmeNamespace.Spec.Nguid,
Eui64: strconv.FormatInt(in.NvmeNamespace.Spec.Eui64, 10),
UUID: in.NvmeNamespace.Spec.Uuid.Value,
UUID: in.NvmeNamespace.Spec.Uuid,
ShareEnable: 1,
Bdev: in.NvmeNamespace.Spec.VolumeNameRef,
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/frontend/nvme_namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestFrontEnd_CreateNvmeNamespace(t *testing.T) {
spec := &pb.NvmeNamespaceSpec{
HostNsid: 0,
VolumeNameRef: "Malloc1",
Uuid: &pc.Uuid{Value: "1b4e28ba-2fa1-11d2-883f-b9a761bde3fb"},
Uuid: "1b4e28ba-2fa1-11d2-883f-b9a761bde3fb",
Nguid: "1b4e28ba-2fa1-11d2-883f-b9a761bde3fb",
Eui64: 1967554867335598546,
}
Expand Down Expand Up @@ -113,7 +113,7 @@ func TestFrontEnd_CreateNvmeNamespace(t *testing.T) {
Spec: &pb.NvmeNamespaceSpec{
HostNsid: 22,
VolumeNameRef: "Malloc1",
Uuid: &pc.Uuid{Value: "1b4e28ba-2fa1-11d2-883f-b9a761bde3fb"},
Uuid: "1b4e28ba-2fa1-11d2-883f-b9a761bde3fb",
Nguid: "1b4e28ba-2fa1-11d2-883f-b9a761bde3fb",
Eui64: 1967554867335598546,
},
Expand All @@ -123,7 +123,7 @@ func TestFrontEnd_CreateNvmeNamespace(t *testing.T) {
Spec: &pb.NvmeNamespaceSpec{
HostNsid: 22,
VolumeNameRef: "Malloc1",
Uuid: &pc.Uuid{Value: "1b4e28ba-2fa1-11d2-883f-b9a761bde3fb"},
Uuid: "1b4e28ba-2fa1-11d2-883f-b9a761bde3fb",
Nguid: "1b4e28ba-2fa1-11d2-883f-b9a761bde3fb",
Eui64: 1967554867335598546,
},
Expand Down

0 comments on commit 85da9f7

Please sign in to comment.