diff --git a/README.md b/README.md index d0bfbd6..001e59b 100644 --- a/README.md +++ b/README.md @@ -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'}" @@ -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'}" diff --git a/pkg/frontend/frontend_test.go b/pkg/frontend/frontend_test.go index bf40d55..ec12062 100644 --- a/pkg/frontend/frontend_test.go +++ b/pkg/frontend/frontend_test.go @@ -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), }, } diff --git a/pkg/frontend/nvme_controller_test.go b/pkg/frontend/nvme_controller_test.go index a0ef959..b09e950 100644 --- a/pkg/frontend/nvme_controller_test.go +++ b/pkg/frontend/nvme_controller_test.go @@ -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, @@ -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, @@ -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, @@ -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), }, }, @@ -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), }, }, @@ -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, }, @@ -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), }, }, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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), }, }, diff --git a/pkg/frontend/nvme_controller_validate.go b/pkg/frontend/nvme_controller_validate.go index 6eb0454..9a74c8e 100644 --- a/pkg/frontend/nvme_controller_validate.go +++ b/pkg/frontend/nvme_controller_validate.go @@ -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) } @@ -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) } diff --git a/pkg/frontend/nvme_namespace.go b/pkg/frontend/nvme_namespace.go index 636c380..ec4e15c 100644 --- a/pkg/frontend/nvme_namespace.go +++ b/pkg/frontend/nvme_namespace.go @@ -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, } diff --git a/pkg/frontend/nvme_namespace_test.go b/pkg/frontend/nvme_namespace_test.go index 1c19d2e..8d84552 100644 --- a/pkg/frontend/nvme_namespace_test.go +++ b/pkg/frontend/nvme_namespace_test.go @@ -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, } @@ -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, }, @@ -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, },