diff --git a/go.mod b/go.mod index 8b171f43..85a3b4e4 100644 --- a/go.mod +++ b/go.mod @@ -8,10 +8,10 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.1 github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 github.com/onsi/ginkgo/v2 v2.12.1 - github.com/opiproject/gospdk v0.0.0-20231010002529-a2e5546ab856 - github.com/opiproject/opi-api v0.0.0-20231009064235-b166668c8a86 + github.com/opiproject/gospdk v0.0.0-20231011133140-19e2c3c96f5a + github.com/opiproject/opi-api v0.0.0-20231010164729-3c2cd198297c github.com/opiproject/opi-smbios-bridge v0.1.3-0.20231002193517-9e34badb6265 - github.com/opiproject/opi-spdk-bridge v0.1.2-0.20231010125224-24f59929632e + github.com/opiproject/opi-spdk-bridge v0.1.2-0.20231011133259-cc629572bb25 github.com/opiproject/opi-strongswan-bridge v0.1.1 github.com/philippgille/gokv v0.6.0 github.com/philippgille/gokv/gomap v0.6.0 @@ -19,7 +19,7 @@ require ( go.einride.tech/aip v0.62.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0 golang.org/x/tools v0.14.0 - google.golang.org/grpc v1.58.2 + google.golang.org/grpc v1.58.3 google.golang.org/protobuf v1.31.0 ) @@ -210,7 +210,7 @@ require ( golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/mod v0.13.0 // indirect - golang.org/x/net v0.16.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/term v0.13.0 // indirect diff --git a/go.sum b/go.sum index 653924e6..fb6ed6c7 100644 --- a/go.sum +++ b/go.sum @@ -444,6 +444,8 @@ github.com/opiproject/gospdk v0.0.0-20231009130851-ff9bd6faf71a h1:8j6GXu13bFM3u github.com/opiproject/gospdk v0.0.0-20231009130851-ff9bd6faf71a/go.mod h1:mRMIpGIwz5uuUUaDhh6ceIYq20qR5OVtxE0/x5fprEA= github.com/opiproject/gospdk v0.0.0-20231010002529-a2e5546ab856 h1:6g5F0gWzBUblradIH0kLyOc0teyYq9Sdi07U1nAbs+A= github.com/opiproject/gospdk v0.0.0-20231010002529-a2e5546ab856/go.mod h1:mRMIpGIwz5uuUUaDhh6ceIYq20qR5OVtxE0/x5fprEA= +github.com/opiproject/gospdk v0.0.0-20231011133140-19e2c3c96f5a h1:4IbuGfNhYJGIiyO9jdlB/6KEM0TJuQczMY/HtyJ3V0k= +github.com/opiproject/gospdk v0.0.0-20231011133140-19e2c3c96f5a/go.mod h1:n6oNPOPed86FigkmLziCzQplyipsWCxIJ2UAgU5vnrw= github.com/opiproject/opi-api v0.0.0-20231002080217-fc749d07fdda h1:w/HTrqmBrXabdcc71ACkRQqavKDFvfPp0MqiGWKTGjw= github.com/opiproject/opi-api v0.0.0-20231002080217-fc749d07fdda/go.mod h1:92pv4ulvvPMuxCJ9ND3aYbmBfEMLx0VCjpkiR7ZTqPY= github.com/opiproject/opi-api v0.0.0-20231004104309-217649f4535f h1:TXLfuUmFwB7Zk8YKIzEfT/LQ2i5d+BW/BzjQgaBBOWM= @@ -452,6 +454,8 @@ github.com/opiproject/opi-api v0.0.0-20231005114927-ec55946e5197 h1:3wsLOfvfaVcn github.com/opiproject/opi-api v0.0.0-20231005114927-ec55946e5197/go.mod h1:92pv4ulvvPMuxCJ9ND3aYbmBfEMLx0VCjpkiR7ZTqPY= github.com/opiproject/opi-api v0.0.0-20231009064235-b166668c8a86 h1:lHZuWCy8La/nSZr2IAnLbrNV6JHCmWS1IMlTM73mPVM= github.com/opiproject/opi-api v0.0.0-20231009064235-b166668c8a86/go.mod h1:92pv4ulvvPMuxCJ9ND3aYbmBfEMLx0VCjpkiR7ZTqPY= +github.com/opiproject/opi-api v0.0.0-20231010164729-3c2cd198297c h1:YxPTKQsWmTBuYaskuKxt157igXotgveNjBx4sTHwl8k= +github.com/opiproject/opi-api v0.0.0-20231010164729-3c2cd198297c/go.mod h1:92pv4ulvvPMuxCJ9ND3aYbmBfEMLx0VCjpkiR7ZTqPY= github.com/opiproject/opi-smbios-bridge v0.1.3-0.20230930033102-4953908f3ea6 h1:0TCR2UmJcQTCCH1uK0LdZ6LcBycO3uUAnLwfBqs6rIM= github.com/opiproject/opi-smbios-bridge v0.1.3-0.20230930033102-4953908f3ea6/go.mod h1:qWMKMtmpgqXDoV4T+VYY6w9vwreU2y14eY9y5pRpsW8= github.com/opiproject/opi-smbios-bridge v0.1.3-0.20231002193517-9e34badb6265 h1:7yPIQIPhRB09+ni0ypQAKrzhvfDfphk+dXRVl9Pyuvk= @@ -466,6 +470,8 @@ github.com/opiproject/opi-spdk-bridge v0.1.2-0.20231007135056-df9fa5d7b614 h1:OW github.com/opiproject/opi-spdk-bridge v0.1.2-0.20231007135056-df9fa5d7b614/go.mod h1:KRkBGPdFmmY+JeZrHj5Aa/LnSN+MUuW3nVkb7Bd7Fu8= github.com/opiproject/opi-spdk-bridge v0.1.2-0.20231010125224-24f59929632e h1:NJEwCp0l2SR2cIhaCQw3A+NO9Nu8ygChRzJywhmynzc= github.com/opiproject/opi-spdk-bridge v0.1.2-0.20231010125224-24f59929632e/go.mod h1:kyhCIlm5xZxRzgOrOhmYyPLniSVg++fQ917VoTnSs5c= +github.com/opiproject/opi-spdk-bridge v0.1.2-0.20231011133259-cc629572bb25 h1:DNXsHeAAKTbvA1y0wNaYnwzIi5UK201j4yBgckfsJ5k= +github.com/opiproject/opi-spdk-bridge v0.1.2-0.20231011133259-cc629572bb25/go.mod h1:p3BFKFWK3cv97UvfC8tZXQD8TEpGbbYI6bSfCQKQlx4= github.com/opiproject/opi-strongswan-bridge v0.1.1 h1:Mz/8AtA0DD8O/H9jCsDw7wuVoWNiqgXICLsD10XWJ+g= github.com/opiproject/opi-strongswan-bridge v0.1.1/go.mod h1:ek3r3zLa9nOfb2a7ybdMJvb5BSGU9I17Xo38UMXfE+k= github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k= @@ -784,6 +790,8 @@ golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1075,6 +1083,8 @@ google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA5 google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/pkg/frontend/frontend_test.go b/pkg/frontend/frontend_test.go index bb53db20..5b79ac51 100644 --- a/pkg/frontend/frontend_test.go +++ b/pkg/frontend/frontend_test.go @@ -143,8 +143,8 @@ var ( Name: testNamespaceName, Spec: testNamespace.Spec, Status: &pb.NvmeNamespaceStatus{ - PciState: 2, - PciOperState: 1, + State: pb.NvmeNamespaceStatus_STATE_ENABLED, + OperState: pb.NvmeNamespaceStatus_OPER_STATE_ONLINE, }, } testVirtioCtrlID = "virtio-blk-42" diff --git a/pkg/frontend/nvme_namespace.go b/pkg/frontend/nvme_namespace.go index 38a7f98a..babd687d 100644 --- a/pkg/frontend/nvme_namespace.go +++ b/pkg/frontend/nvme_namespace.go @@ -82,7 +82,10 @@ func (s *Server) CreateNvmeNamespace(ctx context.Context, in *pb.CreateNvmeNames return nil, status.Errorf(codes.InvalidArgument, msg) } response := utils.ProtoClone(in.NvmeNamespace) - response.Status = &pb.NvmeNamespaceStatus{PciState: 2, PciOperState: 1} + response.Status = &pb.NvmeNamespaceStatus{ + State: pb.NvmeNamespaceStatus_STATE_ENABLED, + OperState: pb.NvmeNamespaceStatus_OPER_STATE_ONLINE, + } s.Namespaces[in.NvmeNamespace.Name] = response return response, nil } @@ -232,7 +235,15 @@ func (s *Server) GetNvmeNamespace(ctx context.Context, in *pb.GetNvmeNamespaceRe for i := range result.Namespaces { r := &result.Namespaces[i] if r.Nsid == int(namespace.Spec.HostNsid) { - return &pb.NvmeNamespace{Spec: &pb.NvmeNamespaceSpec{HostNsid: int32(r.Nsid)}, Status: &pb.NvmeNamespaceStatus{PciState: 2, PciOperState: 1}}, nil + return &pb.NvmeNamespace{ + Spec: &pb.NvmeNamespaceSpec{ + HostNsid: int32(r.Nsid), + }, + Status: &pb.NvmeNamespaceStatus{ + State: pb.NvmeNamespaceStatus_STATE_ENABLED, + OperState: pb.NvmeNamespaceStatus_OPER_STATE_ONLINE, + }, + }, nil } } msg := fmt.Sprintf("Could not find HostNsid: %d", namespace.Spec.HostNsid) diff --git a/pkg/frontend/nvme_namespace_test.go b/pkg/frontend/nvme_namespace_test.go index 83c99e60..e024129c 100644 --- a/pkg/frontend/nvme_namespace_test.go +++ b/pkg/frontend/nvme_namespace_test.go @@ -125,8 +125,8 @@ func TestFrontEnd_CreateNvmeNamespace(t *testing.T) { Eui64: 1967554867335598546, }, Status: &pb.NvmeNamespaceStatus{ - PciState: 2, - PciOperState: 1, + State: pb.NvmeNamespaceStatus_STATE_ENABLED, + OperState: pb.NvmeNamespaceStatus_OPER_STATE_ONLINE, }, }, spdk: []string{`{"id":%d,"error":{"code":0,"message":""},"result":true}`}, @@ -700,8 +700,8 @@ func TestFrontEnd_GetNvmeNamespace(t *testing.T) { HostNsid: 22, }, Status: &pb.NvmeNamespaceStatus{ - PciState: 2, - PciOperState: 1, + State: pb.NvmeNamespaceStatus_STATE_ENABLED, + OperState: pb.NvmeNamespaceStatus_OPER_STATE_ONLINE, }, }, spdk: []string{`{"id":%d,"error":{"code":0,"message":""},"result":{"name": "NvmeEmu0pf1", "cntlid": 1, "Namespaces": [{"nsid": 11, "bdev": "Malloc0", "bdev_type": "spdk", "qn": "", "protocol": ""},{"nsid": 22, "bdev": "Malloc1", "bdev_type": "spdk", "qn": "", "protocol": ""},{"nsid": 13, "bdev": "Malloc2", "bdev_type": "spdk", "qn": "", "protocol": ""}]}}`},