From b14fcea4435a71e2251afaecb0abc7db6bf5b179 Mon Sep 17 00:00:00 2001 From: Kris Jacque Date: Wed, 1 Jul 2026 16:10:22 +0000 Subject: [PATCH 1/2] DAOS-19006 control: Remove storage firmware update Firmware update for storage devices was supported for a very limited subset of devices, and has since become irrelevant in customer deployments. The feature is unused, so can be removed. Features: control Signed-off-by: Kris Jacque --- .rpmignore | 3 - Jenkinsfile | 1 - site_scons/prereq_tools/base.py | 1 - src/control/README.md | 1 - src/control/SConscript | 11 - .../cmd/daos_firmware_helper/handler.go | 145 -- .../cmd/daos_firmware_helper/handler_test.go | 330 ---- src/control/cmd/daos_firmware_helper/main.go | 35 - src/control/cmd/dmg/README.md | 8 - src/control/cmd/dmg/firmware.go | 195 --- src/control/cmd/dmg/firmware_test.go | 203 --- src/control/cmd/dmg/main.go | 46 +- src/control/cmd/dmg/pretty/firmware.go | 571 ------- src/control/cmd/dmg/pretty/firmware_test.go | 1451 ----------------- src/control/common/proto/ctl/ctl.pb.go | 198 +-- src/control/common/proto/ctl/ctl_grpc.pb.go | 112 +- src/control/common/proto/ctl/firmware.pb.go | 841 ---------- src/control/lib/control/firmware.go | 389 ----- src/control/lib/control/firmware_test.go | 495 ------ src/control/lib/ipmctl/README.md | 2 - src/control/lib/ipmctl/nvm.go | 5 +- src/control/lib/ipmctl/nvm_linux_amd64.go | 44 +- src/control/lib/ipmctl/nvm_stubs.go | 11 +- src/control/lib/ipmctl/nvm_test.go | 89 +- src/control/lib/ipmctl/nvm_types.go | 22 +- src/control/lib/spdk/README.md | 1 - src/control/lib/spdk/include/nvme_control.h | 13 +- src/control/lib/spdk/mocks.go | 13 +- src/control/lib/spdk/nvme.go | 4 +- src/control/lib/spdk/nvme_default.go | 24 +- src/control/lib/spdk/src/nvme_control.c | 77 - src/control/pbin/pbin.go | 8 +- src/control/run_go_tests.sh | 4 +- src/control/security/grpc_authorization.go | 2 - .../security/grpc_authorization_test.go | 2 - src/control/server/config/server.go | 12 +- src/control/server/config/server_test.go | 1 - src/control/server/ctl_firmware.go | 176 -- src/control/server/ctl_firmware_test.go | 824 ---------- src/control/server/harness.go | 4 +- src/control/server/server_utils.go | 6 - src/control/server/storage/bdev.go | 109 +- src/control/server/storage/bdev/backend.go | 15 - .../server/storage/bdev/backend_test.go | 41 - src/control/server/storage/bdev/firmware.go | 135 -- .../server/storage/bdev/firmware_test.go | 420 ----- src/control/server/storage/bdev/mocks.go | 5 +- src/control/server/storage/bdev/provider.go | 3 +- src/control/server/storage/mocks.go | 72 +- src/control/server/storage/provider.go | 20 - src/control/server/storage/scm.go | 143 -- src/control/server/storage/scm/firmware.go | 127 -- .../server/storage/scm/firmware_test.go | 450 ----- .../server/storage/scm/ipmctl_firmware.go | 98 -- .../storage/scm/ipmctl_firmware_test.go | 182 --- src/control/server/storage/scm/mocks.go | 46 +- src/control/server/storage/scm/provider.go | 2 - src/proto/Makefile | 2 +- src/proto/ctl/ctl.proto | 5 - src/proto/ctl/firmware.proto | 66 - utils/config/daos_server.yml | 6 - utils/docker/Dockerfile.el.8 | 2 +- utils/docker/Dockerfile.el.9 | 2 +- utils/docker/Dockerfile.leap.15 | 3 +- utils/docker/Dockerfile.ubuntu | 3 +- utils/rpms/daos.changelog | 3 + utils/rpms/daos.rpmlintrc | 6 +- utils/rpms/daos.sh | 17 - utils/rpms/daos.spec | 19 +- 69 files changed, 171 insertions(+), 8211 deletions(-) delete mode 100644 src/control/cmd/daos_firmware_helper/handler.go delete mode 100644 src/control/cmd/daos_firmware_helper/handler_test.go delete mode 100644 src/control/cmd/daos_firmware_helper/main.go delete mode 100644 src/control/cmd/dmg/firmware.go delete mode 100644 src/control/cmd/dmg/firmware_test.go delete mode 100644 src/control/cmd/dmg/pretty/firmware.go delete mode 100644 src/control/cmd/dmg/pretty/firmware_test.go delete mode 100644 src/control/common/proto/ctl/firmware.pb.go delete mode 100644 src/control/lib/control/firmware.go delete mode 100644 src/control/lib/control/firmware_test.go delete mode 100644 src/control/server/ctl_firmware.go delete mode 100644 src/control/server/ctl_firmware_test.go delete mode 100644 src/control/server/storage/bdev/firmware.go delete mode 100644 src/control/server/storage/bdev/firmware_test.go delete mode 100644 src/control/server/storage/scm/firmware.go delete mode 100644 src/control/server/storage/scm/firmware_test.go delete mode 100644 src/control/server/storage/scm/ipmctl_firmware.go delete mode 100644 src/control/server/storage/scm/ipmctl_firmware_test.go delete mode 100644 src/proto/ctl/firmware.proto diff --git a/.rpmignore b/.rpmignore index 86666be323b..6114f1d69db 100644 --- a/.rpmignore +++ b/.rpmignore @@ -4,19 +4,16 @@ # el8/daos-*tests*.rpm -el8/daos-firmware*.rpm el8/daos-mofed*.rpm el8/daos-serialize*.rpm el8/ucx*.rpm el9/daos-*tests*.rpm -el9/daos-firmware*.rpm el9/daos-mofed*.rpm el9/daos-serialize*.rpm el9/ucx*.rpm leap15/daos-*tests*.rpm -leap15/daos-firmware*.rpm leap15/daos-mofed*.rpm leap15/daos-serialize*.rpm leap15/openucx*.rpm diff --git a/Jenkinsfile b/Jenkinsfile index 4719995ffaa..58bf3735c22 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -444,7 +444,6 @@ void fixup_rpmlintrc() { '/usr/bin/daos', '/usr/bin/daos_agent', '/usr/bin/hello_drpc', - '/usr/bin/daos_firmware', '/usr/bin/daos_admin', '/usr/bin/daos_server', '/usr/bin/ddb'] diff --git a/site_scons/prereq_tools/base.py b/site_scons/prereq_tools/base.py index 309b3edb056..6c57d97f49a 100644 --- a/site_scons/prereq_tools/base.py +++ b/site_scons/prereq_tools/base.py @@ -506,7 +506,6 @@ def __init__(self, env, opts): PathVariable.PathIsDirCreate)) opts.Add('USE_INSTALLED', 'Comma separated list of preinstalled dependencies', 'none') opts.Add(('MPI_PKG', 'Specifies name of pkg-config to load for MPI', None)) - opts.Add(BoolVariable('FIRMWARE_MGMT', 'Build in device firmware management.', False)) opts.Add(EnumVariable('BUILD_TYPE', "Set the build type", 'release', ['dev', 'debug', 'release'], ignorecase=1)) opts.Add(EnumVariable('TARGET_TYPE', "Set the prerequisite type", 'default', diff --git a/src/control/README.md b/src/control/README.md index cb5bd05d9d6..49eaa43a7e7 100644 --- a/src/control/README.md +++ b/src/control/README.md @@ -181,7 +181,6 @@ The following build tags are applied automatically to include all testable code: | Tag | What it enables | |---|---| -| `firmware` | Firmware management command and handler | | `fault_injection` | Fault injection support in server and client library | | `test_stubs` | C library stubs (`libdaos`, `libgurt`) that avoid linking against the real shared libraries during unit tests | | `spdk` | SPDK NVMe and BDev bindings | diff --git a/src/control/SConscript b/src/control/SConscript index 3af67828687..ba6c4aed172 100644 --- a/src/control/SConscript +++ b/src/control/SConscript @@ -9,16 +9,9 @@ from os import urandom from os.path import join -def is_firmware_mgmt_build(benv): - "Check whether this build has firmware management enabled." - return benv["FIRMWARE_MGMT"] == 1 - - def get_build_tags(benv): "Get custom go build tags." tags = ["spdk"] - if is_firmware_mgmt_build(benv): - tags.append("firmware") if not is_release_build(benv): tags.append("fault_injection") tags.append("pprof") @@ -229,10 +222,6 @@ def scons(): aenv.d_add_rpaths(None, True, True) install_go_bin(aenv, 'daos_server_helper', libs=['nvme_control']) - if is_firmware_mgmt_build(aenv): - print("(EXPERIMENTAL) Building DAOS firmware tools") - install_go_bin(aenv, "daos_firmware_helper", libs=['nvme_control']) - ddb_env = aenv.Clone() ddb_env.AppendUnique(RPATH_FULL=['$PREFIX/lib64/daos_srv']) ddb_env.d_add_rpaths(None, True, True) diff --git a/src/control/cmd/daos_firmware_helper/handler.go b/src/control/cmd/daos_firmware_helper/handler.go deleted file mode 100644 index 6753303e82c..00000000000 --- a/src/control/cmd/daos_firmware_helper/handler.go +++ /dev/null @@ -1,145 +0,0 @@ -// -// (C) Copyright 2020-2022 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -//go:build firmware -// +build firmware - -package main - -import ( - "encoding/json" - "errors" - - "github.com/daos-stack/daos/src/control/logging" - "github.com/daos-stack/daos/src/control/pbin" - "github.com/daos-stack/daos/src/control/server/storage" - "github.com/daos-stack/daos/src/control/server/storage/bdev" - "github.com/daos-stack/daos/src/control/server/storage/scm" -) - -func getNilRequestResp() *pbin.Response { - return pbin.NewResponseWithError(errors.New("nil request")) -} - -// scmHandler provides the ability to set up the scm.Provider for SCM method handlers. -type scmHandler struct { - scmProvider *scm.Provider -} - -func (h *scmHandler) setupProvider(log logging.Logger) { - if h.scmProvider == nil { - h.scmProvider = scm.DefaultProvider(log) - } -} - -// scmQueryHandler handles a request to query the firmware information. -type scmQueryHandler struct { - scmHandler -} - -// Handle queries the SCM firmware information and returns the data in a pbin.Response. -func (h *scmQueryHandler) Handle(log logging.Logger, req *pbin.Request) *pbin.Response { - if req == nil { - return getNilRequestResp() - } - - var qReq storage.ScmFirmwareQueryRequest - if err := json.Unmarshal(req.Payload, &qReq); err != nil { - return pbin.NewResponseWithError(err) - } - - h.setupProvider(log) - - res, err := h.scmProvider.QueryFirmware(qReq) - if err != nil { - return pbin.NewResponseWithError(err) - } - - return pbin.NewResponseWithPayload(res) -} - -// scmUpdateHandler handles a request to update the SCM module firmware from a file. -type scmUpdateHandler struct { - scmHandler -} - -// Handle updates the SCM firmware and returns the result in a pbin.Response. -func (h *scmUpdateHandler) Handle(log logging.Logger, req *pbin.Request) *pbin.Response { - if req == nil { - return getNilRequestResp() - } - - var uReq storage.ScmFirmwareUpdateRequest - if err := json.Unmarshal(req.Payload, &uReq); err != nil { - return pbin.NewResponseWithError(err) - } - - h.setupProvider(log) - - res, err := h.scmProvider.UpdateFirmware(uReq) - if err != nil { - return pbin.NewResponseWithError(err) - } - - return pbin.NewResponseWithPayload(res) -} - -// bdevHandler provides the ability to set up the bdev.Provider for NVMe method handlers. -type bdevHandler struct { - bdevProvider *bdev.Provider -} - -func (h *bdevHandler) setupProvider(log logging.Logger) { - if h.bdevProvider == nil { - h.bdevProvider = bdev.DefaultProvider(log) - } -} - -// nvmeQueryHandler handles a request to query the NVMe device firmware from a file. -type nvmeQueryHandler struct { - bdevHandler -} - -// Handle queries the NVMe device firmware and returns the result as a pbin.Response. -func (h *nvmeQueryHandler) Handle(log logging.Logger, req *pbin.Request) *pbin.Response { - if req == nil { - return getNilRequestResp() - } - - var uReq storage.NVMeFirmwareQueryRequest - if err := json.Unmarshal(req.Payload, &uReq); err != nil { - return pbin.NewResponseWithError(err) - } - - h.setupProvider(log) - - res, _ := h.bdevProvider.QueryFirmware(uReq) - - return pbin.NewResponseWithPayload(res) -} - -// nvmeUpdateHandler handles a request to update the NVMe device firmware from a file. -type nvmeUpdateHandler struct { - bdevHandler -} - -// Handle updates the NVMe device firmware and returns the result as a pbin.Response. -func (h *nvmeUpdateHandler) Handle(log logging.Logger, req *pbin.Request) *pbin.Response { - if req == nil { - return getNilRequestResp() - } - - var uReq storage.NVMeFirmwareUpdateRequest - if err := json.Unmarshal(req.Payload, &uReq); err != nil { - return pbin.NewResponseWithError(err) - } - - h.setupProvider(log) - - res, _ := h.bdevProvider.UpdateFirmware(uReq) - - return pbin.NewResponseWithPayload(res) -} diff --git a/src/control/cmd/daos_firmware_helper/handler_test.go b/src/control/cmd/daos_firmware_helper/handler_test.go deleted file mode 100644 index 1a6829e9291..00000000000 --- a/src/control/cmd/daos_firmware_helper/handler_test.go +++ /dev/null @@ -1,330 +0,0 @@ -// -// (C) Copyright 2020-2022 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -//go:build firmware -// +build firmware - -package main - -import ( - "encoding/json" - "errors" - "testing" - - "github.com/google/go-cmp/cmp" - - "github.com/daos-stack/daos/src/control/common/test" - "github.com/daos-stack/daos/src/control/fault" - "github.com/daos-stack/daos/src/control/logging" - "github.com/daos-stack/daos/src/control/pbin" - "github.com/daos-stack/daos/src/control/server/storage" - "github.com/daos-stack/daos/src/control/server/storage/bdev" - "github.com/daos-stack/daos/src/control/server/storage/scm" -) - -func expectPayload(t *testing.T, resp *pbin.Response, payload interface{}, expPayload interface{}) { - t.Helper() - - err := json.Unmarshal(resp.Payload, payload) - if err != nil { - t.Fatalf("couldn't unmarshal response payload") - } - - cmpOpts := []cmp.Option{ - cmp.Comparer(test.CmpErrBool), - } - if diff := cmp.Diff(expPayload, payload, cmpOpts...); diff != "" { - t.Errorf("got wrong payload (-want, +got)\n%s\n", diff) - } -} - -func TestDaosFirmware_ScmQueryHandler(t *testing.T) { - scmQueryReqPayload, err := json.Marshal(storage.ScmFirmwareQueryRequest{ - ForwardableRequest: pbin.ForwardableRequest{Forwarded: true}, - }) - if err != nil { - t.Fatal(err) - } - - testModules := storage.MockScmModules(2) - - testFWInfo := &storage.ScmFirmwareInfo{ - ActiveVersion: "A100", - StagedVersion: "A113", - ImageMaxSizeBytes: 1024, - UpdateStatus: storage.ScmUpdateStatusFailed, - } - - for name, tc := range map[string]struct { - req *pbin.Request - smbc *scm.MockBackendConfig - expPayload *storage.ScmFirmwareQueryResponse - expErr *fault.Fault - }{ - "nil request": { - expErr: pbin.PrivilegedHelperRequestFailed("nil request"), - }, - "ScmQueryFirmware nil payload": { - req: &pbin.Request{ - Method: storage.ScmFirmwareQueryMethod, - }, - expErr: pbin.PrivilegedHelperRequestFailed("unexpected end of JSON input"), - }, - "ScmQueryFirmware success": { - req: &pbin.Request{ - Method: storage.ScmFirmwareQueryMethod, - Payload: scmQueryReqPayload, - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: testModules, - GetFirmwareStatusRes: testFWInfo, - }, - expPayload: &storage.ScmFirmwareQueryResponse{ - Results: []storage.ScmModuleFirmware{ - { - Module: *testModules[0], - Info: testFWInfo, - }, - { - Module: *testModules[1], - Info: testFWInfo, - }, - }, - }, - }, - "ScmQueryFirmware failure": { - req: &pbin.Request{ - Method: storage.ScmFirmwareQueryMethod, - Payload: scmQueryReqPayload, - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: testModules, - GetFirmwareStatusErr: errors.New("mock failure"), - }, - expPayload: &storage.ScmFirmwareQueryResponse{ - Results: []storage.ScmModuleFirmware{ - { - Module: *testModules[0], - Error: "mock failure", - }, - { - Module: *testModules[1], - Error: "mock failure", - }, - }, - }, - }, - } { - t.Run(name, func(t *testing.T) { - log, buf := logging.NewTestLogger(name) - defer test.ShowBufferOnFailure(t, buf) - - sp := scm.NewMockProvider(log, tc.smbc, nil) - handler := &scmQueryHandler{scmHandler: scmHandler{scmProvider: sp}} - - resp := handler.Handle(log, tc.req) - - if diff := cmp.Diff(tc.expErr, resp.Error); diff != "" { - t.Errorf("got wrong fault (-want, +got)\n%s\n", diff) - } - if tc.expPayload == nil { - tc.expPayload = &storage.ScmFirmwareQueryResponse{} - } - expectPayload(t, resp, &storage.ScmFirmwareQueryResponse{}, tc.expPayload) - }) - } -} - -func TestDaosFirmware_ScmUpdateHandler(t *testing.T) { - scmUpdateReqPayload, err := json.Marshal(storage.ScmFirmwareUpdateRequest{ - ForwardableRequest: pbin.ForwardableRequest{Forwarded: true}, - FirmwarePath: "/some/path", - }) - if err != nil { - t.Fatal(err) - } - - testModules := storage.MockScmModules(3) - - for name, tc := range map[string]struct { - req *pbin.Request - smbc *scm.MockBackendConfig - expPayload *storage.ScmFirmwareUpdateResponse - expErr *fault.Fault - }{ - "nil request": { - expErr: pbin.PrivilegedHelperRequestFailed("nil request"), - }, - "ScmUpdateFirmware nil payload": { - req: &pbin.Request{ - Method: storage.ScmFirmwareUpdateMethod, - }, - expErr: pbin.PrivilegedHelperRequestFailed("unexpected end of JSON input"), - }, - "ScmUpdateFirmware success": { - req: &pbin.Request{ - Method: storage.ScmFirmwareUpdateMethod, - Payload: scmUpdateReqPayload, - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: testModules, - }, - expPayload: &storage.ScmFirmwareUpdateResponse{ - Results: []storage.ScmFirmwareUpdateResult{ - {Module: *testModules[0]}, - {Module: *testModules[1]}, - {Module: *testModules[2]}, - }, - }, - }, - "ScmUpdateFirmware failure": { - req: &pbin.Request{ - Method: storage.ScmFirmwareUpdateMethod, - Payload: scmUpdateReqPayload, - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: testModules, - UpdateFirmwareErr: errors.New("mock failure"), - }, - expPayload: &storage.ScmFirmwareUpdateResponse{ - Results: []storage.ScmFirmwareUpdateResult{ - { - Module: *testModules[0], - Error: "mock failure", - }, - { - Module: *testModules[1], - Error: "mock failure", - }, - { - Module: *testModules[2], - Error: "mock failure", - }, - }, - }, - }, - } { - t.Run(name, func(t *testing.T) { - log, buf := logging.NewTestLogger(name) - defer test.ShowBufferOnFailure(t, buf) - - sp := scm.NewMockProvider(log, tc.smbc, nil) - handler := &scmUpdateHandler{scmHandler: scmHandler{scmProvider: sp}} - - resp := handler.Handle(log, tc.req) - - if diff := cmp.Diff(tc.expErr, resp.Error); diff != "" { - t.Errorf("got wrong fault (-want, +got)\n%s\n", diff) - } - - payload := &storage.ScmFirmwareUpdateResponse{} - err := json.Unmarshal(resp.Payload, payload) - if err != nil { - t.Fatalf("couldn't unmarshal response payload") - } - - if tc.expPayload == nil { - tc.expPayload = &storage.ScmFirmwareUpdateResponse{} - } - if diff := cmp.Diff(tc.expPayload, payload); diff != "" { - t.Fatalf("unexpected response (-want, +got):\n%s\n", diff) - } - }) - } -} - -func TestDaosFirmware_NvmeUpdateHandler(t *testing.T) { - updateReqPayload, err := json.Marshal(storage.NVMeFirmwareUpdateRequest{ - ForwardableRequest: pbin.ForwardableRequest{Forwarded: true}, - FirmwarePath: "/some/path", - }) - if err != nil { - t.Fatal(err) - } - - testDevices := storage.MockNvmeControllers(2) - - for name, tc := range map[string]struct { - req *pbin.Request - nmbc *bdev.MockBackendConfig - expPayload *storage.NVMeFirmwareUpdateResponse - expErr *fault.Fault - }{ - "nil request": { - expErr: pbin.PrivilegedHelperRequestFailed("nil request"), - }, - "NvmeFirmwareUpdate nil payload": { - req: &pbin.Request{ - Method: storage.NVMeFirmwareUpdateMethod, - }, - expErr: pbin.PrivilegedHelperRequestFailed("unexpected end of JSON input"), - }, - "NvmeFirmwareUpdate success": { - req: &pbin.Request{ - Method: storage.NVMeFirmwareUpdateMethod, - Payload: updateReqPayload, - }, - nmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: testDevices}, - }, - expPayload: &storage.NVMeFirmwareUpdateResponse{ - Results: []storage.NVMeDeviceFirmwareUpdateResult{ - {Device: *testDevices[0]}, - {Device: *testDevices[1]}, - }, - }, - }, - "NvmeFirmwareUpdate failure": { - req: &pbin.Request{ - Method: storage.NVMeFirmwareUpdateMethod, - Payload: updateReqPayload, - }, - nmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: testDevices}, - UpdateErr: errors.New("mock failure"), - }, - expPayload: &storage.NVMeFirmwareUpdateResponse{ - Results: []storage.NVMeDeviceFirmwareUpdateResult{ - { - Device: *testDevices[0], - Error: "mock failure", - }, - { - Device: *testDevices[1], - Error: "mock failure", - }, - }, - }, - }, - } { - t.Run(name, func(t *testing.T) { - log, buf := logging.NewTestLogger(name) - defer test.ShowBufferOnFailure(t, buf) - - bp := bdev.NewMockProvider(log, tc.nmbc) - handler := &nvmeUpdateHandler{bdevHandler: bdevHandler{bdevProvider: bp}} - - resp := handler.Handle(log, tc.req) - - if diff := cmp.Diff(tc.expErr, resp.Error); diff != "" { - t.Errorf("got wrong fault (-want, +got)\n%s\n", diff) - } - - payload := &storage.NVMeFirmwareUpdateResponse{} - err := json.Unmarshal(resp.Payload, payload) - if err != nil { - t.Fatalf("couldn't unmarshal response payload") - } - - if tc.expPayload == nil { - tc.expPayload = &storage.NVMeFirmwareUpdateResponse{} - } - if diff := cmp.Diff(tc.expPayload, payload); diff != "" { - t.Fatalf("unexpected response (-want, +got):\n%s\n", diff) - } - }) - } -} diff --git a/src/control/cmd/daos_firmware_helper/main.go b/src/control/cmd/daos_firmware_helper/main.go deleted file mode 100644 index d93249b2a8c..00000000000 --- a/src/control/cmd/daos_firmware_helper/main.go +++ /dev/null @@ -1,35 +0,0 @@ -// -// (C) Copyright 2020-2022 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -//go:build firmware -// +build firmware - -package main - -import ( - "os" - - "github.com/daos-stack/daos/src/control/pbin" - "github.com/daos-stack/daos/src/control/server/storage" -) - -func main() { - app := pbin.NewApp().WithAllowedCallers("daos_server") - - if logPath, set := os.LookupEnv(pbin.DaosFWLogFileEnvVar); set { - app = app.WithLogFile(logPath) - } - - app.AddHandler(storage.ScmFirmwareQueryMethod, &scmQueryHandler{}) - app.AddHandler(storage.ScmFirmwareUpdateMethod, &scmUpdateHandler{}) - app.AddHandler(storage.NVMeFirmwareQueryMethod, &nvmeQueryHandler{}) - app.AddHandler(storage.NVMeFirmwareUpdateMethod, &nvmeUpdateHandler{}) - - err := app.Run() - if err != nil { - os.Exit(1) - } -} diff --git a/src/control/cmd/dmg/README.md b/src/control/cmd/dmg/README.md index 89767883ed2..c1264e57c8c 100644 --- a/src/control/cmd/dmg/README.md +++ b/src/control/cmd/dmg/README.md @@ -73,14 +73,6 @@ Implementation in `auto.go`. Provides capability to change the owner of a DAOS container. Implementation in `cont.go`. -### Firmware - -Firmware related capabilities are selectively compiled and may not -be present in all builds. Provided capability to query and update -firmware on NVMe and PMem devices. -Implementation with firmware enabled in `firmware.go`. When -disabled: `firmware_disabled.go`. - ### Network Provides capability to manage and enumerate available network diff --git a/src/control/cmd/dmg/firmware.go b/src/control/cmd/dmg/firmware.go deleted file mode 100644 index 4154a980b8d..00000000000 --- a/src/control/cmd/dmg/firmware.go +++ /dev/null @@ -1,195 +0,0 @@ -// -// (C) Copyright 2020-2022 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -package main - -import ( - "io" - "strings" - - "github.com/daos-stack/daos/src/control/cmd/dmg/pretty" - "github.com/daos-stack/daos/src/control/common/cmdutil" - "github.com/daos-stack/daos/src/control/lib/control" -) - -// firmwareOption defines a DMG option that enables firmware management in DAOS. -type firmwareOption struct { - Firmware firmwareCmd `command:"firmware" hidden:"true" description:"Manage the storage device firmware"` -} - -// firmwareCmd defines the firmware management subcommands. -type firmwareCmd struct { - Query firmwareQueryCmd `command:"query" description:"Query device firmware versions and status on DAOS storage nodes"` - Update firmwareUpdateCmd `command:"update" description:"Update the device firmware on DAOS storage nodes"` -} - -// firmwareQueryCmd is used to query the storage device firmware on a set of DAOS hosts. -type firmwareQueryCmd struct { - baseCmd - ctlInvokerCmd - hostListCmd - cmdutil.JSONOutputCmd - DeviceType string `short:"t" long:"type" choice:"nvme" choice:"scm" choice:"all" default:"all" description:"Type of storage devices to query"` - Devices string `short:"d" long:"devices" description:"Comma-separated list of device identifiers to query"` - ModelID string `short:"m" long:"model" description:"Model ID to filter results by"` - FirmwareRev string `short:"f" long:"fwrev" description:"Firmware revision to filter results by"` - Verbose bool `short:"v" long:"verbose" description:"Display verbose output"` -} - -// Execute runs the firmware query command. -func (cmd *firmwareQueryCmd) Execute(args []string) error { - ctx := cmd.MustLogCtx() - - req := &control.FirmwareQueryReq{ - SCM: cmd.isSCMRequested(), - NVMe: cmd.isNVMeRequested(), - ModelID: cmd.ModelID, - FirmwareRev: cmd.FirmwareRev, - } - - if cmd.Devices != "" { - req.Devices = strings.Split(cmd.Devices, ",") - } - - req.SetHostList(cmd.getHostList()) - resp, err := control.FirmwareQuery(ctx, cmd.ctlInvoker, req) - - if cmd.JSONOutputEnabled() { - return cmd.OutputJSON(resp, err) - } - - if err != nil { - return err - } - - var bld strings.Builder - if err := pretty.PrintResponseErrors(resp, &bld); err != nil { - return err - } - - printSCMFirmware, printNVMeFirmware := cmd.getDisplayFunctions() - if cmd.isSCMRequested() { - if err := printSCMFirmware(resp.HostSCMFirmware, &bld); err != nil { - return err - } - } - if cmd.isNVMeRequested() { - if err := printNVMeFirmware(resp.HostNVMeFirmware, &bld); err != nil { - return err - } - } - cmd.Info(bld.String()) - - return resp.Errors() -} - -func (cmd *firmwareQueryCmd) isSCMRequested() bool { - return cmd.DeviceType == "scm" || cmd.DeviceType == "all" -} - -func (cmd *firmwareQueryCmd) isNVMeRequested() bool { - return cmd.DeviceType == "nvme" || cmd.DeviceType == "all" -} - -type ( - hostSCMQueryMapPrinter func(control.HostSCMQueryMap, io.Writer, ...pretty.PrintConfigOption) error - hostNVMeQueryMapPrinter func(control.HostNVMeQueryMap, io.Writer, ...pretty.PrintConfigOption) error -) - -func (cmd *firmwareQueryCmd) getDisplayFunctions() (hostSCMQueryMapPrinter, hostNVMeQueryMapPrinter) { - printSCM := pretty.PrintSCMFirmwareQueryMap - printNVMe := pretty.PrintNVMeFirmwareQueryMap - if cmd.Verbose { - printSCM = pretty.PrintSCMFirmwareQueryMapVerbose - printNVMe = pretty.PrintNVMeFirmwareQueryMapVerbose - } - - return printSCM, printNVMe -} - -// firmwareUpdateCmd updates the firmware on storage devices on a set of DAOS hosts. -type firmwareUpdateCmd struct { - baseCmd - ctlInvokerCmd - hostListCmd - cmdutil.JSONOutputCmd - DeviceType string `short:"t" long:"type" choice:"nvme" choice:"scm" required:"1" description:"Type of storage devices to update"` - FilePath string `short:"p" long:"path" required:"1" description:"Path to the firmware file accessible from all nodes"` - Devices string `short:"d" long:"devices" description:"Comma-separated list of device identifiers to update"` - ModelID string `short:"m" long:"model" description:"Limit update to a model ID"` - FirmwareRev string `short:"f" long:"fwrev" description:"Limit update to a current firmware revision"` - Verbose bool `short:"v" long:"verbose" description:"Display verbose output"` -} - -// Execute runs the firmware update command. -func (cmd *firmwareUpdateCmd) Execute(args []string) error { - ctx := cmd.MustLogCtx() - - req := &control.FirmwareUpdateReq{ - FirmwarePath: cmd.FilePath, - ModelID: cmd.ModelID, - FirmwareRev: cmd.FirmwareRev, - } - - if cmd.isSCMUpdate() { - req.Type = control.DeviceTypeSCM - } else { - req.Type = control.DeviceTypeNVMe - } - - if cmd.Devices != "" { - req.Devices = strings.Split(cmd.Devices, ",") - } - - req.SetHostList(cmd.getHostList()) - resp, err := control.FirmwareUpdate(ctx, cmd.ctlInvoker, req) - - if cmd.JSONOutputEnabled() { - return cmd.OutputJSON(resp, err) - } - - if err != nil { - return err - } - - var bld strings.Builder - if err := pretty.PrintResponseErrors(resp, &bld); err != nil { - return err - } - - if err := cmd.printUpdateResult(resp, &bld); err != nil { - return err - } - - cmd.Info(bld.String()) - - return resp.Errors() -} - -func (cmd *firmwareUpdateCmd) isSCMUpdate() bool { - return cmd.DeviceType == "scm" -} - -func (cmd *firmwareUpdateCmd) printUpdateResult(resp *control.FirmwareUpdateResp, out io.Writer) error { - if cmd.isSCMUpdate() { - return cmd.printSCMUpdateResult(resp, out) - } - return cmd.printNVMeUpdateResult(resp, out) -} - -func (cmd *firmwareUpdateCmd) printSCMUpdateResult(resp *control.FirmwareUpdateResp, out io.Writer) error { - if cmd.Verbose { - return pretty.PrintSCMFirmwareUpdateMapVerbose(resp.HostSCMResult, out) - } - return pretty.PrintSCMFirmwareUpdateMap(resp.HostSCMResult, out) -} - -func (cmd *firmwareUpdateCmd) printNVMeUpdateResult(resp *control.FirmwareUpdateResp, out io.Writer) error { - if cmd.Verbose { - return pretty.PrintNVMeFirmwareUpdateMapVerbose(resp.HostNVMeResult, out) - } - return pretty.PrintNVMeFirmwareUpdateMap(resp.HostNVMeResult, out) -} diff --git a/src/control/cmd/dmg/firmware_test.go b/src/control/cmd/dmg/firmware_test.go deleted file mode 100644 index 601d6b6b78b..00000000000 --- a/src/control/cmd/dmg/firmware_test.go +++ /dev/null @@ -1,203 +0,0 @@ -// -// (C) Copyright 2020-2021 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -package main - -import ( - "strings" - "testing" - - "github.com/pkg/errors" - - "github.com/daos-stack/daos/src/control/lib/control" -) - -func TestFirmwareCommands(t *testing.T) { - runCmdTests(t, []cmdTest{ - { - "Query with no args defaults to all", - "firmware query", - strings.Join([]string{ - printRequest(t, &control.FirmwareQueryReq{ - SCM: true, - NVMe: true, - }), - }, " "), - nil, - }, - { - "Query with verbose", - "firmware query --verbose", - strings.Join([]string{ - printRequest(t, &control.FirmwareQueryReq{ - SCM: true, - NVMe: true, - }), - }, " "), - nil, - }, - { - "Query with SCM", - "firmware query --type=scm", - strings.Join([]string{ - printRequest(t, &control.FirmwareQueryReq{ - SCM: true, - }), - }, " "), - nil, - }, - { - "Query with NVMe", - "firmware query --type=nvme", - strings.Join([]string{ - printRequest(t, &control.FirmwareQueryReq{ - NVMe: true, - }), - }, " "), - nil, - }, - { - "Query with all", - "firmware query --type=all", - strings.Join([]string{ - printRequest(t, &control.FirmwareQueryReq{ - SCM: true, - NVMe: true, - }), - }, " "), - nil, - }, - { - "Query with model ID", - "firmware query --model=Model1", - strings.Join([]string{ - printRequest(t, &control.FirmwareQueryReq{ - SCM: true, - NVMe: true, - ModelID: "Model1", - }), - }, " "), - nil, - }, - { - "Query with FW rev", - "firmware query --fwrev=FW100", - strings.Join([]string{ - printRequest(t, &control.FirmwareQueryReq{ - SCM: true, - NVMe: true, - FirmwareRev: "FW100", - }), - }, " "), - nil, - }, - { - "Query with device list", - "firmware query --devices=D1,D2,D3", - strings.Join([]string{ - printRequest(t, &control.FirmwareQueryReq{ - SCM: true, - NVMe: true, - Devices: []string{"D1", "D2", "D3"}, - }), - }, " "), - nil, - }, - { - "Query with invalid type", - "firmware query --type=none", - "", - errors.New("Invalid value `none' for option `-t, --type'. Allowed values are: nvme, scm or all"), - }, - { - "Update with no path", - "firmware update --type=scm", - "", - errors.New("the required flag `-p, --path' was not specified"), - }, - { - "Update with no type", - "firmware update --path=/does_not/matter", - "", - errors.New("the required flag `-t, --type' was not specified"), - }, - { - "Update with invalid type", - "firmware update --type=all --path=/does_not/matter", - "", - errors.New("Invalid value `all' for option `-t, --type'. Allowed values are: nvme or scm"), - }, - { - "Update with SCM", - "firmware update --type=scm --path=/dont/care", - strings.Join([]string{ - printRequest(t, &control.FirmwareUpdateReq{ - FirmwarePath: "/dont/care", - Type: control.DeviceTypeSCM, - }), - }, " "), - nil, - }, - { - "Update with verbose option", - "firmware update --type=scm --path=/dont/care --verbose", - strings.Join([]string{ - printRequest(t, &control.FirmwareUpdateReq{ - FirmwarePath: "/dont/care", - Type: control.DeviceTypeSCM, - }), - }, " "), - nil, - }, - { - "Update with NVMe", - "firmware update --type=nvme --path=/dont/care", - strings.Join([]string{ - printRequest(t, &control.FirmwareUpdateReq{ - FirmwarePath: "/dont/care", - Type: control.DeviceTypeNVMe, - }), - }, " "), - nil, - }, - { - "Update with model ID", - "firmware update --type=scm --path=/dont/care --model=Model1", - strings.Join([]string{ - printRequest(t, &control.FirmwareUpdateReq{ - FirmwarePath: "/dont/care", - Type: control.DeviceTypeSCM, - ModelID: "Model1", - }), - }, " "), - nil, - }, - { - "Update with FW rev", - "firmware update --type=scm --path=/dont/care --fwrev=FW100", - strings.Join([]string{ - printRequest(t, &control.FirmwareUpdateReq{ - FirmwarePath: "/dont/care", - Type: control.DeviceTypeSCM, - FirmwareRev: "FW100", - }), - }, " "), - nil, - }, - { - "Update with device list", - "firmware update --type=scm --path=/dont/care --devices=D1,D2,D3", - strings.Join([]string{ - printRequest(t, &control.FirmwareUpdateReq{ - FirmwarePath: "/dont/care", - Type: control.DeviceTypeSCM, - Devices: []string{"D1", "D2", "D3"}, - }), - }, " "), - nil, - }, - }) -} diff --git a/src/control/cmd/dmg/main.go b/src/control/cmd/dmg/main.go index c88845a304c..bea47a667e7 100644 --- a/src/control/cmd/dmg/main.go +++ b/src/control/cmd/dmg/main.go @@ -1,5 +1,6 @@ // // (C) Copyright 2018-2024 Intel Corporation. +// (C) Copyright 2026 Hewlett Packard Enterprise Development LP // // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -92,29 +93,28 @@ func (cmd *cfgCmd) setConfig(cfg *control.Config) { } type cliOptions struct { - AllowProxy bool `long:"allow-proxy" description:"Allow proxy configuration via environment"` - HostList ui.HostSetFlag `short:"l" long:"host-list" hidden:"true" description:"DEPRECATED: A comma separated list of addresses to connect to"` - Insecure bool `short:"i" long:"insecure" description:"Have dmg attempt to connect without certificates"` - Debug bool `short:"d" long:"debug" description:"Enable debug output"` - LogFile string `long:"log-file" description:"Log command output to the specified file"` - JSON bool `short:"j" long:"json" description:"Enable JSON output"` - JSONLogs bool `short:"J" long:"json-logging" description:"Enable JSON-formatted log output"` - ConfigPath string `short:"o" long:"config-path" description:"Client config file path"` - Server serverCmd `command:"server" alias:"srv" description:"Perform tasks related to remote servers"` - Storage storageCmd `command:"storage" alias:"sto" description:"Perform tasks related to storage attached to remote servers"` - Config configCmd `command:"config" alias:"cfg" description:"Perform tasks related to configuration of hardware on remote servers"` - System SystemCmd `command:"system" alias:"sys" description:"Perform distributed tasks related to DAOS system"` - Network NetCmd `command:"network" alias:"net" description:"Perform tasks related to network devices attached to remote servers"` - Support supportCmd `command:"support" alias:"supp" description:"Perform debug tasks to help support team"` - Pool PoolCmd `command:"pool" description:"Perform tasks related to DAOS pools"` - Cont ContCmd `command:"container" alias:"cont" description:"Perform tasks related to DAOS containers"` - Version versionCmd `command:"version" description:"Print dmg version"` - ServerVersion serverVersionCmd `command:"server-version" description:"Print server version"` - Telemetry telemCmd `command:"telemetry" alias:"telem" description:"Perform telemetry operations"` - Check checkCmdRoot `command:"check" description:"Check system health"` - ManPage cmdutil.ManCmd `command:"manpage" hidden:"true"` - faultsCmdRoot // compiled out for release builds - firmwareOption // build with tag "firmware" to enable + AllowProxy bool `long:"allow-proxy" description:"Allow proxy configuration via environment"` + HostList ui.HostSetFlag `short:"l" long:"host-list" hidden:"true" description:"DEPRECATED: A comma separated list of addresses to connect to"` + Insecure bool `short:"i" long:"insecure" description:"Have dmg attempt to connect without certificates"` + Debug bool `short:"d" long:"debug" description:"Enable debug output"` + LogFile string `long:"log-file" description:"Log command output to the specified file"` + JSON bool `short:"j" long:"json" description:"Enable JSON output"` + JSONLogs bool `short:"J" long:"json-logging" description:"Enable JSON-formatted log output"` + ConfigPath string `short:"o" long:"config-path" description:"Client config file path"` + Server serverCmd `command:"server" alias:"srv" description:"Perform tasks related to remote servers"` + Storage storageCmd `command:"storage" alias:"sto" description:"Perform tasks related to storage attached to remote servers"` + Config configCmd `command:"config" alias:"cfg" description:"Perform tasks related to configuration of hardware on remote servers"` + System SystemCmd `command:"system" alias:"sys" description:"Perform distributed tasks related to DAOS system"` + Network NetCmd `command:"network" alias:"net" description:"Perform tasks related to network devices attached to remote servers"` + Support supportCmd `command:"support" alias:"supp" description:"Perform debug tasks to help support team"` + Pool PoolCmd `command:"pool" description:"Perform tasks related to DAOS pools"` + Cont ContCmd `command:"container" alias:"cont" description:"Perform tasks related to DAOS containers"` + Version versionCmd `command:"version" description:"Print dmg version"` + ServerVersion serverVersionCmd `command:"server-version" description:"Print server version"` + Telemetry telemCmd `command:"telemetry" alias:"telem" description:"Perform telemetry operations"` + Check checkCmdRoot `command:"check" description:"Check system health"` + ManPage cmdutil.ManCmd `command:"manpage" hidden:"true"` + faultsCmdRoot // compiled out for release builds } type versionCmd struct { diff --git a/src/control/cmd/dmg/pretty/firmware.go b/src/control/cmd/dmg/pretty/firmware.go deleted file mode 100644 index a38c50d825d..00000000000 --- a/src/control/cmd/dmg/pretty/firmware.go +++ /dev/null @@ -1,571 +0,0 @@ -// -// (C) Copyright 2020-2021 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -package pretty - -import ( - "errors" - "fmt" - "io" - "sort" - "strings" - - "github.com/dustin/go-humanize" - "github.com/dustin/go-humanize/english" - - "github.com/daos-stack/daos/src/control/lib/control" - "github.com/daos-stack/daos/src/control/lib/hostlist" - "github.com/daos-stack/daos/src/control/lib/txtfmt" - "github.com/daos-stack/daos/src/control/server/storage" -) - -const ( - scmUpdateSuccess = "Success - The new firmware was staged. A power cycle is required to apply." - scmNotFound = "No SCM devices detected" - scmDevTitle = "Device:PhyID:Socket:Ctrl:Chan:Pos" - scmSectionHeader = "SCM Device Firmware" - - nvmeUpdateSuccess = "Success - The NVMe device controller firmware was updated." - nvmeNotFound = "No NVMe device controllers detected" - nvmeDevTitle = "Device Addr" - nvmeSectionHeader = "NVMe Device Firmware" -) - -func printScmModule(module *storage.ScmModule, out io.Writer, opts ...PrintConfigOption) error { - _, err := fmt.Fprintf(out, "%s\n", module.String()) - return err -} - -// hostDeviceSet represents a collection of hosts and devices on those hosts. -type hostDeviceSet struct { - Hosts *hostlist.HostSet - Devices []string -} - -// AddHost adds a host to the set. -func (h *hostDeviceSet) AddHost(host string) error { - _, err := h.Hosts.Insert(host) - return err -} - -// AddDevice adds a device to the set. -func (h *hostDeviceSet) AddDevice(device string) { - h.Devices = append(h.Devices, device) -} - -// newHostDeviceSet creates and initializes an empty hostDeviceSet. -func newHostDeviceSet() (*hostDeviceSet, error) { - hosts, err := hostlist.CreateSet("") - if err != nil { - return nil, err - } - return &hostDeviceSet{ - Hosts: hosts, - }, nil -} - -// hostDeviceResultMap is a map from a result string to a hostDeviceSet. -type hostDeviceResultMap map[string]*hostDeviceSet - -// AddHostDevice adds a host and a device to the map set for a given result string. -func (m hostDeviceResultMap) AddHostDevice(resultStr string, host string, device string) error { - err := m.AddHost(resultStr, host) - if err != nil { - return err - } - m[resultStr].AddDevice(device) - return nil -} - -// AddHost adds a host to the map set for a given result string. -func (m hostDeviceResultMap) AddHost(resultStr string, host string) error { - if _, ok := m[resultStr]; !ok { - newSet, err := newHostDeviceSet() - if err != nil { - return err - } - m[resultStr] = newSet - } - - return m[resultStr].AddHost(host) -} - -// Keys returns the sorted keys of the map. -func (m hostDeviceResultMap) Keys() []string { - keys := make([]string, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - return keys -} - -// hostDeviceError is an error associated with a specific host and device ID -type hostDeviceError struct { - Host string - Error error - DevID string -} - -// PrintSCMFirmwareQueryMap formats the firmware query results in a condensed format. -func PrintSCMFirmwareQueryMap(fwMap control.HostSCMQueryMap, out io.Writer, - opts ...PrintConfigOption) error { - if fwMap == nil { - return nil - } - - successes, errs, err := condenseSCMQueryMap(fwMap) - if err != nil { - return err - } - - printDeviceTypeHeader(out, scmSectionHeader) - - iw := txtfmt.NewIndentWriter(out) - if err = printDeviceErrorTable(errs, scmDevTitle, iw, opts...); err != nil { - return err - } - - return printCondensedResults(successes, iw, opts, - func(result string, set *hostDeviceSet, _ []PrintConfigOption, w io.Writer) { - fmt.Fprintf(w, "Firmware status for %s:\n", english.Plural(len(set.Devices), "device", "devices")) - - iw := txtfmt.NewIndentWriter(w) - fmt.Fprintln(iw, result) - }) -} - -func condenseSCMQueryMap(fwMap control.HostSCMQueryMap) (hostDeviceResultMap, []hostDeviceError, error) { - successes := make(hostDeviceResultMap) - errors := make([]hostDeviceError, 0) - for _, host := range fwMap.Keys() { - results := fwMap[host] - if len(results) == 0 { - err := successes.AddHost(scmNotFound, host) - if err != nil { - return nil, nil, err - } - continue - } - - for _, devRes := range results { - devID := getShortSCMString(devRes.Module) - if devRes.Error == nil { - err := successes.AddHostDevice(getSCMFirmwareInfoString(devRes.Info), - host, devID) - if err != nil { - return nil, nil, err - } - continue - } - - errors = append(errors, hostDeviceError{ - Host: host, - DevID: devID, - Error: devRes.Error, - }) - } - } - return successes, errors, nil -} - -func getSCMFirmwareInfoString(info *storage.ScmFirmwareInfo) string { - if info == nil { - return getErrorString(errors.New("No information available")) - } - - var b strings.Builder - fmt.Fprintf(&b, "Active Version: %s\n", getPrintVersion(info.ActiveVersion)) - fmt.Fprintf(&b, "Staged Version: %s\n", getPrintVersion(info.StagedVersion)) - fmt.Fprintf(&b, "Maximum Firmware Image Size: %s\n", humanize.IBytes(uint64(info.ImageMaxSizeBytes))) - fmt.Fprintf(&b, "Last Update Status: %s", info.UpdateStatus) - return b.String() -} - -func printDeviceTypeHeader(out io.Writer, header string) { - lineBreak := strings.Repeat("=", len(header)) - fmt.Fprintf(out, "%s\n%s\n%s\n", lineBreak, header, lineBreak) -} - -func getErrorString(err error) string { - return fmt.Sprintf("Error: %s", err.Error()) -} - -func getPrintVersion(version string) string { - if version == "" { - return "N/A" - } - return version -} - -func printCondensedResults(condensed hostDeviceResultMap, out io.Writer, opts []PrintConfigOption, - printResult func(string, *hostDeviceSet, []PrintConfigOption, io.Writer)) error { - w := txtfmt.NewErrWriter(out) - for _, result := range condensed.Keys() { - set, ok := condensed[result] - if !ok { - continue - } - hosts := getPrintHosts(set.Hosts.RangedString(), opts...) - printHostHeader(hosts, out) - - iw := txtfmt.NewIndentWriter(out) - - if len(set.Devices) == 0 { - fmt.Fprintln(iw, result) - continue - } - - printResult(result, set, opts, iw) - } - - return w.Err -} - -func printHostHeader(hosts string, out io.Writer) { - lineBreak := strings.Repeat("-", len(hosts)) - fmt.Fprintf(out, "%s\n%s\n%s\n", lineBreak, hosts, lineBreak) -} - -func printDeviceErrorTable(errorResults []hostDeviceError, devTitle string, out io.Writer, opts ...PrintConfigOption) error { - if len(errorResults) == 0 { - return nil - } - - w := txtfmt.NewErrWriter(out) - - hostTitle := "Host" - errTitle := "Error" - formatter := txtfmt.NewTableFormatter(hostTitle, devTitle, errTitle) - var table []txtfmt.TableRow - for _, result := range errorResults { - row := txtfmt.TableRow{ - hostTitle: result.Host, - errTitle: result.Error.Error(), - devTitle: result.DevID, - } - - table = append(table, row) - } - - fmt.Fprintln(out, "Errors:") - - iw := txtfmt.NewIndentWriter(out) - fmt.Fprint(iw, formatter.Format(table)) - - return w.Err -} - -func getShortSCMString(module storage.ScmModule) string { - return fmt.Sprintf("%s:%d:%d:%d:%d:%d", module.UID, module.PhysicalID, module.SocketID, - module.ControllerID, module.ChannelID, module.ChannelPosition) -} - -// PrintSCMFirmwareQueryMapVerbose formats the firmware query results in a detailed format. -func PrintSCMFirmwareQueryMapVerbose(fwMap control.HostSCMQueryMap, out io.Writer, - opts ...PrintConfigOption) error { - if fwMap == nil { - return nil - } - - w := txtfmt.NewErrWriter(out) - - printDeviceTypeHeader(w, scmSectionHeader) - - iw := txtfmt.NewIndentWriter(w) - if err := printSCMFirmwareQueryMapByHost(fwMap, iw); err != nil { - return err - } - - return w.Err -} - -func printSCMFirmwareQueryMapByHost(fwMap control.HostSCMQueryMap, out io.Writer) error { - for _, host := range fwMap.Keys() { - printHostHeader(host, out) - - iw := txtfmt.NewIndentWriter(out) - fwResults := fwMap[host] - if len(fwResults) == 0 { - fmt.Fprintln(iw, scmNotFound) - continue - } - - for _, res := range fwResults { - if err := printScmModule(&res.Module, iw); err != nil { - return err - } - - iw2 := txtfmt.NewIndentWriter(iw) - - if res.Error != nil { - fmt.Fprintf(iw2, "%s\n", getErrorString(res.Error)) - continue - } - - fmt.Fprintf(iw2, "%s\n", getSCMFirmwareInfoString(res.Info)) - } - } - return nil -} - -// PrintSCMFirmwareUpdateMap prints the update results in a condensed format. -func PrintSCMFirmwareUpdateMap(fwMap control.HostSCMUpdateMap, out io.Writer, - opts ...PrintConfigOption) error { - successes, errs, err := condenseSCMUpdateMap(fwMap) - if err != nil { - return err - } - - if err = printDeviceErrorTable(errs, scmDevTitle, out, opts...); err != nil { - return err - } - - return printCondensedResults(successes, out, opts, - func(result string, set *hostDeviceSet, _ []PrintConfigOption, w io.Writer) { - fmt.Fprintf(w, "Firmware staged on %s. A power cycle is required to apply the update.\n", - english.Plural(len(set.Devices), "device", "devices")) - }) -} - -func condenseSCMUpdateMap(fwMap control.HostSCMUpdateMap) (hostDeviceResultMap, []hostDeviceError, error) { - successes := make(hostDeviceResultMap) - errors := make([]hostDeviceError, 0) - for _, host := range fwMap.Keys() { - results := fwMap[host] - if len(results) == 0 { - err := successes.AddHost(scmNotFound, host) - if err != nil { - return nil, nil, err - } - continue - } - - for _, devRes := range results { - devID := getShortSCMString(devRes.Module) - if devRes.Error == nil { - err := successes.AddHostDevice(scmUpdateSuccess, host, devID) - if err != nil { - return nil, nil, err - } - continue - } - errors = append(errors, hostDeviceError{ - Host: host, - DevID: devID, - Error: devRes.Error, - }) - } - } - return successes, errors, nil -} - -// PrintSCMFirmwareUpdateMapVerbose formats the firmware update results in a -// detailed format. -func PrintSCMFirmwareUpdateMapVerbose(fwMap control.HostSCMUpdateMap, out io.Writer, - opts ...PrintConfigOption) error { - w := txtfmt.NewErrWriter(out) - - for _, host := range fwMap.Keys() { - printHostHeader(host, out) - - iw := txtfmt.NewIndentWriter(out) - fwResults := fwMap[host] - if len(fwResults) == 0 { - fmt.Fprintln(iw, scmNotFound) - continue - } - - for _, res := range fwResults { - if err := printScmModule(&res.Module, iw); err != nil { - return err - } - - iw2 := txtfmt.NewIndentWriter(iw) - - if res.Error != nil { - fmt.Fprintf(iw2, "%s\n", getErrorString(res.Error)) - continue - } - - fmt.Fprintf(iw2, "%s\n", scmUpdateSuccess) - } - } - - return w.Err -} - -// PrintNVMeFirmwareQueryMap formats the NVMe device firmware query results in a -// concise format. -func PrintNVMeFirmwareQueryMap(fwMap control.HostNVMeQueryMap, out io.Writer, - opts ...PrintConfigOption) error { - if fwMap == nil { - return nil - } - - successes, errs, err := condenseNVMeQueryMap(fwMap) - if err != nil { - return err - } - - printDeviceTypeHeader(out, nvmeSectionHeader) - - iw := txtfmt.NewIndentWriter(out) - if err = printDeviceErrorTable(errs, nvmeDevTitle, iw, opts...); err != nil { - return err - } - - return printCondensedResults(successes, iw, opts, - func(result string, set *hostDeviceSet, _ []PrintConfigOption, w io.Writer) { - fmt.Fprintf(w, "Firmware status for %s:\n", english.Plural(len(set.Devices), "device", "devices")) - - iw := txtfmt.NewIndentWriter(w) - fmt.Fprintf(iw, "%s\n", result) - }) -} - -func condenseNVMeQueryMap(fwMap control.HostNVMeQueryMap) (hostDeviceResultMap, []hostDeviceError, error) { - successes := make(hostDeviceResultMap) - errors := make([]hostDeviceError, 0) - for _, host := range fwMap.Keys() { - results := fwMap[host] - if len(results) == 0 { - if err := successes.AddHost(nvmeNotFound, host); err != nil { - return nil, nil, err - } - continue - } - - for _, devRes := range results { - if err := successes.AddHostDevice(getNVMeFirmwareQueryStr(devRes), host, devRes.Device.PciAddr); err != nil { - return nil, nil, err - } - } - } - return successes, errors, nil -} - -func getNVMeFirmwareQueryStr(result *control.NVMeQueryResult) string { - return fmt.Sprintf("Revision: %s", result.Device.FwRev) -} - -// PrintNVMeFirmwareQueryMapVerbose formats the NVMe device firmware query -// results in a verbose format. -func PrintNVMeFirmwareQueryMapVerbose(fwMap control.HostNVMeQueryMap, out io.Writer, - opts ...PrintConfigOption) error { - if fwMap == nil { - return nil - } - - w := txtfmt.NewErrWriter(out) - - printDeviceTypeHeader(w, nvmeSectionHeader) - - iw := txtfmt.NewIndentWriter(w) - printNVMeFirmwareQueryMapByHost(fwMap, iw) - return w.Err -} - -func printNVMeFirmwareQueryMapByHost(fwMap control.HostNVMeQueryMap, w io.Writer) { - for _, host := range fwMap.Keys() { - printHostHeader(host, w) - - iw := txtfmt.NewIndentWriter(w) - fwResults := fwMap[host] - if len(fwResults) == 0 { - fmt.Fprintln(iw, nvmeNotFound) - continue - } - - for _, res := range fwResults { - fmt.Fprintf(iw, "Device PCI Address: %s\n", res.Device.PciAddr) - - iw2 := txtfmt.NewIndentWriter(iw) - fmt.Fprintf(iw2, "%s\n", getNVMeFirmwareQueryStr(res)) - } - } -} - -// PrintNVMeFirmwareUpdateMap formats the NVMe device firmware update results in -// a concise format. -func PrintNVMeFirmwareUpdateMap(fwMap control.HostNVMeUpdateMap, out io.Writer, - opts ...PrintConfigOption) error { - successes, errs, err := condenseNVMeUpdateMap(fwMap) - if err != nil { - return err - } - - if err = printDeviceErrorTable(errs, nvmeDevTitle, out, opts...); err != nil { - return err - } - - return printCondensedResults(successes, out, opts, - func(result string, set *hostDeviceSet, _ []PrintConfigOption, w io.Writer) { - fmt.Fprintf(w, "Firmware updated on %s.\n", - english.Plural(len(set.Devices), "NVMe device controller", "NVMe device controllers")) - }) -} - -func condenseNVMeUpdateMap(fwMap control.HostNVMeUpdateMap) (hostDeviceResultMap, []hostDeviceError, error) { - successes := make(hostDeviceResultMap) - errors := make([]hostDeviceError, 0) - for _, host := range fwMap.Keys() { - results := fwMap[host] - if len(results) == 0 { - if err := successes.AddHost(nvmeNotFound, host); err != nil { - return nil, nil, err - } - continue - } - - for _, devRes := range results { - if devRes.Error == nil { - err := successes.AddHostDevice(nvmeUpdateSuccess, host, devRes.DevicePCIAddr) - if err != nil { - return nil, nil, err - } - } else { - errors = append(errors, hostDeviceError{ - Host: host, - DevID: devRes.DevicePCIAddr, - Error: devRes.Error, - }) - } - - } - } - return successes, errors, nil -} - -// PrintNVMeFirmwareUpdateMapVerbose prints a verbose listing of firmware update results. -func PrintNVMeFirmwareUpdateMapVerbose(fwMap control.HostNVMeUpdateMap, out io.Writer, opts ...PrintConfigOption) error { - w := txtfmt.NewErrWriter(out) - - for _, host := range fwMap.Keys() { - printHostHeader(host, w) - - iw := txtfmt.NewIndentWriter(w) - fwResults := fwMap[host] - if len(fwResults) == 0 { - fmt.Fprintln(iw, nvmeNotFound) - continue - } - - for _, res := range fwResults { - fmt.Fprintf(iw, "Device PCI Address: %s\n", res.DevicePCIAddr) - - iw2 := txtfmt.NewIndentWriter(iw) - - if res.Error != nil { - fmt.Fprintf(iw2, "%s\n", getErrorString(res.Error)) - continue - } - - fmt.Fprintf(iw2, "%s\n", nvmeUpdateSuccess) - } - } - return w.Err -} diff --git a/src/control/cmd/dmg/pretty/firmware_test.go b/src/control/cmd/dmg/pretty/firmware_test.go deleted file mode 100644 index 4ee8335ed16..00000000000 --- a/src/control/cmd/dmg/pretty/firmware_test.go +++ /dev/null @@ -1,1451 +0,0 @@ -// -// (C) Copyright 2020-2021 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -package pretty - -import ( - "errors" - "fmt" - "strings" - "testing" - - "github.com/google/go-cmp/cmp" - - "github.com/daos-stack/daos/src/control/lib/control" - "github.com/daos-stack/daos/src/control/server/storage" -) - -func TestPretty_PrintSCMFirmwareQueryMap(t *testing.T) { - for name, tc := range map[string]struct { - fwMap control.HostSCMQueryMap - hostErrors control.HostErrorsMap - expPrintStr string - }{ - "nil map": { - fwMap: nil, - expPrintStr: "", - }, - "no devices": { - fwMap: control.HostSCMQueryMap{ - "host1": []*control.SCMQueryResult{}, - "host2": []*control.SCMQueryResult{}, - "host3": []*control.SCMQueryResult{}, - }, - expPrintStr: ` -=================== -SCM Device Firmware -=================== - --------- - host[1-3] - --------- - No SCM devices detected -`, - }, - "single host": { - fwMap: control.HostSCMQueryMap{ - "host1": []*control.SCMQueryResult{ - { - Module: storage.ScmModule{ - UID: "Device1", - PhysicalID: 1, - Capacity: 12345, - SocketID: 1, - ControllerID: 2, - ChannelID: 3, - ChannelPosition: 5, - }, - Info: &storage.ScmFirmwareInfo{ - ActiveVersion: "V100", - StagedVersion: "V101", - ImageMaxSizeBytes: 12345, - UpdateStatus: storage.ScmUpdateStatusStaged, - }, - }, - { - Module: storage.ScmModule{ - UID: "Device2", - PhysicalID: 2, - Capacity: 67890, - SocketID: 6, - ControllerID: 7, - ChannelID: 8, - ChannelPosition: 9, - }, - Info: &storage.ScmFirmwareInfo{ - ActiveVersion: "V100", - StagedVersion: "V101", - ImageMaxSizeBytes: 12345, - UpdateStatus: storage.ScmUpdateStatusStaged, - }, - }, - { - Module: storage.ScmModule{ - UID: "Device3", - PhysicalID: 3, - Capacity: 67890, - SocketID: 1, - ControllerID: 2, - ChannelID: 2, - ChannelPosition: 1, - }, - Error: errors.New("test error"), - }, - { - Module: storage.ScmModule{ - UID: "Device4", - PhysicalID: 4, - Capacity: 67890, - SocketID: 2, - ControllerID: 2, - ChannelID: 2, - ChannelPosition: 1, - }, - Error: errors.New("test error"), - }, - }, - }, - expPrintStr: ` -=================== -SCM Device Firmware -=================== - Errors: - Host Device:PhyID:Socket:Ctrl:Chan:Pos Error - ---- --------------------------------- ----- - host1 Device3:3:1:2:2:1 test error - host1 Device4:4:2:2:2:1 test error - ----- - host1 - ----- - Firmware status for 2 devices: - Active Version: V100 - Staged Version: V101 - Maximum Firmware Image Size: 12 KiB - Last Update Status: Staged -`, - }, - "multiple hosts": { - fwMap: control.HostSCMQueryMap{ - "host1": []*control.SCMQueryResult{ - { - Module: storage.ScmModule{ - UID: "Device0", - PhysicalID: 0, - Capacity: (1 << 32), - SocketID: 1, - ControllerID: 1, - ChannelID: 2, - ChannelPosition: 1, - }, - Info: &storage.ScmFirmwareInfo{ - ActiveVersion: "B300", - StagedVersion: "", - ImageMaxSizeBytes: (1 << 20), - UpdateStatus: storage.ScmUpdateStatusFailed, - }, - }, - { - Module: storage.ScmModule{ - UID: "Device1", - PhysicalID: 1, - Capacity: (1 << 31), - SocketID: 1, - ControllerID: 2, - ChannelID: 3, - ChannelPosition: 5, - }, - Error: errors.New("shared error"), - }, - }, - "host2": []*control.SCMQueryResult{ - { - Module: storage.ScmModule{ - UID: "Device2", - PhysicalID: 2, - Capacity: (1 << 30), - SocketID: 6, - ControllerID: 7, - ChannelID: 8, - ChannelPosition: 9, - }, - Error: errors.New("shared error"), - }, - { - Module: storage.ScmModule{ - UID: "Device3", - PhysicalID: 3, - Capacity: (1 << 32), - SocketID: 1, - ControllerID: 2, - ChannelID: 2, - ChannelPosition: 1, - }, - Info: &storage.ScmFirmwareInfo{ - ActiveVersion: "B300", - StagedVersion: "", - ImageMaxSizeBytes: (1 << 20), - UpdateStatus: storage.ScmUpdateStatusFailed, - }, - }, - { - Module: storage.ScmModule{ - UID: "Device4", - PhysicalID: 4, - Capacity: (1 << 32), - SocketID: 1, - ControllerID: 2, - ChannelID: 3, - ChannelPosition: 1, - }, - Info: &storage.ScmFirmwareInfo{ - ActiveVersion: "B300", - StagedVersion: "", - ImageMaxSizeBytes: (1 << 20), - UpdateStatus: storage.ScmUpdateStatusFailed, - }, - }, - }, - }, - expPrintStr: ` -=================== -SCM Device Firmware -=================== - Errors: - Host Device:PhyID:Socket:Ctrl:Chan:Pos Error - ---- --------------------------------- ----- - host1 Device1:1:1:2:3:5 shared error - host2 Device2:2:6:7:8:9 shared error - --------- - host[1-2] - --------- - Firmware status for 3 devices: - Active Version: B300 - Staged Version: N/A - Maximum Firmware Image Size: 1.0 MiB - Last Update Status: Failed -`, - }, - "no errors": { - fwMap: control.HostSCMQueryMap{ - "host1": []*control.SCMQueryResult{ - { - Module: storage.ScmModule{ - UID: "Device0", - PhysicalID: 0, - Capacity: (1 << 32), - SocketID: 1, - ControllerID: 1, - ChannelID: 2, - ChannelPosition: 1, - }, - Info: &storage.ScmFirmwareInfo{ - ActiveVersion: "B300", - StagedVersion: "", - ImageMaxSizeBytes: (1 << 20), - UpdateStatus: storage.ScmUpdateStatusFailed, - }, - }, - }, - "host2": []*control.SCMQueryResult{ - { - Module: storage.ScmModule{ - UID: "Device3", - PhysicalID: 3, - Capacity: (1 << 32), - SocketID: 1, - ControllerID: 2, - ChannelID: 2, - ChannelPosition: 1, - }, - Info: &storage.ScmFirmwareInfo{ - ActiveVersion: "B300", - StagedVersion: "", - ImageMaxSizeBytes: (1 << 20), - UpdateStatus: storage.ScmUpdateStatusFailed, - }, - }, - }, - }, - expPrintStr: ` -=================== -SCM Device Firmware -=================== - --------- - host[1-2] - --------- - Firmware status for 2 devices: - Active Version: B300 - Staged Version: N/A - Maximum Firmware Image Size: 1.0 MiB - Last Update Status: Failed -`, - }, - "only errors": { - fwMap: control.HostSCMQueryMap{ - "host1": []*control.SCMQueryResult{ - { - Module: storage.ScmModule{ - UID: "Device0", - PhysicalID: 0, - Capacity: (1 << 32), - SocketID: 1, - ControllerID: 1, - ChannelID: 2, - ChannelPosition: 1, - }, - Error: errors.New("oopsie daisy"), - }, - }, - "host2": []*control.SCMQueryResult{ - { - Module: storage.ScmModule{ - UID: "Device1", - PhysicalID: 1, - Capacity: (1 << 32), - SocketID: 1, - ControllerID: 2, - ChannelID: 2, - ChannelPosition: 1, - }, - Error: errors.New("something bad happened"), - }, - }, - }, - expPrintStr: ` -=================== -SCM Device Firmware -=================== - Errors: - Host Device:PhyID:Socket:Ctrl:Chan:Pos Error - ---- --------------------------------- ----- - host1 Device0:0:1:1:2:1 oopsie daisy - host2 Device1:1:1:2:2:1 something bad happened -`, - }, - } { - t.Run(name, func(t *testing.T) { - var bld strings.Builder - if err := PrintSCMFirmwareQueryMap(tc.fwMap, &bld); err != nil { - t.Fatal(err) - } - - if diff := cmp.Diff(strings.TrimLeft(tc.expPrintStr, "\n"), bld.String()); diff != "" { - t.Fatalf("unexpected format string (-want, +got):\n%s\n", diff) - } - }) - } -} - -func TestPretty_PrintSCMFirmwareQueryMapVerbose(t *testing.T) { - for name, tc := range map[string]struct { - fwMap control.HostSCMQueryMap - hostErrors control.HostErrorsMap - expPrintStr string - }{ - "nil map": { - fwMap: nil, - expPrintStr: "", - }, - "no devices": { - fwMap: control.HostSCMQueryMap{ - "host1": []*control.SCMQueryResult{}, - }, - expPrintStr: ` -=================== -SCM Device Firmware -=================== - ----- - host1 - ----- - No SCM devices detected -`, - }, - "single host": { - fwMap: control.HostSCMQueryMap{ - "host1": []*control.SCMQueryResult{ - { - Module: storage.ScmModule{ - UID: "Device1", - PhysicalID: 1, - Capacity: 12345, - SocketID: 1, - ControllerID: 2, - ChannelID: 3, - ChannelPosition: 5, - }, - Info: &storage.ScmFirmwareInfo{ - ActiveVersion: "V100", - StagedVersion: "V101", - ImageMaxSizeBytes: 12345, - UpdateStatus: storage.ScmUpdateStatusStaged, - }, - }, - { - Module: storage.ScmModule{ - UID: "Device2", - PhysicalID: 2, - Capacity: 67890, - SocketID: 6, - ControllerID: 7, - ChannelID: 8, - ChannelPosition: 9, - }, - Info: &storage.ScmFirmwareInfo{ - ActiveVersion: "A113", - StagedVersion: "", - ImageMaxSizeBytes: 54321, - UpdateStatus: storage.ScmUpdateStatusSuccess, - }, - }, - { - Module: storage.ScmModule{ - UID: "Device3", - PhysicalID: 3, - Capacity: 67890, - SocketID: 1, - ControllerID: 2, - ChannelID: 2, - ChannelPosition: 1, - }, - Error: errors.New("test error"), - }, - { - Module: storage.ScmModule{ - UID: "Device4", - PhysicalID: 4, - Capacity: 67890, - SocketID: 2, - ControllerID: 2, - ChannelID: 2, - ChannelPosition: 1, - }, - }, - }, - }, - expPrintStr: ` -=================== -SCM Device Firmware -=================== - ----- - host1 - ----- - UID:Device1 PhysicalID:1 Capacity:12 KiB Location:(socket:1 memctrlr:2 chan:3 pos:5) - Active Version: V100 - Staged Version: V101 - Maximum Firmware Image Size: 12 KiB - Last Update Status: Staged - UID:Device2 PhysicalID:2 Capacity:66 KiB Location:(socket:6 memctrlr:7 chan:8 pos:9) - Active Version: A113 - Staged Version: N/A - Maximum Firmware Image Size: 53 KiB - Last Update Status: Success - UID:Device3 PhysicalID:3 Capacity:66 KiB Location:(socket:1 memctrlr:2 chan:2 pos:1) - Error: test error - UID:Device4 PhysicalID:4 Capacity:66 KiB Location:(socket:2 memctrlr:2 chan:2 pos:1) - Error: No information available -`, - }, - "multiple hosts": { - fwMap: control.HostSCMQueryMap{ - "host1": []*control.SCMQueryResult{ - { - Module: storage.ScmModule{ - UID: "Device1", - PhysicalID: 1, - Capacity: (1 << 31), - SocketID: 1, - ControllerID: 2, - ChannelID: 3, - ChannelPosition: 5, - }, - Info: &storage.ScmFirmwareInfo{ - ActiveVersion: "B300", - StagedVersion: "", - ImageMaxSizeBytes: (1 << 20), - UpdateStatus: storage.ScmUpdateStatusFailed, - }, - }, - }, - "host2": []*control.SCMQueryResult{ - { - Module: storage.ScmModule{ - UID: "Device2", - PhysicalID: 2, - Capacity: (1 << 30), - SocketID: 6, - ControllerID: 7, - ChannelID: 8, - ChannelPosition: 9, - }, - Info: &storage.ScmFirmwareInfo{ - ActiveVersion: "", - StagedVersion: "", - ImageMaxSizeBytes: 0, - UpdateStatus: storage.ScmUpdateStatusUnknown, - }, - }, - { - Module: storage.ScmModule{ - UID: "Device3", - PhysicalID: 3, - Capacity: (1 << 32), - SocketID: 1, - ControllerID: 2, - ChannelID: 2, - ChannelPosition: 1, - }, - Info: &storage.ScmFirmwareInfo{ - ActiveVersion: "A113", - StagedVersion: "", - ImageMaxSizeBytes: (1 << 21), - UpdateStatus: storage.ScmFirmwareUpdateStatus(0xFFFFFFFF), - }, - }, - }, - }, - expPrintStr: ` -=================== -SCM Device Firmware -=================== - ----- - host1 - ----- - UID:Device1 PhysicalID:1 Capacity:2.0 GiB Location:(socket:1 memctrlr:2 chan:3 pos:5) - Active Version: B300 - Staged Version: N/A - Maximum Firmware Image Size: 1.0 MiB - Last Update Status: Failed - ----- - host2 - ----- - UID:Device2 PhysicalID:2 Capacity:1.0 GiB Location:(socket:6 memctrlr:7 chan:8 pos:9) - Active Version: N/A - Staged Version: N/A - Maximum Firmware Image Size: 0 B - Last Update Status: Unknown - UID:Device3 PhysicalID:3 Capacity:4.0 GiB Location:(socket:1 memctrlr:2 chan:2 pos:1) - Active Version: A113 - Staged Version: N/A - Maximum Firmware Image Size: 2.0 MiB - Last Update Status: Unknown -`, - }, - } { - t.Run(name, func(t *testing.T) { - var bld strings.Builder - if err := PrintSCMFirmwareQueryMapVerbose(tc.fwMap, &bld); err != nil { - t.Fatal(err) - } - - if diff := cmp.Diff(strings.TrimLeft(tc.expPrintStr, "\n"), bld.String()); diff != "" { - t.Fatalf("unexpected format string (-want, +got):\n%s\n", diff) - } - }) - } -} - -func TestPretty_PrintSCMFirmwareUpdateMapVerbose(t *testing.T) { - for name, tc := range map[string]struct { - fwMap control.HostSCMUpdateMap - hostErrors control.HostErrorsMap - expPrintStr string - }{ - "no devices": { - fwMap: control.HostSCMUpdateMap{ - "host1": []*control.SCMUpdateResult{}, - "host2": []*control.SCMUpdateResult{}, - }, - expPrintStr: ` ------ -host1 ------ - No SCM devices detected ------ -host2 ------ - No SCM devices detected -`, - }, - "single host": { - fwMap: control.HostSCMUpdateMap{ - "host1": []*control.SCMUpdateResult{ - { - Module: storage.ScmModule{ - UID: "Device1", - PhysicalID: 1, - Capacity: 12345, - SocketID: 1, - ControllerID: 2, - ChannelID: 3, - ChannelPosition: 5, - }, - }, - { - Module: storage.ScmModule{ - UID: "Device2", - PhysicalID: 2, - Capacity: 67890, - SocketID: 6, - ControllerID: 7, - ChannelID: 8, - ChannelPosition: 9, - }, - Error: errors.New("test error"), - }, - { - Module: storage.ScmModule{ - UID: "Device3", - PhysicalID: 3, - Capacity: 67890, - SocketID: 1, - ControllerID: 2, - ChannelID: 2, - ChannelPosition: 1, - }, - }, - }, - }, - expPrintStr: ` ------ -host1 ------ - UID:Device1 PhysicalID:1 Capacity:12 KiB Location:(socket:1 memctrlr:2 chan:3 pos:5) - Success - The new firmware was staged. A power cycle is required to apply. - UID:Device2 PhysicalID:2 Capacity:66 KiB Location:(socket:6 memctrlr:7 chan:8 pos:9) - Error: test error - UID:Device3 PhysicalID:3 Capacity:66 KiB Location:(socket:1 memctrlr:2 chan:2 pos:1) - Success - The new firmware was staged. A power cycle is required to apply. -`, - }, - "multiple hosts": { - fwMap: control.HostSCMUpdateMap{ - "host1": []*control.SCMUpdateResult{ - { - Module: storage.ScmModule{ - UID: "Device1", - PhysicalID: 1, - Capacity: (1 << 31), - SocketID: 1, - ControllerID: 2, - ChannelID: 3, - ChannelPosition: 5, - }, - }, - }, - "host2": []*control.SCMUpdateResult{ - { - Module: storage.ScmModule{ - UID: "Device2", - PhysicalID: 2, - Capacity: (1 << 30), - SocketID: 6, - ControllerID: 7, - ChannelID: 8, - ChannelPosition: 9, - }, - }, - { - Module: storage.ScmModule{ - UID: "Device3", - PhysicalID: 3, - Capacity: (1 << 32), - SocketID: 1, - ControllerID: 2, - ChannelID: 2, - ChannelPosition: 1, - }, - Error: errors.New("something went wrong"), - }, - }, - }, - expPrintStr: ` ------ -host1 ------ - UID:Device1 PhysicalID:1 Capacity:2.0 GiB Location:(socket:1 memctrlr:2 chan:3 pos:5) - Success - The new firmware was staged. A power cycle is required to apply. ------ -host2 ------ - UID:Device2 PhysicalID:2 Capacity:1.0 GiB Location:(socket:6 memctrlr:7 chan:8 pos:9) - Success - The new firmware was staged. A power cycle is required to apply. - UID:Device3 PhysicalID:3 Capacity:4.0 GiB Location:(socket:1 memctrlr:2 chan:2 pos:1) - Error: something went wrong -`, - }, - } { - t.Run(name, func(t *testing.T) { - var bld strings.Builder - if err := PrintSCMFirmwareUpdateMapVerbose(tc.fwMap, &bld); err != nil { - t.Fatal(err) - } - - if diff := cmp.Diff(strings.TrimLeft(tc.expPrintStr, "\n"), bld.String()); diff != "" { - t.Fatalf("unexpected format string (-want, +got):\n%s\n", diff) - } - }) - } -} - -func TestPretty_PrintSCMFirmwareUpdateMap(t *testing.T) { - for name, tc := range map[string]struct { - fwMap control.HostSCMUpdateMap - hostErrors control.HostErrorsMap - expPrintStr string - }{ - "no devices": { - fwMap: control.HostSCMUpdateMap{ - "host1": []*control.SCMUpdateResult{}, - "host2": []*control.SCMUpdateResult{}, - }, - expPrintStr: ` ---------- -host[1-2] ---------- - No SCM devices detected -`, - }, - "single host": { - fwMap: control.HostSCMUpdateMap{ - "host1": []*control.SCMUpdateResult{ - { - Module: storage.ScmModule{ - UID: "Device1", - PhysicalID: 1, - Capacity: 12345, - SocketID: 1, - ControllerID: 2, - ChannelID: 3, - ChannelPosition: 5, - }, - }, - { - Module: storage.ScmModule{ - UID: "Device2", - PhysicalID: 2, - Capacity: 67890, - SocketID: 6, - ControllerID: 7, - ChannelID: 8, - ChannelPosition: 9, - }, - Error: errors.New("test error"), - }, - { - Module: storage.ScmModule{ - UID: "Device3", - PhysicalID: 3, - Capacity: 67890, - SocketID: 1, - ControllerID: 2, - ChannelID: 2, - ChannelPosition: 1, - }, - Error: errors.New("test error"), - }, - }, - }, - expPrintStr: ` -Errors: - Host Device:PhyID:Socket:Ctrl:Chan:Pos Error - ---- --------------------------------- ----- - host1 Device2:2:6:7:8:9 test error - host1 Device3:3:1:2:2:1 test error ------ -host1 ------ - Firmware staged on 1 device. A power cycle is required to apply the update. -`, - }, - "multiple hosts": { - fwMap: control.HostSCMUpdateMap{ - "host1": []*control.SCMUpdateResult{ - { - Module: storage.ScmModule{ - UID: "Device1", - PhysicalID: 1, - Capacity: (1 << 31), - SocketID: 1, - ControllerID: 2, - ChannelID: 3, - ChannelPosition: 5, - }, - }, - }, - "host2": []*control.SCMUpdateResult{ - { - Module: storage.ScmModule{ - UID: "Device2", - PhysicalID: 2, - Capacity: (1 << 30), - SocketID: 6, - ControllerID: 7, - ChannelID: 8, - ChannelPosition: 9, - }, - }, - { - Module: storage.ScmModule{ - UID: "Device3", - PhysicalID: 3, - Capacity: (1 << 32), - SocketID: 1, - ControllerID: 2, - ChannelID: 2, - ChannelPosition: 1, - }, - Error: errors.New("something went wrong"), - }, - }, - }, - expPrintStr: ` -Errors: - Host Device:PhyID:Socket:Ctrl:Chan:Pos Error - ---- --------------------------------- ----- - host2 Device3:3:1:2:2:1 something went wrong ---------- -host[1-2] ---------- - Firmware staged on 2 devices. A power cycle is required to apply the update. -`, - }, - "no errors": { - fwMap: control.HostSCMUpdateMap{ - "host1": []*control.SCMUpdateResult{ - { - Module: storage.ScmModule{ - UID: "Device1", - PhysicalID: 1, - Capacity: (1 << 31), - SocketID: 1, - ControllerID: 2, - ChannelID: 3, - ChannelPosition: 5, - }, - }, - }, - "host2": []*control.SCMUpdateResult{ - { - Module: storage.ScmModule{ - UID: "Device2", - PhysicalID: 2, - Capacity: (1 << 30), - SocketID: 6, - ControllerID: 7, - ChannelID: 8, - ChannelPosition: 9, - }, - }, - { - Module: storage.ScmModule{ - UID: "Device3", - PhysicalID: 3, - Capacity: (1 << 32), - SocketID: 1, - ControllerID: 2, - ChannelID: 2, - ChannelPosition: 1, - }, - }, - }, - }, - expPrintStr: ` ---------- -host[1-2] ---------- - Firmware staged on 3 devices. A power cycle is required to apply the update. -`, - }, - "only errors": { - fwMap: control.HostSCMUpdateMap{ - "host1": []*control.SCMUpdateResult{ - { - Module: storage.ScmModule{ - UID: "Device1", - PhysicalID: 1, - Capacity: (1 << 31), - SocketID: 1, - ControllerID: 2, - ChannelID: 3, - ChannelPosition: 5, - }, - Error: errors.New("oh no"), - }, - }, - "host2": []*control.SCMUpdateResult{ - { - Module: storage.ScmModule{ - UID: "Device2", - PhysicalID: 2, - Capacity: (1 << 30), - SocketID: 6, - ControllerID: 7, - ChannelID: 8, - ChannelPosition: 9, - }, - Error: errors.New("oh no"), - }, - { - Module: storage.ScmModule{ - UID: "Device3", - PhysicalID: 3, - Capacity: (1 << 32), - SocketID: 1, - ControllerID: 2, - ChannelID: 2, - ChannelPosition: 1, - }, - Error: errors.New("something went wrong"), - }, - }, - }, - expPrintStr: ` -Errors: - Host Device:PhyID:Socket:Ctrl:Chan:Pos Error - ---- --------------------------------- ----- - host1 Device1:1:1:2:3:5 oh no - host2 Device2:2:6:7:8:9 oh no - host2 Device3:3:1:2:2:1 something went wrong -`, - }, - } { - t.Run(name, func(t *testing.T) { - var bld strings.Builder - if err := PrintSCMFirmwareUpdateMap(tc.fwMap, &bld); err != nil { - t.Fatal(err) - } - - if diff := cmp.Diff(strings.TrimLeft(tc.expPrintStr, "\n"), bld.String()); diff != "" { - t.Fatalf("unexpected format string (-want, +got):\n%s\n", diff) - } - }) - } -} - -func getNvmeControllerWithFWRev(idx int32, fwRev string) *storage.NvmeController { - return &storage.NvmeController{ - Model: fmt.Sprintf("model%d", idx), - Serial: fmt.Sprintf("serial%d", idx), - PciAddr: fmt.Sprintf("0000:80:00.%d", idx), - FwRev: fwRev, - SocketID: idx, - } -} - -func TestPretty_PrintNVMeFirmwareQueryMap(t *testing.T) { - for name, tc := range map[string]struct { - fwMap control.HostNVMeQueryMap - hostErrors control.HostErrorsMap - expPrintStr string - }{ - "nil map": { - fwMap: nil, - expPrintStr: "", - }, - "no devices": { - fwMap: control.HostNVMeQueryMap{ - "host1": []*control.NVMeQueryResult{}, - "host2": []*control.NVMeQueryResult{}, - "host3": []*control.NVMeQueryResult{}, - }, - expPrintStr: ` -==================== -NVMe Device Firmware -==================== - --------- - host[1-3] - --------- - No NVMe device controllers detected -`, - }, - "single host": { - fwMap: control.HostNVMeQueryMap{ - "host1": []*control.NVMeQueryResult{ - { - Device: *getNvmeControllerWithFWRev(1, "FW100"), - }, - { - Device: *getNvmeControllerWithFWRev(2, "FW100"), - }, - { - Device: *getNvmeControllerWithFWRev(3, "FW200"), - }, - { - Device: *getNvmeControllerWithFWRev(4, "FW100"), - }, - }, - }, - expPrintStr: ` -==================== -NVMe Device Firmware -==================== - ----- - host1 - ----- - Firmware status for 3 devices: - Revision: FW100 - ----- - host1 - ----- - Firmware status for 1 device: - Revision: FW200 -`, - }, - "multiple hosts": { - fwMap: control.HostNVMeQueryMap{ - "host1": []*control.NVMeQueryResult{ - { - Device: *getNvmeControllerWithFWRev(1, "FW100"), - }, - { - Device: *getNvmeControllerWithFWRev(2, "FW100"), - }, - }, - "host2": []*control.NVMeQueryResult{ - { - Device: *getNvmeControllerWithFWRev(3, "FW100"), - }, - { - Device: *getNvmeControllerWithFWRev(2, "FW200"), - }, - { - Device: *getNvmeControllerWithFWRev(1, "FW100"), - }, - }, - }, - expPrintStr: ` -==================== -NVMe Device Firmware -==================== - --------- - host[1-2] - --------- - Firmware status for 4 devices: - Revision: FW100 - ----- - host2 - ----- - Firmware status for 1 device: - Revision: FW200 -`, - }, - } { - t.Run(name, func(t *testing.T) { - var bld strings.Builder - if err := PrintNVMeFirmwareQueryMap(tc.fwMap, &bld); err != nil { - t.Fatal(err) - } - - if diff := cmp.Diff(strings.TrimLeft(tc.expPrintStr, "\n"), bld.String()); diff != "" { - t.Fatalf("unexpected format string (-want, +got):\n%s\n", diff) - } - }) - } -} - -func TestPretty_PrintNVMeFirmwareQueryMapVerbose(t *testing.T) { - for name, tc := range map[string]struct { - fwMap control.HostNVMeQueryMap - hostErrors control.HostErrorsMap - expPrintStr string - }{ - "nil map": { - fwMap: nil, - expPrintStr: "", - }, - "no devices": { - fwMap: control.HostNVMeQueryMap{ - "host1": []*control.NVMeQueryResult{}, - "host2": []*control.NVMeQueryResult{}, - }, - expPrintStr: ` -==================== -NVMe Device Firmware -==================== - ----- - host1 - ----- - No NVMe device controllers detected - ----- - host2 - ----- - No NVMe device controllers detected -`, - }, - "single host": { - fwMap: control.HostNVMeQueryMap{ - "host1": []*control.NVMeQueryResult{ - { - Device: *getNvmeControllerWithFWRev(1, "FW100"), - }, - { - Device: *getNvmeControllerWithFWRev(2, "FW200"), - }, - { - Device: *getNvmeControllerWithFWRev(3, "FW100"), - }, - }, - }, - expPrintStr: ` -==================== -NVMe Device Firmware -==================== - ----- - host1 - ----- - Device PCI Address: 0000:80:00.1 - Revision: FW100 - Device PCI Address: 0000:80:00.2 - Revision: FW200 - Device PCI Address: 0000:80:00.3 - Revision: FW100 -`, - }, - "multiple hosts": { - fwMap: control.HostNVMeQueryMap{ - "host1": []*control.NVMeQueryResult{ - { - Device: *getNvmeControllerWithFWRev(1, "FW100"), - }, - }, - "host2": []*control.NVMeQueryResult{ - { - Device: *getNvmeControllerWithFWRev(1, "FW200"), - }, - { - Device: *getNvmeControllerWithFWRev(2, "FW200"), - }, - }, - }, - expPrintStr: ` -==================== -NVMe Device Firmware -==================== - ----- - host1 - ----- - Device PCI Address: 0000:80:00.1 - Revision: FW100 - ----- - host2 - ----- - Device PCI Address: 0000:80:00.1 - Revision: FW200 - Device PCI Address: 0000:80:00.2 - Revision: FW200 -`, - }, - } { - t.Run(name, func(t *testing.T) { - var bld strings.Builder - if err := PrintNVMeFirmwareQueryMapVerbose(tc.fwMap, &bld); err != nil { - t.Fatal(err) - } - - if diff := cmp.Diff(strings.TrimLeft(tc.expPrintStr, "\n"), bld.String()); diff != "" { - t.Fatalf("unexpected format string (-want, +got):\n%s\n", diff) - } - }) - } -} - -func TestPretty_PrintNVMeFirmwareUpdateMap(t *testing.T) { - for name, tc := range map[string]struct { - fwMap control.HostNVMeUpdateMap - hostErrors control.HostErrorsMap - expPrintStr string - }{ - "no devices": { - fwMap: control.HostNVMeUpdateMap{ - "host1": []*control.NVMeUpdateResult{}, - "host2": []*control.NVMeUpdateResult{}, - }, - expPrintStr: ` ---------- -host[1-2] ---------- - No NVMe device controllers detected -`, - }, - "single host": { - fwMap: control.HostNVMeUpdateMap{ - "host1": []*control.NVMeUpdateResult{ - { - DevicePCIAddr: "pciaddr0", - }, - { - DevicePCIAddr: "pciaddr1", - Error: errors.New("test error"), - }, - { - DevicePCIAddr: "pciaddr2", - }, - }, - }, - expPrintStr: ` -Errors: - Host Device Addr Error - ---- ----------- ----- - host1 pciaddr1 test error ------ -host1 ------ - Firmware updated on 2 NVMe device controllers. -`, - }, - "multiple hosts": { - fwMap: control.HostNVMeUpdateMap{ - "host1": []*control.NVMeUpdateResult{ - { - DevicePCIAddr: "pciaddr0", - }, - }, - "host2": []*control.NVMeUpdateResult{ - { - DevicePCIAddr: "pciaddr0", - }, - { - DevicePCIAddr: "pciaddr1", - Error: errors.New("something went wrong"), - }, - }, - }, - expPrintStr: ` -Errors: - Host Device Addr Error - ---- ----------- ----- - host2 pciaddr1 something went wrong ---------- -host[1-2] ---------- - Firmware updated on 2 NVMe device controllers. -`, - }, - "no errors": { - fwMap: control.HostNVMeUpdateMap{ - "host1": []*control.NVMeUpdateResult{ - { - DevicePCIAddr: "pciaddr0", - }, - }, - "host2": []*control.NVMeUpdateResult{ - { - DevicePCIAddr: "pciaddr0", - }, - { - DevicePCIAddr: "pciaddr1", - }, - }, - }, - expPrintStr: ` ---------- -host[1-2] ---------- - Firmware updated on 3 NVMe device controllers. -`, - }, - "only errors": { - fwMap: control.HostNVMeUpdateMap{ - "host1": []*control.NVMeUpdateResult{ - { - DevicePCIAddr: "pciaddr0", - Error: errors.New("oh no"), - }, - }, - "host2": []*control.NVMeUpdateResult{ - { - DevicePCIAddr: "pciaddr0", - Error: errors.New("oh no"), - }, - { - - DevicePCIAddr: "pciaddr1", - Error: errors.New("something went wrong"), - }, - }, - }, - expPrintStr: ` -Errors: - Host Device Addr Error - ---- ----------- ----- - host1 pciaddr0 oh no - host2 pciaddr0 oh no - host2 pciaddr1 something went wrong -`, - }, - } { - t.Run(name, func(t *testing.T) { - var bld strings.Builder - if err := PrintNVMeFirmwareUpdateMap(tc.fwMap, &bld); err != nil { - t.Fatal(err) - } - - if diff := cmp.Diff(strings.TrimLeft(tc.expPrintStr, "\n"), bld.String()); diff != "" { - t.Fatalf("unexpected format string (-want, +got):\n%s\n", diff) - } - }) - } -} - -func TestPretty_PrintNVMeFirmwareUpdateMapVerbose(t *testing.T) { - for name, tc := range map[string]struct { - fwMap control.HostNVMeUpdateMap - hostErrors control.HostErrorsMap - expPrintStr string - }{ - "no devices": { - fwMap: control.HostNVMeUpdateMap{ - "host1": []*control.NVMeUpdateResult{}, - "host2": []*control.NVMeUpdateResult{}, - }, - expPrintStr: ` ------ -host1 ------ - No NVMe device controllers detected ------ -host2 ------ - No NVMe device controllers detected -`, - }, - "single host": { - fwMap: control.HostNVMeUpdateMap{ - "host1": []*control.NVMeUpdateResult{ - { - DevicePCIAddr: "pciaddr0", - }, - { - DevicePCIAddr: "pciaddr1", - Error: errors.New("test error"), - }, - { - DevicePCIAddr: "pciaddr2", - }, - }, - }, - expPrintStr: ` ------ -host1 ------ - Device PCI Address: pciaddr0 - Success - The NVMe device controller firmware was updated. - Device PCI Address: pciaddr1 - Error: test error - Device PCI Address: pciaddr2 - Success - The NVMe device controller firmware was updated. -`, - }, - "multiple hosts": { - fwMap: control.HostNVMeUpdateMap{ - "host1": []*control.NVMeUpdateResult{ - { - DevicePCIAddr: "pciaddr0", - }, - }, - "host2": []*control.NVMeUpdateResult{ - { - DevicePCIAddr: "pciaddr0", - }, - { - DevicePCIAddr: "pciaddr1", - Error: errors.New("something went wrong"), - }, - }, - }, - expPrintStr: ` ------ -host1 ------ - Device PCI Address: pciaddr0 - Success - The NVMe device controller firmware was updated. ------ -host2 ------ - Device PCI Address: pciaddr0 - Success - The NVMe device controller firmware was updated. - Device PCI Address: pciaddr1 - Error: something went wrong -`, - }, - "no errors": { - fwMap: control.HostNVMeUpdateMap{ - "host1": []*control.NVMeUpdateResult{ - { - DevicePCIAddr: "pciaddr0", - }, - }, - "host2": []*control.NVMeUpdateResult{ - { - DevicePCIAddr: "pciaddr0", - }, - { - DevicePCIAddr: "pciaddr1", - }, - }, - }, - expPrintStr: ` ------ -host1 ------ - Device PCI Address: pciaddr0 - Success - The NVMe device controller firmware was updated. ------ -host2 ------ - Device PCI Address: pciaddr0 - Success - The NVMe device controller firmware was updated. - Device PCI Address: pciaddr1 - Success - The NVMe device controller firmware was updated. -`, - }, - "only errors": { - fwMap: control.HostNVMeUpdateMap{ - "host1": []*control.NVMeUpdateResult{ - { - DevicePCIAddr: "pciaddr0", - Error: errors.New("oh no"), - }, - }, - "host2": []*control.NVMeUpdateResult{ - { - DevicePCIAddr: "pciaddr0", - Error: errors.New("oh no"), - }, - { - - DevicePCIAddr: "pciaddr1", - Error: errors.New("something went wrong"), - }, - }, - }, - expPrintStr: ` ------ -host1 ------ - Device PCI Address: pciaddr0 - Error: oh no ------ -host2 ------ - Device PCI Address: pciaddr0 - Error: oh no - Device PCI Address: pciaddr1 - Error: something went wrong -`, - }, - } { - t.Run(name, func(t *testing.T) { - var bld strings.Builder - if err := PrintNVMeFirmwareUpdateMapVerbose(tc.fwMap, &bld); err != nil { - t.Fatal(err) - } - - if diff := cmp.Diff(strings.TrimLeft(tc.expPrintStr, "\n"), bld.String()); diff != "" { - t.Fatalf("unexpected format string (-want, +got):\n%s\n", diff) - } - }) - } -} diff --git a/src/control/common/proto/ctl/ctl.pb.go b/src/control/common/proto/ctl/ctl.pb.go index f0949f66e40..d959d389136 100644 --- a/src/control/common/proto/ctl/ctl.pb.go +++ b/src/control/common/proto/ctl/ctl.pb.go @@ -7,7 +7,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.36.10 // protoc v3.14.0 // source: ctl/ctl.proto @@ -17,6 +17,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" + unsafe "unsafe" ) const ( @@ -28,111 +29,50 @@ const ( var File_ctl_ctl_proto protoreflect.FileDescriptor -var file_ctl_ctl_proto_rawDesc = []byte{ - 0x0a, 0x0d, 0x63, 0x74, 0x6c, 0x2f, 0x63, 0x74, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x03, 0x63, 0x74, 0x6c, 0x1a, 0x11, 0x63, 0x74, 0x6c, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x63, 0x74, 0x6c, 0x2f, 0x6e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x63, 0x74, 0x6c, 0x2f, - 0x66, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0d, - 0x63, 0x74, 0x6c, 0x2f, 0x73, 0x6d, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x63, - 0x74, 0x6c, 0x2f, 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x10, - 0x63, 0x74, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x11, 0x63, 0x74, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x63, 0x74, 0x6c, 0x2f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xc6, 0x07, 0x0a, 0x06, 0x43, 0x74, 0x6c, 0x53, 0x76, 0x63, 0x12, - 0x3a, 0x0a, 0x0b, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x63, 0x61, 0x6e, 0x12, 0x13, - 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x63, 0x61, 0x6e, - 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, - 0x65, 0x53, 0x63, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0d, 0x53, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x15, 0x2e, 0x63, - 0x74, 0x6c, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, - 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, - 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x3e, 0x0a, - 0x11, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x4e, 0x76, 0x6d, 0x65, 0x52, 0x65, 0x62, 0x69, - 0x6e, 0x64, 0x12, 0x12, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x4e, 0x76, 0x6d, 0x65, 0x52, 0x65, 0x62, - 0x69, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x4e, 0x76, 0x6d, - 0x65, 0x52, 0x65, 0x62, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x47, 0x0a, - 0x14, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x4e, 0x76, 0x6d, 0x65, 0x41, 0x64, 0x64, 0x44, - 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x15, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x4e, 0x76, 0x6d, 0x65, - 0x41, 0x64, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x63, - 0x74, 0x6c, 0x2e, 0x4e, 0x76, 0x6d, 0x65, 0x41, 0x64, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x53, 0x63, 0x61, 0x6e, 0x12, 0x13, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x4e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x53, 0x63, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x63, 0x74, 0x6c, - 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x53, 0x63, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0d, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x12, 0x15, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, - 0x72, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x63, 0x74, 0x6c, - 0x2e, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, - 0x73, 0x70, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x16, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x46, 0x69, 0x72, - 0x6d, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x17, - 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x08, 0x53, 0x6d, 0x64, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x10, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x53, 0x6d, 0x64, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x53, 0x6d, - 0x64, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x09, - 0x53, 0x6d, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x12, 0x11, 0x2e, 0x63, 0x74, 0x6c, 0x2e, - 0x53, 0x6d, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x63, - 0x74, 0x6c, 0x2e, 0x53, 0x6d, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x22, 0x00, 0x12, 0x40, 0x0a, 0x11, 0x53, 0x65, 0x74, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x4c, - 0x6f, 0x67, 0x4d, 0x61, 0x73, 0x6b, 0x73, 0x12, 0x13, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x53, 0x65, - 0x74, 0x4c, 0x6f, 0x67, 0x4d, 0x61, 0x73, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x63, - 0x74, 0x6c, 0x2e, 0x53, 0x65, 0x74, 0x4c, 0x6f, 0x67, 0x4d, 0x61, 0x73, 0x6b, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x11, 0x50, 0x72, 0x65, 0x70, 0x53, 0x68, 0x75, 0x74, - 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x61, 0x6e, 0x6b, 0x73, 0x12, 0x0d, 0x2e, 0x63, 0x74, 0x6c, 0x2e, - 0x52, 0x61, 0x6e, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x52, - 0x61, 0x6e, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x2c, 0x0a, 0x09, 0x53, 0x74, - 0x6f, 0x70, 0x52, 0x61, 0x6e, 0x6b, 0x73, 0x12, 0x0d, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x52, 0x61, - 0x6e, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x52, 0x61, 0x6e, - 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x10, 0x52, 0x65, 0x73, 0x65, - 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x73, 0x12, 0x0d, 0x2e, 0x63, - 0x74, 0x6c, 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x63, 0x74, - 0x6c, 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x2d, 0x0a, - 0x0a, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x73, 0x12, 0x0d, 0x2e, 0x63, 0x74, - 0x6c, 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x63, 0x74, 0x6c, - 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0a, - 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x4c, 0x6f, 0x67, 0x12, 0x12, 0x2e, 0x63, 0x74, 0x6c, - 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x13, - 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x4c, 0x6f, 0x67, 0x52, - 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x11, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x6e, - 0x67, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x70, 0x61, 0x69, 0x72, 0x12, 0x16, 0x2e, 0x63, 0x74, 0x6c, - 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x52, - 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x6e, - 0x67, 0x69, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x39, 0x5a, - 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x61, 0x6f, 0x73, - 0x2d, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x64, 0x61, 0x6f, 0x73, 0x2f, 0x73, 0x72, 0x63, 0x2f, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x74, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +const file_ctl_ctl_proto_rawDesc = "" + + "\n" + + "\rctl/ctl.proto\x12\x03ctl\x1a\x11ctl/storage.proto\x1a\x11ctl/network.proto\x1a\rctl/smd.proto\x1a\x0fctl/ranks.proto\x1a\x10ctl/server.proto\x1a\x11ctl/support.proto\x1a\x0fctl/check.proto2\xbf\x06\n" + + "\x06CtlSvc\x12:\n" + + "\vStorageScan\x12\x13.ctl.StorageScanReq\x1a\x14.ctl.StorageScanResp\"\x00\x12@\n" + + "\rStorageFormat\x12\x15.ctl.StorageFormatReq\x1a\x16.ctl.StorageFormatResp\"\x00\x12>\n" + + "\x11StorageNvmeRebind\x12\x12.ctl.NvmeRebindReq\x1a\x13.ctl.NvmeRebindResp\"\x00\x12G\n" + + "\x14StorageNvmeAddDevice\x12\x15.ctl.NvmeAddDeviceReq\x1a\x16.ctl.NvmeAddDeviceResp\"\x00\x12:\n" + + "\vNetworkScan\x12\x13.ctl.NetworkScanReq\x1a\x14.ctl.NetworkScanResp\"\x00\x121\n" + + "\bSmdQuery\x12\x10.ctl.SmdQueryReq\x1a\x11.ctl.SmdQueryResp\"\x00\x124\n" + + "\tSmdManage\x12\x11.ctl.SmdManageReq\x1a\x12.ctl.SmdManageResp\"\x00\x12@\n" + + "\x11SetEngineLogMasks\x12\x13.ctl.SetLogMasksReq\x1a\x14.ctl.SetLogMasksResp\"\x00\x124\n" + + "\x11PrepShutdownRanks\x12\r.ctl.RanksReq\x1a\x0e.ctl.RanksResp\"\x00\x12,\n" + + "\tStopRanks\x12\r.ctl.RanksReq\x1a\x0e.ctl.RanksResp\"\x00\x123\n" + + "\x10ResetFormatRanks\x12\r.ctl.RanksReq\x1a\x0e.ctl.RanksResp\"\x00\x12-\n" + + "\n" + + "StartRanks\x12\r.ctl.RanksReq\x1a\x0e.ctl.RanksResp\"\x00\x127\n" + + "\n" + + "CollectLog\x12\x12.ctl.CollectLogReq\x1a\x13.ctl.CollectLogResp\"\x00\x12F\n" + + "\x11CheckEngineRepair\x12\x16.ctl.CheckEngineActReq\x1a\x17.ctl.CheckEngineActResp\"\x00B9Z7github.com/daos-stack/daos/src/control/common/proto/ctlb\x06proto3" -var file_ctl_ctl_proto_goTypes = []interface{}{ +var file_ctl_ctl_proto_goTypes = []any{ (*StorageScanReq)(nil), // 0: ctl.StorageScanReq (*StorageFormatReq)(nil), // 1: ctl.StorageFormatReq (*NvmeRebindReq)(nil), // 2: ctl.NvmeRebindReq (*NvmeAddDeviceReq)(nil), // 3: ctl.NvmeAddDeviceReq (*NetworkScanReq)(nil), // 4: ctl.NetworkScanReq - (*FirmwareQueryReq)(nil), // 5: ctl.FirmwareQueryReq - (*FirmwareUpdateReq)(nil), // 6: ctl.FirmwareUpdateReq - (*SmdQueryReq)(nil), // 7: ctl.SmdQueryReq - (*SmdManageReq)(nil), // 8: ctl.SmdManageReq - (*SetLogMasksReq)(nil), // 9: ctl.SetLogMasksReq - (*RanksReq)(nil), // 10: ctl.RanksReq - (*CollectLogReq)(nil), // 11: ctl.CollectLogReq - (*CheckEngineActReq)(nil), // 12: ctl.CheckEngineActReq - (*StorageScanResp)(nil), // 13: ctl.StorageScanResp - (*StorageFormatResp)(nil), // 14: ctl.StorageFormatResp - (*NvmeRebindResp)(nil), // 15: ctl.NvmeRebindResp - (*NvmeAddDeviceResp)(nil), // 16: ctl.NvmeAddDeviceResp - (*NetworkScanResp)(nil), // 17: ctl.NetworkScanResp - (*FirmwareQueryResp)(nil), // 18: ctl.FirmwareQueryResp - (*FirmwareUpdateResp)(nil), // 19: ctl.FirmwareUpdateResp - (*SmdQueryResp)(nil), // 20: ctl.SmdQueryResp - (*SmdManageResp)(nil), // 21: ctl.SmdManageResp - (*SetLogMasksResp)(nil), // 22: ctl.SetLogMasksResp - (*RanksResp)(nil), // 23: ctl.RanksResp - (*CollectLogResp)(nil), // 24: ctl.CollectLogResp - (*CheckEngineActResp)(nil), // 25: ctl.CheckEngineActResp + (*SmdQueryReq)(nil), // 5: ctl.SmdQueryReq + (*SmdManageReq)(nil), // 6: ctl.SmdManageReq + (*SetLogMasksReq)(nil), // 7: ctl.SetLogMasksReq + (*RanksReq)(nil), // 8: ctl.RanksReq + (*CollectLogReq)(nil), // 9: ctl.CollectLogReq + (*CheckEngineActReq)(nil), // 10: ctl.CheckEngineActReq + (*StorageScanResp)(nil), // 11: ctl.StorageScanResp + (*StorageFormatResp)(nil), // 12: ctl.StorageFormatResp + (*NvmeRebindResp)(nil), // 13: ctl.NvmeRebindResp + (*NvmeAddDeviceResp)(nil), // 14: ctl.NvmeAddDeviceResp + (*NetworkScanResp)(nil), // 15: ctl.NetworkScanResp + (*SmdQueryResp)(nil), // 16: ctl.SmdQueryResp + (*SmdManageResp)(nil), // 17: ctl.SmdManageResp + (*SetLogMasksResp)(nil), // 18: ctl.SetLogMasksResp + (*RanksResp)(nil), // 19: ctl.RanksResp + (*CollectLogResp)(nil), // 20: ctl.CollectLogResp + (*CheckEngineActResp)(nil), // 21: ctl.CheckEngineActResp } var file_ctl_ctl_proto_depIdxs = []int32{ 0, // 0: ctl.CtlSvc.StorageScan:input_type -> ctl.StorageScanReq @@ -140,35 +80,31 @@ var file_ctl_ctl_proto_depIdxs = []int32{ 2, // 2: ctl.CtlSvc.StorageNvmeRebind:input_type -> ctl.NvmeRebindReq 3, // 3: ctl.CtlSvc.StorageNvmeAddDevice:input_type -> ctl.NvmeAddDeviceReq 4, // 4: ctl.CtlSvc.NetworkScan:input_type -> ctl.NetworkScanReq - 5, // 5: ctl.CtlSvc.FirmwareQuery:input_type -> ctl.FirmwareQueryReq - 6, // 6: ctl.CtlSvc.FirmwareUpdate:input_type -> ctl.FirmwareUpdateReq - 7, // 7: ctl.CtlSvc.SmdQuery:input_type -> ctl.SmdQueryReq - 8, // 8: ctl.CtlSvc.SmdManage:input_type -> ctl.SmdManageReq - 9, // 9: ctl.CtlSvc.SetEngineLogMasks:input_type -> ctl.SetLogMasksReq - 10, // 10: ctl.CtlSvc.PrepShutdownRanks:input_type -> ctl.RanksReq - 10, // 11: ctl.CtlSvc.StopRanks:input_type -> ctl.RanksReq - 10, // 12: ctl.CtlSvc.ResetFormatRanks:input_type -> ctl.RanksReq - 10, // 13: ctl.CtlSvc.StartRanks:input_type -> ctl.RanksReq - 11, // 14: ctl.CtlSvc.CollectLog:input_type -> ctl.CollectLogReq - 12, // 15: ctl.CtlSvc.CheckEngineRepair:input_type -> ctl.CheckEngineActReq - 13, // 16: ctl.CtlSvc.StorageScan:output_type -> ctl.StorageScanResp - 14, // 17: ctl.CtlSvc.StorageFormat:output_type -> ctl.StorageFormatResp - 15, // 18: ctl.CtlSvc.StorageNvmeRebind:output_type -> ctl.NvmeRebindResp - 16, // 19: ctl.CtlSvc.StorageNvmeAddDevice:output_type -> ctl.NvmeAddDeviceResp - 17, // 20: ctl.CtlSvc.NetworkScan:output_type -> ctl.NetworkScanResp - 18, // 21: ctl.CtlSvc.FirmwareQuery:output_type -> ctl.FirmwareQueryResp - 19, // 22: ctl.CtlSvc.FirmwareUpdate:output_type -> ctl.FirmwareUpdateResp - 20, // 23: ctl.CtlSvc.SmdQuery:output_type -> ctl.SmdQueryResp - 21, // 24: ctl.CtlSvc.SmdManage:output_type -> ctl.SmdManageResp - 22, // 25: ctl.CtlSvc.SetEngineLogMasks:output_type -> ctl.SetLogMasksResp - 23, // 26: ctl.CtlSvc.PrepShutdownRanks:output_type -> ctl.RanksResp - 23, // 27: ctl.CtlSvc.StopRanks:output_type -> ctl.RanksResp - 23, // 28: ctl.CtlSvc.ResetFormatRanks:output_type -> ctl.RanksResp - 23, // 29: ctl.CtlSvc.StartRanks:output_type -> ctl.RanksResp - 24, // 30: ctl.CtlSvc.CollectLog:output_type -> ctl.CollectLogResp - 25, // 31: ctl.CtlSvc.CheckEngineRepair:output_type -> ctl.CheckEngineActResp - 16, // [16:32] is the sub-list for method output_type - 0, // [0:16] is the sub-list for method input_type + 5, // 5: ctl.CtlSvc.SmdQuery:input_type -> ctl.SmdQueryReq + 6, // 6: ctl.CtlSvc.SmdManage:input_type -> ctl.SmdManageReq + 7, // 7: ctl.CtlSvc.SetEngineLogMasks:input_type -> ctl.SetLogMasksReq + 8, // 8: ctl.CtlSvc.PrepShutdownRanks:input_type -> ctl.RanksReq + 8, // 9: ctl.CtlSvc.StopRanks:input_type -> ctl.RanksReq + 8, // 10: ctl.CtlSvc.ResetFormatRanks:input_type -> ctl.RanksReq + 8, // 11: ctl.CtlSvc.StartRanks:input_type -> ctl.RanksReq + 9, // 12: ctl.CtlSvc.CollectLog:input_type -> ctl.CollectLogReq + 10, // 13: ctl.CtlSvc.CheckEngineRepair:input_type -> ctl.CheckEngineActReq + 11, // 14: ctl.CtlSvc.StorageScan:output_type -> ctl.StorageScanResp + 12, // 15: ctl.CtlSvc.StorageFormat:output_type -> ctl.StorageFormatResp + 13, // 16: ctl.CtlSvc.StorageNvmeRebind:output_type -> ctl.NvmeRebindResp + 14, // 17: ctl.CtlSvc.StorageNvmeAddDevice:output_type -> ctl.NvmeAddDeviceResp + 15, // 18: ctl.CtlSvc.NetworkScan:output_type -> ctl.NetworkScanResp + 16, // 19: ctl.CtlSvc.SmdQuery:output_type -> ctl.SmdQueryResp + 17, // 20: ctl.CtlSvc.SmdManage:output_type -> ctl.SmdManageResp + 18, // 21: ctl.CtlSvc.SetEngineLogMasks:output_type -> ctl.SetLogMasksResp + 19, // 22: ctl.CtlSvc.PrepShutdownRanks:output_type -> ctl.RanksResp + 19, // 23: ctl.CtlSvc.StopRanks:output_type -> ctl.RanksResp + 19, // 24: ctl.CtlSvc.ResetFormatRanks:output_type -> ctl.RanksResp + 19, // 25: ctl.CtlSvc.StartRanks:output_type -> ctl.RanksResp + 20, // 26: ctl.CtlSvc.CollectLog:output_type -> ctl.CollectLogResp + 21, // 27: ctl.CtlSvc.CheckEngineRepair:output_type -> ctl.CheckEngineActResp + 14, // [14:28] is the sub-list for method output_type + 0, // [0:14] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -181,7 +117,6 @@ func file_ctl_ctl_proto_init() { } file_ctl_storage_proto_init() file_ctl_network_proto_init() - file_ctl_firmware_proto_init() file_ctl_smd_proto_init() file_ctl_ranks_proto_init() file_ctl_server_proto_init() @@ -191,7 +126,7 @@ func file_ctl_ctl_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_ctl_ctl_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_ctl_ctl_proto_rawDesc), len(file_ctl_ctl_proto_rawDesc)), NumEnums: 0, NumMessages: 0, NumExtensions: 0, @@ -201,7 +136,6 @@ func file_ctl_ctl_proto_init() { DependencyIndexes: file_ctl_ctl_proto_depIdxs, }.Build() File_ctl_ctl_proto = out.File - file_ctl_ctl_proto_rawDesc = nil file_ctl_ctl_proto_goTypes = nil file_ctl_ctl_proto_depIdxs = nil } diff --git a/src/control/common/proto/ctl/ctl_grpc.pb.go b/src/control/common/proto/ctl/ctl_grpc.pb.go index ce6471a1619..e30763d47b3 100644 --- a/src/control/common/proto/ctl/ctl_grpc.pb.go +++ b/src/control/common/proto/ctl/ctl_grpc.pb.go @@ -7,7 +7,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.6.2 // - protoc v3.14.0 // source: ctl/ctl.proto @@ -31,8 +31,6 @@ const ( CtlSvc_StorageNvmeRebind_FullMethodName = "/ctl.CtlSvc/StorageNvmeRebind" CtlSvc_StorageNvmeAddDevice_FullMethodName = "/ctl.CtlSvc/StorageNvmeAddDevice" CtlSvc_NetworkScan_FullMethodName = "/ctl.CtlSvc/NetworkScan" - CtlSvc_FirmwareQuery_FullMethodName = "/ctl.CtlSvc/FirmwareQuery" - CtlSvc_FirmwareUpdate_FullMethodName = "/ctl.CtlSvc/FirmwareUpdate" CtlSvc_SmdQuery_FullMethodName = "/ctl.CtlSvc/SmdQuery" CtlSvc_SmdManage_FullMethodName = "/ctl.CtlSvc/SmdManage" CtlSvc_SetEngineLogMasks_FullMethodName = "/ctl.CtlSvc/SetEngineLogMasks" @@ -64,10 +62,6 @@ type CtlSvcClient interface { StorageNvmeAddDevice(ctx context.Context, in *NvmeAddDeviceReq, opts ...grpc.CallOption) (*NvmeAddDeviceResp, error) // Perform a fabric scan to determine the available provider, device, NUMA node combinations NetworkScan(ctx context.Context, in *NetworkScanReq, opts ...grpc.CallOption) (*NetworkScanResp, error) - // Retrieve firmware details from storage devices on server - FirmwareQuery(ctx context.Context, in *FirmwareQueryReq, opts ...grpc.CallOption) (*FirmwareQueryResp, error) - // Update firmware on storage devices on server - FirmwareUpdate(ctx context.Context, in *FirmwareUpdateReq, opts ...grpc.CallOption) (*FirmwareUpdateResp, error) // Query the per-server metadata SmdQuery(ctx context.Context, in *SmdQueryReq, opts ...grpc.CallOption) (*SmdQueryResp, error) // Manage devices (per-server) identified in SMD table @@ -146,26 +140,6 @@ func (c *ctlSvcClient) NetworkScan(ctx context.Context, in *NetworkScanReq, opts return out, nil } -func (c *ctlSvcClient) FirmwareQuery(ctx context.Context, in *FirmwareQueryReq, opts ...grpc.CallOption) (*FirmwareQueryResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(FirmwareQueryResp) - err := c.cc.Invoke(ctx, CtlSvc_FirmwareQuery_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *ctlSvcClient) FirmwareUpdate(ctx context.Context, in *FirmwareUpdateReq, opts ...grpc.CallOption) (*FirmwareUpdateResp, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(FirmwareUpdateResp) - err := c.cc.Invoke(ctx, CtlSvc_FirmwareUpdate_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *ctlSvcClient) SmdQuery(ctx context.Context, in *SmdQueryReq, opts ...grpc.CallOption) (*SmdQueryResp, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SmdQueryResp) @@ -276,10 +250,6 @@ type CtlSvcServer interface { StorageNvmeAddDevice(context.Context, *NvmeAddDeviceReq) (*NvmeAddDeviceResp, error) // Perform a fabric scan to determine the available provider, device, NUMA node combinations NetworkScan(context.Context, *NetworkScanReq) (*NetworkScanResp, error) - // Retrieve firmware details from storage devices on server - FirmwareQuery(context.Context, *FirmwareQueryReq) (*FirmwareQueryResp, error) - // Update firmware on storage devices on server - FirmwareUpdate(context.Context, *FirmwareUpdateReq) (*FirmwareUpdateResp, error) // Query the per-server metadata SmdQuery(context.Context, *SmdQueryReq) (*SmdQueryResp, error) // Manage devices (per-server) identified in SMD table @@ -309,52 +279,46 @@ type CtlSvcServer interface { type UnimplementedCtlSvcServer struct{} func (UnimplementedCtlSvcServer) StorageScan(context.Context, *StorageScanReq) (*StorageScanResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method StorageScan not implemented") + return nil, status.Error(codes.Unimplemented, "method StorageScan not implemented") } func (UnimplementedCtlSvcServer) StorageFormat(context.Context, *StorageFormatReq) (*StorageFormatResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method StorageFormat not implemented") + return nil, status.Error(codes.Unimplemented, "method StorageFormat not implemented") } func (UnimplementedCtlSvcServer) StorageNvmeRebind(context.Context, *NvmeRebindReq) (*NvmeRebindResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method StorageNvmeRebind not implemented") + return nil, status.Error(codes.Unimplemented, "method StorageNvmeRebind not implemented") } func (UnimplementedCtlSvcServer) StorageNvmeAddDevice(context.Context, *NvmeAddDeviceReq) (*NvmeAddDeviceResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method StorageNvmeAddDevice not implemented") + return nil, status.Error(codes.Unimplemented, "method StorageNvmeAddDevice not implemented") } func (UnimplementedCtlSvcServer) NetworkScan(context.Context, *NetworkScanReq) (*NetworkScanResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method NetworkScan not implemented") -} -func (UnimplementedCtlSvcServer) FirmwareQuery(context.Context, *FirmwareQueryReq) (*FirmwareQueryResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method FirmwareQuery not implemented") -} -func (UnimplementedCtlSvcServer) FirmwareUpdate(context.Context, *FirmwareUpdateReq) (*FirmwareUpdateResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method FirmwareUpdate not implemented") + return nil, status.Error(codes.Unimplemented, "method NetworkScan not implemented") } func (UnimplementedCtlSvcServer) SmdQuery(context.Context, *SmdQueryReq) (*SmdQueryResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method SmdQuery not implemented") + return nil, status.Error(codes.Unimplemented, "method SmdQuery not implemented") } func (UnimplementedCtlSvcServer) SmdManage(context.Context, *SmdManageReq) (*SmdManageResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method SmdManage not implemented") + return nil, status.Error(codes.Unimplemented, "method SmdManage not implemented") } func (UnimplementedCtlSvcServer) SetEngineLogMasks(context.Context, *SetLogMasksReq) (*SetLogMasksResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetEngineLogMasks not implemented") + return nil, status.Error(codes.Unimplemented, "method SetEngineLogMasks not implemented") } func (UnimplementedCtlSvcServer) PrepShutdownRanks(context.Context, *RanksReq) (*RanksResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method PrepShutdownRanks not implemented") + return nil, status.Error(codes.Unimplemented, "method PrepShutdownRanks not implemented") } func (UnimplementedCtlSvcServer) StopRanks(context.Context, *RanksReq) (*RanksResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method StopRanks not implemented") + return nil, status.Error(codes.Unimplemented, "method StopRanks not implemented") } func (UnimplementedCtlSvcServer) ResetFormatRanks(context.Context, *RanksReq) (*RanksResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method ResetFormatRanks not implemented") + return nil, status.Error(codes.Unimplemented, "method ResetFormatRanks not implemented") } func (UnimplementedCtlSvcServer) StartRanks(context.Context, *RanksReq) (*RanksResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method StartRanks not implemented") + return nil, status.Error(codes.Unimplemented, "method StartRanks not implemented") } func (UnimplementedCtlSvcServer) CollectLog(context.Context, *CollectLogReq) (*CollectLogResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method CollectLog not implemented") + return nil, status.Error(codes.Unimplemented, "method CollectLog not implemented") } func (UnimplementedCtlSvcServer) CheckEngineRepair(context.Context, *CheckEngineActReq) (*CheckEngineActResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method CheckEngineRepair not implemented") + return nil, status.Error(codes.Unimplemented, "method CheckEngineRepair not implemented") } func (UnimplementedCtlSvcServer) mustEmbedUnimplementedCtlSvcServer() {} func (UnimplementedCtlSvcServer) testEmbeddedByValue() {} @@ -367,7 +331,7 @@ type UnsafeCtlSvcServer interface { } func RegisterCtlSvcServer(s grpc.ServiceRegistrar, srv CtlSvcServer) { - // If the following call pancis, it indicates UnimplementedCtlSvcServer was + // If the following call panics, it indicates UnimplementedCtlSvcServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. @@ -467,42 +431,6 @@ func _CtlSvc_NetworkScan_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } -func _CtlSvc_FirmwareQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FirmwareQueryReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CtlSvcServer).FirmwareQuery(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CtlSvc_FirmwareQuery_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CtlSvcServer).FirmwareQuery(ctx, req.(*FirmwareQueryReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _CtlSvc_FirmwareUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FirmwareUpdateReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CtlSvcServer).FirmwareUpdate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CtlSvc_FirmwareUpdate_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CtlSvcServer).FirmwareUpdate(ctx, req.(*FirmwareUpdateReq)) - } - return interceptor(ctx, in, info, handler) -} - func _CtlSvc_SmdQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SmdQueryReq) if err := dec(in); err != nil { @@ -692,14 +620,6 @@ var CtlSvc_ServiceDesc = grpc.ServiceDesc{ MethodName: "NetworkScan", Handler: _CtlSvc_NetworkScan_Handler, }, - { - MethodName: "FirmwareQuery", - Handler: _CtlSvc_FirmwareQuery_Handler, - }, - { - MethodName: "FirmwareUpdate", - Handler: _CtlSvc_FirmwareUpdate_Handler, - }, { MethodName: "SmdQuery", Handler: _CtlSvc_SmdQuery_Handler, diff --git a/src/control/common/proto/ctl/firmware.pb.go b/src/control/common/proto/ctl/firmware.pb.go deleted file mode 100644 index 8cc8c8d49de..00000000000 --- a/src/control/common/proto/ctl/firmware.pb.go +++ /dev/null @@ -1,841 +0,0 @@ -// -// (C) Copyright 2020-2021 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.1 -// protoc v3.5.0 -// source: ctl/firmware.proto - -package ctl - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type FirmwareUpdateReq_DeviceType int32 - -const ( - FirmwareUpdateReq_SCM FirmwareUpdateReq_DeviceType = 0 - FirmwareUpdateReq_NVMe FirmwareUpdateReq_DeviceType = 1 -) - -// Enum value maps for FirmwareUpdateReq_DeviceType. -var ( - FirmwareUpdateReq_DeviceType_name = map[int32]string{ - 0: "SCM", - 1: "NVMe", - } - FirmwareUpdateReq_DeviceType_value = map[string]int32{ - "SCM": 0, - "NVMe": 1, - } -) - -func (x FirmwareUpdateReq_DeviceType) Enum() *FirmwareUpdateReq_DeviceType { - p := new(FirmwareUpdateReq_DeviceType) - *p = x - return p -} - -func (x FirmwareUpdateReq_DeviceType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (FirmwareUpdateReq_DeviceType) Descriptor() protoreflect.EnumDescriptor { - return file_ctl_firmware_proto_enumTypes[0].Descriptor() -} - -func (FirmwareUpdateReq_DeviceType) Type() protoreflect.EnumType { - return &file_ctl_firmware_proto_enumTypes[0] -} - -func (x FirmwareUpdateReq_DeviceType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use FirmwareUpdateReq_DeviceType.Descriptor instead. -func (FirmwareUpdateReq_DeviceType) EnumDescriptor() ([]byte, []int) { - return file_ctl_firmware_proto_rawDescGZIP(), []int{4, 0} -} - -type FirmwareQueryReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - QueryScm bool `protobuf:"varint,1,opt,name=queryScm,proto3" json:"queryScm,omitempty"` // Should we query SCM devices? - QueryNvme bool `protobuf:"varint,2,opt,name=queryNvme,proto3" json:"queryNvme,omitempty"` // Should we query NVMe devices? - DeviceIDs []string `protobuf:"bytes,3,rep,name=deviceIDs,proto3" json:"deviceIDs,omitempty"` // Filter by specific devices - ModelID string `protobuf:"bytes,4,opt,name=modelID,proto3" json:"modelID,omitempty"` // Filter by model ID - FirmwareRev string `protobuf:"bytes,5,opt,name=firmwareRev,proto3" json:"firmwareRev,omitempty"` // Filter by current firmware revision -} - -func (x *FirmwareQueryReq) Reset() { - *x = FirmwareQueryReq{} - if protoimpl.UnsafeEnabled { - mi := &file_ctl_firmware_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FirmwareQueryReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FirmwareQueryReq) ProtoMessage() {} - -func (x *FirmwareQueryReq) ProtoReflect() protoreflect.Message { - mi := &file_ctl_firmware_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FirmwareQueryReq.ProtoReflect.Descriptor instead. -func (*FirmwareQueryReq) Descriptor() ([]byte, []int) { - return file_ctl_firmware_proto_rawDescGZIP(), []int{0} -} - -func (x *FirmwareQueryReq) GetQueryScm() bool { - if x != nil { - return x.QueryScm - } - return false -} - -func (x *FirmwareQueryReq) GetQueryNvme() bool { - if x != nil { - return x.QueryNvme - } - return false -} - -func (x *FirmwareQueryReq) GetDeviceIDs() []string { - if x != nil { - return x.DeviceIDs - } - return nil -} - -func (x *FirmwareQueryReq) GetModelID() string { - if x != nil { - return x.ModelID - } - return "" -} - -func (x *FirmwareQueryReq) GetFirmwareRev() string { - if x != nil { - return x.FirmwareRev - } - return "" -} - -type ScmFirmwareQueryResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Module *ScmModule `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"` // The module of this firmware - ActiveVersion string `protobuf:"bytes,2,opt,name=activeVersion,proto3" json:"activeVersion,omitempty"` // Active FW version - StagedVersion string `protobuf:"bytes,3,opt,name=stagedVersion,proto3" json:"stagedVersion,omitempty"` // Staged FW version - ImageMaxSizeBytes uint32 `protobuf:"varint,4,opt,name=imageMaxSizeBytes,proto3" json:"imageMaxSizeBytes,omitempty"` // Maximum size of FW image accepted - UpdateStatus uint32 `protobuf:"varint,5,opt,name=updateStatus,proto3" json:"updateStatus,omitempty"` // Status of FW update - Error string `protobuf:"bytes,6,opt,name=error,proto3" json:"error,omitempty"` // Error string, if any -} - -func (x *ScmFirmwareQueryResp) Reset() { - *x = ScmFirmwareQueryResp{} - if protoimpl.UnsafeEnabled { - mi := &file_ctl_firmware_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ScmFirmwareQueryResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ScmFirmwareQueryResp) ProtoMessage() {} - -func (x *ScmFirmwareQueryResp) ProtoReflect() protoreflect.Message { - mi := &file_ctl_firmware_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ScmFirmwareQueryResp.ProtoReflect.Descriptor instead. -func (*ScmFirmwareQueryResp) Descriptor() ([]byte, []int) { - return file_ctl_firmware_proto_rawDescGZIP(), []int{1} -} - -func (x *ScmFirmwareQueryResp) GetModule() *ScmModule { - if x != nil { - return x.Module - } - return nil -} - -func (x *ScmFirmwareQueryResp) GetActiveVersion() string { - if x != nil { - return x.ActiveVersion - } - return "" -} - -func (x *ScmFirmwareQueryResp) GetStagedVersion() string { - if x != nil { - return x.StagedVersion - } - return "" -} - -func (x *ScmFirmwareQueryResp) GetImageMaxSizeBytes() uint32 { - if x != nil { - return x.ImageMaxSizeBytes - } - return 0 -} - -func (x *ScmFirmwareQueryResp) GetUpdateStatus() uint32 { - if x != nil { - return x.UpdateStatus - } - return 0 -} - -func (x *ScmFirmwareQueryResp) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -type NvmeFirmwareQueryResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Device *NvmeController `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"` // Controller information includes FW rev -} - -func (x *NvmeFirmwareQueryResp) Reset() { - *x = NvmeFirmwareQueryResp{} - if protoimpl.UnsafeEnabled { - mi := &file_ctl_firmware_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NvmeFirmwareQueryResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NvmeFirmwareQueryResp) ProtoMessage() {} - -func (x *NvmeFirmwareQueryResp) ProtoReflect() protoreflect.Message { - mi := &file_ctl_firmware_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NvmeFirmwareQueryResp.ProtoReflect.Descriptor instead. -func (*NvmeFirmwareQueryResp) Descriptor() ([]byte, []int) { - return file_ctl_firmware_proto_rawDescGZIP(), []int{2} -} - -func (x *NvmeFirmwareQueryResp) GetDevice() *NvmeController { - if x != nil { - return x.Device - } - return nil -} - -type FirmwareQueryResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ScmResults []*ScmFirmwareQueryResp `protobuf:"bytes,1,rep,name=scmResults,proto3" json:"scmResults,omitempty"` - NvmeResults []*NvmeFirmwareQueryResp `protobuf:"bytes,2,rep,name=nvmeResults,proto3" json:"nvmeResults,omitempty"` -} - -func (x *FirmwareQueryResp) Reset() { - *x = FirmwareQueryResp{} - if protoimpl.UnsafeEnabled { - mi := &file_ctl_firmware_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FirmwareQueryResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FirmwareQueryResp) ProtoMessage() {} - -func (x *FirmwareQueryResp) ProtoReflect() protoreflect.Message { - mi := &file_ctl_firmware_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FirmwareQueryResp.ProtoReflect.Descriptor instead. -func (*FirmwareQueryResp) Descriptor() ([]byte, []int) { - return file_ctl_firmware_proto_rawDescGZIP(), []int{3} -} - -func (x *FirmwareQueryResp) GetScmResults() []*ScmFirmwareQueryResp { - if x != nil { - return x.ScmResults - } - return nil -} - -func (x *FirmwareQueryResp) GetNvmeResults() []*NvmeFirmwareQueryResp { - if x != nil { - return x.NvmeResults - } - return nil -} - -type FirmwareUpdateReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - FirmwarePath string `protobuf:"bytes,1,opt,name=firmwarePath,proto3" json:"firmwarePath,omitempty"` // Path to firmware file - Type FirmwareUpdateReq_DeviceType `protobuf:"varint,2,opt,name=type,proto3,enum=ctl.FirmwareUpdateReq_DeviceType" json:"type,omitempty"` // Type of device this firmware applies to - DeviceIDs []string `protobuf:"bytes,3,rep,name=deviceIDs,proto3" json:"deviceIDs,omitempty"` // Devices this update applies to - ModelID string `protobuf:"bytes,4,opt,name=modelID,proto3" json:"modelID,omitempty"` // Model ID this update applies to - FirmwareRev string `protobuf:"bytes,5,opt,name=firmwareRev,proto3" json:"firmwareRev,omitempty"` // Starting FW rev this update applies to -} - -func (x *FirmwareUpdateReq) Reset() { - *x = FirmwareUpdateReq{} - if protoimpl.UnsafeEnabled { - mi := &file_ctl_firmware_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FirmwareUpdateReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FirmwareUpdateReq) ProtoMessage() {} - -func (x *FirmwareUpdateReq) ProtoReflect() protoreflect.Message { - mi := &file_ctl_firmware_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FirmwareUpdateReq.ProtoReflect.Descriptor instead. -func (*FirmwareUpdateReq) Descriptor() ([]byte, []int) { - return file_ctl_firmware_proto_rawDescGZIP(), []int{4} -} - -func (x *FirmwareUpdateReq) GetFirmwarePath() string { - if x != nil { - return x.FirmwarePath - } - return "" -} - -func (x *FirmwareUpdateReq) GetType() FirmwareUpdateReq_DeviceType { - if x != nil { - return x.Type - } - return FirmwareUpdateReq_SCM -} - -func (x *FirmwareUpdateReq) GetDeviceIDs() []string { - if x != nil { - return x.DeviceIDs - } - return nil -} - -func (x *FirmwareUpdateReq) GetModelID() string { - if x != nil { - return x.ModelID - } - return "" -} - -func (x *FirmwareUpdateReq) GetFirmwareRev() string { - if x != nil { - return x.FirmwareRev - } - return "" -} - -type ScmFirmwareUpdateResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Module *ScmModule `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"` // SCM device - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` // empty if successful -} - -func (x *ScmFirmwareUpdateResp) Reset() { - *x = ScmFirmwareUpdateResp{} - if protoimpl.UnsafeEnabled { - mi := &file_ctl_firmware_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ScmFirmwareUpdateResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ScmFirmwareUpdateResp) ProtoMessage() {} - -func (x *ScmFirmwareUpdateResp) ProtoReflect() protoreflect.Message { - mi := &file_ctl_firmware_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ScmFirmwareUpdateResp.ProtoReflect.Descriptor instead. -func (*ScmFirmwareUpdateResp) Descriptor() ([]byte, []int) { - return file_ctl_firmware_proto_rawDescGZIP(), []int{5} -} - -func (x *ScmFirmwareUpdateResp) GetModule() *ScmModule { - if x != nil { - return x.Module - } - return nil -} - -func (x *ScmFirmwareUpdateResp) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -type NvmeFirmwareUpdateResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PciAddr string `protobuf:"bytes,1,opt,name=pciAddr,proto3" json:"pciAddr,omitempty"` // PCI address of the NVMe device - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` // empty if successful -} - -func (x *NvmeFirmwareUpdateResp) Reset() { - *x = NvmeFirmwareUpdateResp{} - if protoimpl.UnsafeEnabled { - mi := &file_ctl_firmware_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NvmeFirmwareUpdateResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NvmeFirmwareUpdateResp) ProtoMessage() {} - -func (x *NvmeFirmwareUpdateResp) ProtoReflect() protoreflect.Message { - mi := &file_ctl_firmware_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NvmeFirmwareUpdateResp.ProtoReflect.Descriptor instead. -func (*NvmeFirmwareUpdateResp) Descriptor() ([]byte, []int) { - return file_ctl_firmware_proto_rawDescGZIP(), []int{6} -} - -func (x *NvmeFirmwareUpdateResp) GetPciAddr() string { - if x != nil { - return x.PciAddr - } - return "" -} - -func (x *NvmeFirmwareUpdateResp) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -type FirmwareUpdateResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ScmResults []*ScmFirmwareUpdateResp `protobuf:"bytes,1,rep,name=scmResults,proto3" json:"scmResults,omitempty"` // results for SCM update - NvmeResults []*NvmeFirmwareUpdateResp `protobuf:"bytes,2,rep,name=nvmeResults,proto3" json:"nvmeResults,omitempty"` // results for NVMe update -} - -func (x *FirmwareUpdateResp) Reset() { - *x = FirmwareUpdateResp{} - if protoimpl.UnsafeEnabled { - mi := &file_ctl_firmware_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FirmwareUpdateResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FirmwareUpdateResp) ProtoMessage() {} - -func (x *FirmwareUpdateResp) ProtoReflect() protoreflect.Message { - mi := &file_ctl_firmware_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FirmwareUpdateResp.ProtoReflect.Descriptor instead. -func (*FirmwareUpdateResp) Descriptor() ([]byte, []int) { - return file_ctl_firmware_proto_rawDescGZIP(), []int{7} -} - -func (x *FirmwareUpdateResp) GetScmResults() []*ScmFirmwareUpdateResp { - if x != nil { - return x.ScmResults - } - return nil -} - -func (x *FirmwareUpdateResp) GetNvmeResults() []*NvmeFirmwareUpdateResp { - if x != nil { - return x.NvmeResults - } - return nil -} - -var File_ctl_firmware_proto protoreflect.FileDescriptor - -var file_ctl_firmware_proto_rawDesc = []byte{ - 0x0a, 0x12, 0x63, 0x74, 0x6c, 0x2f, 0x66, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x63, 0x74, 0x6c, 0x1a, 0x15, 0x63, 0x74, 0x6c, 0x2f, 0x73, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x63, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x0d, 0x63, 0x74, 0x6c, 0x2f, 0x73, 0x6d, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0xa6, 0x01, 0x0a, 0x10, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x65, 0x72, 0x79, 0x53, 0x63, 0x6d, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x71, 0x75, 0x65, 0x72, 0x79, 0x53, 0x63, 0x6d, - 0x12, 0x1c, 0x0a, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x4e, 0x76, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x4e, 0x76, 0x6d, 0x65, 0x12, 0x1c, - 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x44, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x44, 0x73, 0x12, 0x18, 0x0a, 0x07, - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, - 0x6f, 0x64, 0x65, 0x6c, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x66, 0x69, 0x72, 0x6d, 0x77, 0x61, - 0x72, 0x65, 0x52, 0x65, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x66, 0x69, 0x72, - 0x6d, 0x77, 0x61, 0x72, 0x65, 0x52, 0x65, 0x76, 0x22, 0xf2, 0x01, 0x0a, 0x14, 0x53, 0x63, 0x6d, - 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x26, 0x0a, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x53, 0x63, 0x6d, 0x4d, 0x6f, 0x64, 0x75, 0x6c, - 0x65, 0x52, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x63, 0x74, - 0x69, 0x76, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x24, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x67, 0x65, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x67, 0x65, 0x64, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x0a, 0x11, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4d, 0x61, - 0x78, 0x53, 0x69, 0x7a, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x11, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x42, 0x79, - 0x74, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x44, 0x0a, - 0x15, 0x4e, 0x76, 0x6d, 0x65, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2b, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x4e, 0x76, 0x6d, - 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x52, 0x06, 0x64, 0x65, 0x76, - 0x69, 0x63, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x11, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x39, 0x0a, 0x0a, 0x73, 0x63, 0x6d, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x63, 0x74, 0x6c, 0x2e, 0x53, 0x63, 0x6d, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x52, 0x0a, 0x73, 0x63, 0x6d, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x73, 0x12, 0x3c, 0x0a, 0x0b, 0x6e, 0x76, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x74, 0x6c, 0x2e, - 0x4e, 0x76, 0x6d, 0x65, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x52, 0x65, 0x73, 0x70, 0x52, 0x0b, 0x6e, 0x76, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x73, 0x22, 0xe9, 0x01, 0x0a, 0x11, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x66, 0x69, 0x72, 0x6d, - 0x77, 0x61, 0x72, 0x65, 0x50, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, - 0x66, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x35, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x63, 0x74, 0x6c, - 0x2e, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x71, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x44, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x44, - 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x66, - 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x52, 0x65, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x66, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x52, 0x65, 0x76, 0x22, 0x1f, 0x0a, - 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x53, - 0x43, 0x4d, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x56, 0x4d, 0x65, 0x10, 0x01, 0x22, 0x55, - 0x0a, 0x15, 0x53, 0x63, 0x6d, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x53, 0x63, - 0x6d, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, - 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x48, 0x0a, 0x16, 0x4e, 0x76, 0x6d, 0x65, 0x46, 0x69, 0x72, - 0x6d, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, - 0x18, 0x0a, 0x07, 0x70, 0x63, 0x69, 0x41, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x70, 0x63, 0x69, 0x41, 0x64, 0x64, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, - 0x8f, 0x01, 0x0a, 0x12, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3a, 0x0a, 0x0a, 0x73, 0x63, 0x6d, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x74, 0x6c, - 0x2e, 0x53, 0x63, 0x6d, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x52, 0x0a, 0x73, 0x63, 0x6d, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x73, 0x12, 0x3d, 0x0a, 0x0b, 0x6e, 0x76, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x4e, 0x76, - 0x6d, 0x65, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x52, 0x0b, 0x6e, 0x76, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x73, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x64, 0x61, 0x6f, 0x73, 0x2d, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x64, 0x61, 0x6f, 0x73, 0x2f, - 0x73, 0x72, 0x63, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x74, 0x6c, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_ctl_firmware_proto_rawDescOnce sync.Once - file_ctl_firmware_proto_rawDescData = file_ctl_firmware_proto_rawDesc -) - -func file_ctl_firmware_proto_rawDescGZIP() []byte { - file_ctl_firmware_proto_rawDescOnce.Do(func() { - file_ctl_firmware_proto_rawDescData = protoimpl.X.CompressGZIP(file_ctl_firmware_proto_rawDescData) - }) - return file_ctl_firmware_proto_rawDescData -} - -var file_ctl_firmware_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_ctl_firmware_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_ctl_firmware_proto_goTypes = []interface{}{ - (FirmwareUpdateReq_DeviceType)(0), // 0: ctl.FirmwareUpdateReq.DeviceType - (*FirmwareQueryReq)(nil), // 1: ctl.FirmwareQueryReq - (*ScmFirmwareQueryResp)(nil), // 2: ctl.ScmFirmwareQueryResp - (*NvmeFirmwareQueryResp)(nil), // 3: ctl.NvmeFirmwareQueryResp - (*FirmwareQueryResp)(nil), // 4: ctl.FirmwareQueryResp - (*FirmwareUpdateReq)(nil), // 5: ctl.FirmwareUpdateReq - (*ScmFirmwareUpdateResp)(nil), // 6: ctl.ScmFirmwareUpdateResp - (*NvmeFirmwareUpdateResp)(nil), // 7: ctl.NvmeFirmwareUpdateResp - (*FirmwareUpdateResp)(nil), // 8: ctl.FirmwareUpdateResp - (*ScmModule)(nil), // 9: ctl.ScmModule - (*NvmeController)(nil), // 10: ctl.NvmeController -} -var file_ctl_firmware_proto_depIdxs = []int32{ - 9, // 0: ctl.ScmFirmwareQueryResp.module:type_name -> ctl.ScmModule - 10, // 1: ctl.NvmeFirmwareQueryResp.device:type_name -> ctl.NvmeController - 2, // 2: ctl.FirmwareQueryResp.scmResults:type_name -> ctl.ScmFirmwareQueryResp - 3, // 3: ctl.FirmwareQueryResp.nvmeResults:type_name -> ctl.NvmeFirmwareQueryResp - 0, // 4: ctl.FirmwareUpdateReq.type:type_name -> ctl.FirmwareUpdateReq.DeviceType - 9, // 5: ctl.ScmFirmwareUpdateResp.module:type_name -> ctl.ScmModule - 6, // 6: ctl.FirmwareUpdateResp.scmResults:type_name -> ctl.ScmFirmwareUpdateResp - 7, // 7: ctl.FirmwareUpdateResp.nvmeResults:type_name -> ctl.NvmeFirmwareUpdateResp - 8, // [8:8] is the sub-list for method output_type - 8, // [8:8] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name -} - -func init() { file_ctl_firmware_proto_init() } -func file_ctl_firmware_proto_init() { - if File_ctl_firmware_proto != nil { - return - } - file_ctl_storage_scm_proto_init() - file_ctl_smd_proto_init() - if !protoimpl.UnsafeEnabled { - file_ctl_firmware_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FirmwareQueryReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_ctl_firmware_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ScmFirmwareQueryResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_ctl_firmware_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NvmeFirmwareQueryResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_ctl_firmware_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FirmwareQueryResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_ctl_firmware_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FirmwareUpdateReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_ctl_firmware_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ScmFirmwareUpdateResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_ctl_firmware_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NvmeFirmwareUpdateResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_ctl_firmware_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FirmwareUpdateResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_ctl_firmware_proto_rawDesc, - NumEnums: 1, - NumMessages: 8, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_ctl_firmware_proto_goTypes, - DependencyIndexes: file_ctl_firmware_proto_depIdxs, - EnumInfos: file_ctl_firmware_proto_enumTypes, - MessageInfos: file_ctl_firmware_proto_msgTypes, - }.Build() - File_ctl_firmware_proto = out.File - file_ctl_firmware_proto_rawDesc = nil - file_ctl_firmware_proto_goTypes = nil - file_ctl_firmware_proto_depIdxs = nil -} diff --git a/src/control/lib/control/firmware.go b/src/control/lib/control/firmware.go deleted file mode 100644 index 81437693922..00000000000 --- a/src/control/lib/control/firmware.go +++ /dev/null @@ -1,389 +0,0 @@ -// -// (C) Copyright 2020-2021 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -package control - -import ( - "context" - "fmt" - "sort" - - "github.com/pkg/errors" - "google.golang.org/grpc" - "google.golang.org/protobuf/proto" - - "github.com/daos-stack/daos/src/control/common/proto/convert" - ctlpb "github.com/daos-stack/daos/src/control/common/proto/ctl" - "github.com/daos-stack/daos/src/control/server/storage" -) - -type ( - // FirmwareQueryReq is a request for firmware information for storage - // devices. - FirmwareQueryReq struct { - unaryRequest - SCM bool // Query SCM devices - NVMe bool // Query NVMe devices - Devices []string // Specific devices to query - ModelID string // Filter by model ID - FirmwareRev string // Filter by current FW revision - } - - // FirmwareQueryResp returns storage device firmware information. - FirmwareQueryResp struct { - HostErrorsResp - HostSCMFirmware HostSCMQueryMap - HostNVMeFirmware HostNVMeQueryMap - } - - // HostSCMQueryMap maps a host name to a slice of SCM firmware query results. - HostSCMQueryMap map[string][]*SCMQueryResult - - // SCMFirmwareResult represents the results of a firmware query - // for a single SCM device. - SCMQueryResult struct { - Module storage.ScmModule - Info *storage.ScmFirmwareInfo - Error error - } - - // HostNVMeQueryMap maps a host name to a slice of NVMe firmware query results. - HostNVMeQueryMap map[string][]*NVMeQueryResult - - // NVMeQueryResult represents the results of a firmware query for a - // single NVMe device. - NVMeQueryResult struct { - Device storage.NvmeController - } -) - -// Keys returns the sorted list of keys from the HostSCMQueryMap. -func (m HostSCMQueryMap) Keys() []string { - keys := make([]string, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - return keys -} - -// Keys returns the sorted list of keys from the HostNVMeQueryMap. -func (m HostNVMeQueryMap) Keys() []string { - keys := make([]string, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - return keys -} - -// addHostResponse is responsible for validating the given HostResponse -// and adding it to the FirmwareQueryResp. -func (qr *FirmwareQueryResp) addHostResponse(hr *HostResponse, req *FirmwareQueryReq) error { - pbResp, ok := hr.Message.(*ctlpb.FirmwareQueryResp) - if !ok { - return errors.Errorf("unable to unpack message: %+v", hr.Message) - } - - if req.SCM { - if qr.HostSCMFirmware == nil { - qr.HostSCMFirmware = make(HostSCMQueryMap) - } - scmResp, err := qr.getSCMResponse(pbResp) - if err != nil { - return err - } - - qr.HostSCMFirmware[hr.Addr] = scmResp - } - - if req.NVMe { - if qr.HostNVMeFirmware == nil { - qr.HostNVMeFirmware = make(HostNVMeQueryMap) - } - nvmeResp, err := qr.getNVMeResponse(pbResp) - if err != nil { - return err - } - - qr.HostNVMeFirmware[hr.Addr] = nvmeResp - } - - return nil -} - -func (qr *FirmwareQueryResp) getSCMResponse(pbResp *ctlpb.FirmwareQueryResp) ([]*SCMQueryResult, error) { - scmResults := make([]*SCMQueryResult, 0, len(pbResp.ScmResults)) - - for _, pbScmRes := range pbResp.ScmResults { - devResult := &SCMQueryResult{ - Info: &storage.ScmFirmwareInfo{ - ActiveVersion: pbScmRes.ActiveVersion, - StagedVersion: pbScmRes.StagedVersion, - ImageMaxSizeBytes: pbScmRes.ImageMaxSizeBytes, - UpdateStatus: storage.ScmFirmwareUpdateStatus(pbScmRes.UpdateStatus), - }, - } - if err := convert.Types(pbScmRes.Module, &devResult.Module); err != nil { - return nil, errors.Wrapf(err, "unable to convert module") - } - if pbScmRes.Error != "" { - devResult.Error = errors.New(pbScmRes.Error) - } - scmResults = append(scmResults, devResult) - } - - return scmResults, nil -} - -func (qr *FirmwareQueryResp) getNVMeResponse(pbResp *ctlpb.FirmwareQueryResp) ([]*NVMeQueryResult, error) { - nvmeResults := make([]*NVMeQueryResult, 0, len(pbResp.NvmeResults)) - - for _, pbNvmeRes := range pbResp.NvmeResults { - devResult := &NVMeQueryResult{} - if err := convert.Types(pbNvmeRes.Device, &devResult.Device); err != nil { - return nil, errors.Wrapf(err, "unable to convert device") - } - nvmeResults = append(nvmeResults, devResult) - } - - return nvmeResults, nil -} - -// FirmwareQuery concurrently requests device firmware information from -// all hosts supplied in the request's hostlist, or all configured hosts -// if not explicitly specified. The function blocks until all results -// (successful or otherwise) are received, and returns a single response -// structure containing results for all host firmware query operations. -func FirmwareQuery(ctx context.Context, rpcClient UnaryInvoker, req *FirmwareQueryReq) (*FirmwareQueryResp, error) { - if !req.SCM && !req.NVMe { - return nil, errors.New("no device types requested") - } - - req.setRPC(func(ctx context.Context, conn *grpc.ClientConn) (proto.Message, error) { - return ctlpb.NewCtlSvcClient(conn).FirmwareQuery(ctx, &ctlpb.FirmwareQueryReq{ - QueryScm: req.SCM, - QueryNvme: req.NVMe, - DeviceIDs: req.Devices, - ModelID: req.ModelID, - FirmwareRev: req.FirmwareRev, - }) - }) - - unaryResp, err := rpcClient.InvokeUnaryRPC(ctx, req) - if err != nil { - return nil, err - } - - resp := new(FirmwareQueryResp) - for _, hostResp := range unaryResp.Responses { - if hostResp.Error != nil { - if err := resp.addHostError(hostResp.Addr, hostResp.Error); err != nil { - return nil, err - } - continue - } - - if err := resp.addHostResponse(hostResp, req); err != nil { - return nil, err - } - } - - return resp, nil -} - -type ( - // DeviceType is an enum representing the storage device type. - DeviceType uint32 - - // FirmwareUpdateReq is a request to update firmware for a specific type - // of storage device. - FirmwareUpdateReq struct { - unaryRequest - FirmwarePath string - Type DeviceType - Devices []string // Specific devices to update - ModelID string // Update only devices of specific model - FirmwareRev string // Update only devices with a specific current firmware - - } - - // HostSCMUpdateMap maps a host name to a slice of SCM update results. - HostSCMUpdateMap map[string][]*SCMUpdateResult - - // SCMUpdateResult represents the results of a firmware update - // for a single SCM device. - SCMUpdateResult struct { - Module storage.ScmModule - Error error - } - - // HostNVMeUpdateMap maps a host name to a slice of NVMe update results. - HostNVMeUpdateMap map[string][]*NVMeUpdateResult - - // NVMeUpdateResult represents the results of a firmware update for a - // single NVMe device. - NVMeUpdateResult struct { - DevicePCIAddr string - Error error - } - - // FirmwareUpdateResp returns the results of firmware update operations. - FirmwareUpdateResp struct { - HostErrorsResp - HostSCMResult HostSCMUpdateMap - HostNVMeResult HostNVMeUpdateMap - } -) - -const ( - // DeviceTypeUnknown represents an unspecified device type. - DeviceTypeUnknown DeviceType = iota - // DeviceTypeSCM represents SCM modules. - DeviceTypeSCM - // DeviceTypeNVMe represents NVMe SSDs. - DeviceTypeNVMe -) - -func (t DeviceType) toCtlPBType() (ctlpb.FirmwareUpdateReq_DeviceType, error) { - switch t { - case DeviceTypeSCM: - return ctlpb.FirmwareUpdateReq_SCM, nil - case DeviceTypeNVMe: - return ctlpb.FirmwareUpdateReq_NVMe, nil - } - - return ctlpb.FirmwareUpdateReq_DeviceType(-1), - fmt.Errorf("invalid device type %d", uint32(t)) -} - -func (ur *FirmwareUpdateResp) addHostResponse(hr *HostResponse) error { - pbResp, ok := hr.Message.(*ctlpb.FirmwareUpdateResp) - if !ok { - return errors.Errorf("unable to unpack message: %+v", hr.Message) - } - - err := ur.addHostSCMResults(hr.Addr, pbResp) - if err != nil { - return err - } - - return ur.addHostNVMeResults(hr.Addr, pbResp) -} - -func (ur *FirmwareUpdateResp) addHostSCMResults(hostAddr string, pbResp *ctlpb.FirmwareUpdateResp) error { - if len(pbResp.ScmResults) > 0 { - if ur.HostSCMResult == nil { - ur.HostSCMResult = make(HostSCMUpdateMap) - } - - scmResults := make([]*SCMUpdateResult, 0, len(pbResp.ScmResults)) - - for _, pbRes := range pbResp.ScmResults { - devResult := &SCMUpdateResult{} - if err := convert.Types(pbRes.Module, &devResult.Module); err != nil { - return errors.Wrapf(err, "unable to convert module") - } - if pbRes.Error != "" { - devResult.Error = errors.New(pbRes.Error) - } - scmResults = append(scmResults, devResult) - } - - ur.HostSCMResult[hostAddr] = scmResults - } - - return nil -} - -func (ur *FirmwareUpdateResp) addHostNVMeResults(hostAddr string, pbResp *ctlpb.FirmwareUpdateResp) error { - if len(pbResp.NvmeResults) > 0 { - if ur.HostNVMeResult == nil { - ur.HostNVMeResult = make(HostNVMeUpdateMap) - } - - nvmeResults := make([]*NVMeUpdateResult, 0, len(pbResp.NvmeResults)) - - for _, pbRes := range pbResp.NvmeResults { - devResult := &NVMeUpdateResult{ - DevicePCIAddr: pbRes.PciAddr, - } - if pbRes.Error != "" { - devResult.Error = errors.New(pbRes.Error) - } - nvmeResults = append(nvmeResults, devResult) - } - - ur.HostNVMeResult[hostAddr] = nvmeResults - } - - return nil -} - -// Keys returns the sorted list of keys from the SCM result map. -func (m HostSCMUpdateMap) Keys() []string { - keys := make([]string, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - return keys -} - -// Keys returns the sorted list of keys from the NVMe result map. -func (m HostNVMeUpdateMap) Keys() []string { - keys := make([]string, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - return keys -} - -// FirmwareUpdate concurrently updates device firmware for a given device type -// for all hosts supplied in the request's hostlist, or all configured hosts -// if not explicitly specified. The function blocks until all results -// (successful or otherwise) are received, and returns a single response -// structure containing results for all host firmware update operations. -func FirmwareUpdate(ctx context.Context, rpcClient UnaryInvoker, req *FirmwareUpdateReq) (*FirmwareUpdateResp, error) { - if req.FirmwarePath == "" { - return nil, errors.New("firmware file path missing") - } - pbType, err := req.Type.toCtlPBType() - if err != nil { - return nil, err - } - req.setRPC(func(ctx context.Context, conn *grpc.ClientConn) (proto.Message, error) { - return ctlpb.NewCtlSvcClient(conn).FirmwareUpdate(ctx, &ctlpb.FirmwareUpdateReq{ - FirmwarePath: req.FirmwarePath, - Type: pbType, - DeviceIDs: req.Devices, - ModelID: req.ModelID, - FirmwareRev: req.FirmwareRev, - }) - }) - - unaryResp, err := rpcClient.InvokeUnaryRPC(ctx, req) - if err != nil { - return nil, err - } - - resp := new(FirmwareUpdateResp) - for _, hostResp := range unaryResp.Responses { - if hostResp.Error != nil { - if err := resp.addHostError(hostResp.Addr, hostResp.Error); err != nil { - return nil, err - } - continue - } - - if err := resp.addHostResponse(hostResp); err != nil { - return nil, err - } - } - - return resp, nil -} diff --git a/src/control/lib/control/firmware_test.go b/src/control/lib/control/firmware_test.go deleted file mode 100644 index 563b4476889..00000000000 --- a/src/control/lib/control/firmware_test.go +++ /dev/null @@ -1,495 +0,0 @@ -// -// (C) Copyright 2020-2022 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -package control - -import ( - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" - - "github.com/daos-stack/daos/src/control/common/proto" - "github.com/daos-stack/daos/src/control/common/proto/convert" - ctlpb "github.com/daos-stack/daos/src/control/common/proto/ctl" - "github.com/daos-stack/daos/src/control/common/test" - "github.com/daos-stack/daos/src/control/lib/hostlist" - "github.com/daos-stack/daos/src/control/logging" - "github.com/daos-stack/daos/src/control/server/storage" -) - -func createTestHostSet(t *testing.T, hosts string) *hostlist.HostSet { - set, err := hostlist.CreateSet(hosts) - if err != nil { - t.Fatalf("couldn't create host set: %s", err) - } - return set -} - -func getCmpOpts() []cmp.Option { - return []cmp.Option{ - cmp.Comparer(test.CmpErrBool), - cmp.Comparer(func(h1, h2 *hostlist.HostSet) bool { - return h1.String() == h2.String() - }), - } -} - -func TestControl_FirmwareQuery(t *testing.T) { - scmPbResults, scmExpResults := getTestSCMQueryResults(t) - nvmePbResults, nvmeExpResults := getTestNVMeQueryResults(t) - - for name, tc := range map[string]struct { - mic *MockInvokerConfig - req *FirmwareQueryReq - expResp *FirmwareQueryResp - expErr error - }{ - "nothing requested": { - req: &FirmwareQueryReq{}, - expErr: errors.New("no device types requested"), - }, - "local failure": { - req: &FirmwareQueryReq{SCM: true, NVMe: true}, - mic: &MockInvokerConfig{ - UnaryError: errors.New("local failed"), - }, - expErr: errors.New("local failed"), - }, - "remote failure": { - req: &FirmwareQueryReq{SCM: true, NVMe: true}, - mic: &MockInvokerConfig{ - UnaryResponse: MockMSResponse("host1", errors.New("remote failed"), nil), - }, - expResp: &FirmwareQueryResp{ - HostErrorsResp: HostErrorsResp{ - HostErrors: HostErrorsMap{ - "remote failed": &HostErrorSet{ - HostSet: createTestHostSet(t, "host1"), - HostError: errors.New("remote failed"), - }, - }, - }, - }, - }, - "SCM success": { - req: &FirmwareQueryReq{SCM: true}, - mic: &MockInvokerConfig{ - UnaryResponse: MockMSResponse("host1", nil, &ctlpb.FirmwareQueryResp{ - ScmResults: scmPbResults, - }), - }, - expResp: &FirmwareQueryResp{ - HostSCMFirmware: map[string][]*SCMQueryResult{ - "host1": scmExpResults, - }, - }, - }, - "NVMe success": { - req: &FirmwareQueryReq{NVMe: true}, - mic: &MockInvokerConfig{ - UnaryResponse: MockMSResponse("host1", nil, &ctlpb.FirmwareQueryResp{ - NvmeResults: nvmePbResults, - }), - }, - expResp: &FirmwareQueryResp{ - HostNVMeFirmware: map[string][]*NVMeQueryResult{ - "host1": nvmeExpResults, - }, - }, - }, - "both success": { - req: &FirmwareQueryReq{SCM: true, NVMe: true}, - mic: &MockInvokerConfig{ - UnaryResponse: MockMSResponse("host1", nil, &ctlpb.FirmwareQueryResp{ - ScmResults: scmPbResults, - NvmeResults: nvmePbResults, - }), - }, - expResp: &FirmwareQueryResp{ - HostSCMFirmware: map[string][]*SCMQueryResult{ - "host1": scmExpResults, - }, - HostNVMeFirmware: map[string][]*NVMeQueryResult{ - "host1": nvmeExpResults, - }, - }, - }, - "no NVMe on host": { - req: &FirmwareQueryReq{SCM: true, NVMe: true}, - mic: &MockInvokerConfig{ - UnaryResponse: MockMSResponse("host1", nil, &ctlpb.FirmwareQueryResp{ - ScmResults: scmPbResults, - }), - }, - expResp: &FirmwareQueryResp{ - HostSCMFirmware: map[string][]*SCMQueryResult{ - "host1": scmExpResults, - }, - HostNVMeFirmware: map[string][]*NVMeQueryResult{ - "host1": {}, - }, - }, - }, - "no SCM on host": { - req: &FirmwareQueryReq{SCM: true, NVMe: true}, - mic: &MockInvokerConfig{ - UnaryResponse: MockMSResponse("host1", nil, &ctlpb.FirmwareQueryResp{ - NvmeResults: nvmePbResults, - }), - }, - expResp: &FirmwareQueryResp{ - HostSCMFirmware: map[string][]*SCMQueryResult{ - "host1": {}, - }, - HostNVMeFirmware: map[string][]*NVMeQueryResult{ - "host1": nvmeExpResults, - }, - }, - }, - } { - t.Run(name, func(t *testing.T) { - log, buf := logging.NewTestLogger(t.Name()) - defer test.ShowBufferOnFailure(t, buf) - - mic := tc.mic - if mic == nil { - mic = DefaultMockInvokerConfig() - } - - ctx := test.Context(t) - mi := NewMockInvoker(log, mic) - - gotResp, gotErr := FirmwareQuery(ctx, mi, tc.req) - test.CmpErr(t, tc.expErr, gotErr) - if tc.expErr != nil { - return - } - - if diff := cmp.Diff(tc.expResp, gotResp, getCmpOpts()...); diff != "" { - t.Fatalf("Unexpected response (-want, +got):\n%s\n", diff) - } - }) - } -} - -func getTestSCMQueryResults(t *testing.T) ([]*ctlpb.ScmFirmwareQueryResp, []*SCMQueryResult) { - scmPbResults := []*ctlpb.ScmFirmwareQueryResp{ - { - Module: &ctlpb.ScmModule{ - Uid: "TestUid1", - Capacity: (1 << 20), - Physicalid: 1, - Socketid: 2, - Controllerid: 3, - Channelid: 4, - Channelposition: 5, - }, - ActiveVersion: "ACTIVE1", - StagedVersion: "STAGED", - ImageMaxSizeBytes: 3200, - UpdateStatus: uint32(storage.ScmUpdateStatusStaged), - }, - { - Module: &ctlpb.ScmModule{ - Uid: "TestUid2", - Capacity: (1 << 21), - Physicalid: 6, - Socketid: 7, - Controllerid: 8, - Channelid: 9, - Channelposition: 10, - }, - ActiveVersion: "ACTIVE2", - StagedVersion: "", - ImageMaxSizeBytes: 6400, - UpdateStatus: uint32(storage.ScmUpdateStatusSuccess), - }, - { - Module: &ctlpb.ScmModule{ - Uid: "TestUid3", - Capacity: (1 << 22), - Physicalid: 11, - Socketid: 12, - Controllerid: 13, - Channelid: 14, - Channelposition: 15, - }, - Error: "Failed getting firmware info", - }, - } - - scmExpResults := make([]*SCMQueryResult, 0, len(scmPbResults)) - for _, pbRes := range scmPbResults { - res := &SCMQueryResult{ - Module: storage.ScmModule{ - UID: pbRes.Module.Uid, - Capacity: pbRes.Module.Capacity, - PhysicalID: pbRes.Module.Physicalid, - SocketID: pbRes.Module.Socketid, - ControllerID: pbRes.Module.Controllerid, - ChannelID: pbRes.Module.Channelid, - ChannelPosition: pbRes.Module.Channelposition, - }, - Info: &storage.ScmFirmwareInfo{ - ActiveVersion: pbRes.ActiveVersion, - StagedVersion: pbRes.StagedVersion, - ImageMaxSizeBytes: pbRes.ImageMaxSizeBytes, - UpdateStatus: storage.ScmFirmwareUpdateStatus(pbRes.UpdateStatus), - }, - } - - if pbRes.Error != "" { - res.Error = errors.New(pbRes.Error) - } - - scmExpResults = append(scmExpResults, res) - } - - return scmPbResults, scmExpResults -} - -func getTestNVMeQueryResults(t *testing.T) ([]*ctlpb.NvmeFirmwareQueryResp, []*NVMeQueryResult) { - nvmeExpResults := []*NVMeQueryResult{ - { - Device: *storage.MockNvmeController(1), - }, - { - Device: *storage.MockNvmeController(2), - }, - } - - nvmePbResults := make([]*ctlpb.NvmeFirmwareQueryResp, 0, len(nvmeExpResults)) - for _, expRes := range nvmeExpResults { - pb := new(proto.NvmeController) - if err := pb.FromNative(&expRes.Device); err != nil { - t.Fatalf("Failed to create PB NvmeController from native: %s", err) - } - - pbRes := &ctlpb.NvmeFirmwareQueryResp{ - Device: pb.AsProto(), - } - - nvmePbResults = append(nvmePbResults, pbRes) - } - - return nvmePbResults, nvmeExpResults -} - -func TestControl_DeviceType_toCtlPBType(t *testing.T) { - for name, tc := range map[string]struct { - originalType DeviceType - expPBType ctlpb.FirmwareUpdateReq_DeviceType - expErr error - }{ - "SCM": { - originalType: DeviceTypeSCM, - expPBType: ctlpb.FirmwareUpdateReq_SCM, - }, - "NVMe": { - originalType: DeviceTypeNVMe, - expPBType: ctlpb.FirmwareUpdateReq_NVMe, - }, - "unknown": { - originalType: DeviceTypeUnknown, - expPBType: ctlpb.FirmwareUpdateReq_DeviceType(-1), - expErr: errors.New("invalid device type 0"), - }, - "unrecognized": { - originalType: DeviceType(12345), - expPBType: ctlpb.FirmwareUpdateReq_DeviceType(-1), - expErr: errors.New("invalid device type 12345"), - }, - } { - t.Run(name, func(t *testing.T) { - result, err := tc.originalType.toCtlPBType() - - test.CmpErr(t, tc.expErr, err) - test.AssertEqual(t, tc.expPBType, result, "") - }) - } -} - -func TestControl_FirmwareUpdate(t *testing.T) { - pbSCMResults, expSCMResults := getTestSCMUpdateResults(t) - pbNVMeResults, expNVMeResults := getTestNVMeUpdateResults(t) - - for name, tc := range map[string]struct { - mic *MockInvokerConfig - req *FirmwareUpdateReq - expResp *FirmwareUpdateResp - expErr error - }{ - "unknown type": { - req: &FirmwareUpdateReq{ - Type: DeviceTypeUnknown, - FirmwarePath: "/my/path", - }, - expErr: errors.New("invalid device type 0"), - }, - "no path": { - req: &FirmwareUpdateReq{ - Type: DeviceTypeSCM, - }, - expErr: errors.New("firmware file path missing"), - }, - "local failure": { - req: &FirmwareUpdateReq{ - Type: DeviceTypeSCM, - FirmwarePath: "/my/path", - }, - mic: &MockInvokerConfig{ - UnaryError: errors.New("local failed"), - }, - expErr: errors.New("local failed"), - }, - "remote failure": { - req: &FirmwareUpdateReq{ - Type: DeviceTypeSCM, - FirmwarePath: "/my/path", - }, - mic: &MockInvokerConfig{ - UnaryResponse: MockMSResponse("host1", errors.New("remote failed"), nil), - }, - expResp: &FirmwareUpdateResp{ - HostErrorsResp: HostErrorsResp{ - HostErrors: HostErrorsMap{ - "remote failed": &HostErrorSet{ - HostSet: createTestHostSet(t, "host1"), - HostError: errors.New("remote failed"), - }, - }, - }, - }, - }, - "SCM success": { - req: &FirmwareUpdateReq{ - Type: DeviceTypeSCM, - FirmwarePath: "/my/path", - }, - mic: &MockInvokerConfig{ - UnaryResponse: MockMSResponse("host1", nil, &ctlpb.FirmwareUpdateResp{ - ScmResults: pbSCMResults, - }), - }, - expResp: &FirmwareUpdateResp{ - HostSCMResult: map[string][]*SCMUpdateResult{ - "host1": expSCMResults, - }, - }, - }, - "NVMe success": { - req: &FirmwareUpdateReq{ - Type: DeviceTypeNVMe, - FirmwarePath: "/my/path", - }, - mic: &MockInvokerConfig{ - UnaryResponse: MockMSResponse("host1", nil, &ctlpb.FirmwareUpdateResp{ - NvmeResults: pbNVMeResults, - }), - }, - expResp: &FirmwareUpdateResp{ - HostNVMeResult: map[string][]*NVMeUpdateResult{ - "host1": expNVMeResults, - }, - }, - }, - } { - t.Run(name, func(t *testing.T) { - log, buf := logging.NewTestLogger(t.Name()) - defer test.ShowBufferOnFailure(t, buf) - - mic := tc.mic - if mic == nil { - mic = DefaultMockInvokerConfig() - } - - ctx := test.Context(t) - mi := NewMockInvoker(log, mic) - - gotResp, gotErr := FirmwareUpdate(ctx, mi, tc.req) - test.CmpErr(t, tc.expErr, gotErr) - if tc.expErr != nil { - return - } - - if diff := cmp.Diff(tc.expResp, gotResp, getCmpOpts()...); diff != "" { - t.Fatalf("Unexpected response (-want, +got):\n%s\n", diff) - } - }) - } -} - -func getTestSCMUpdateResults(t *testing.T) ([]*ctlpb.ScmFirmwareUpdateResp, []*SCMUpdateResult) { - pbSCMResults := []*ctlpb.ScmFirmwareUpdateResp{ - { - Module: &ctlpb.ScmModule{ - Uid: "TestUid1", - Capacity: (1 << 20), - Physicalid: 1, - Socketid: 2, - Controllerid: 3, - Channelid: 4, - Channelposition: 5, - }, - Error: "", - }, - { - Module: &ctlpb.ScmModule{ - Uid: "TestUid2", - Capacity: (1 << 21), - Physicalid: 6, - Socketid: 7, - Controllerid: 8, - Channelid: 9, - Channelposition: 10, - }, - Error: "something went wrong", - }, - } - - expSCMResults := make([]*SCMUpdateResult, 0, len(pbSCMResults)) - for _, pbRes := range pbSCMResults { - res := &SCMUpdateResult{} - if err := convert.Types(pbRes.Module, &res.Module); err != nil { - t.Fatalf("couldn't set up expected results: %v", err) - } - if pbRes.Error != "" { - res.Error = errors.New(pbRes.Error) - } - - expSCMResults = append(expSCMResults, res) - } - - return pbSCMResults, expSCMResults -} - -func getTestNVMeUpdateResults(t *testing.T) ([]*ctlpb.NvmeFirmwareUpdateResp, []*NVMeUpdateResult) { - pbNVMeResults := []*ctlpb.NvmeFirmwareUpdateResp{ - { - PciAddr: "TestDev1", - Error: "a surprising failure occurred", - }, - { - PciAddr: "TestDev2", - Error: "", - }, - } - - expNVMeResults := make([]*NVMeUpdateResult, 0, len(pbNVMeResults)) - for _, pbRes := range pbNVMeResults { - res := &NVMeUpdateResult{ - DevicePCIAddr: pbRes.PciAddr, - } - if pbRes.Error != "" { - res.Error = errors.New(pbRes.Error) - } - - expNVMeResults = append(expNVMeResults, res) - } - - return pbNVMeResults, expNVMeResults -} diff --git a/src/control/lib/ipmctl/README.md b/src/control/lib/ipmctl/README.md index 21bbb022e24..e94cc5a4721 100644 --- a/src/control/lib/ipmctl/README.md +++ b/src/control/lib/ipmctl/README.md @@ -16,7 +16,5 @@ capabilities tailored to the specific needs of DAOS, the PMem related features are as follows: * device discovery -* device firmware version discovery -* device firmware update Functionality is exposed through the package's `IpmCtl` public interface. diff --git a/src/control/lib/ipmctl/nvm.go b/src/control/lib/ipmctl/nvm.go index de9e34dd353..cae456f8d38 100644 --- a/src/control/lib/ipmctl/nvm.go +++ b/src/control/lib/ipmctl/nvm.go @@ -1,5 +1,6 @@ // // (C) Copyright 2018-2022 Intel Corporation. +// (C) Copyright 2026 Hewlett Packard Enterprise Development LP // // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -24,10 +25,6 @@ type ( GetRegions(logging.Logger) ([]PMemRegion, error) // DeleteConfigGoals removes any pending but not yet applied PMem configuration goals. DeleteConfigGoals(logging.Logger) error - // GetFirmwareInfo retrieves firmware information from persistent memory modules. - GetFirmwareInfo(uid DeviceUID) (DeviceFirmwareInfo, error) - // UpdateFirmware updates persistent memory module firmware. - UpdateFirmware(uid DeviceUID, fwPath string, force bool) error } // NvmMgmt is an implementation of the IpmCtl interface which exercises diff --git a/src/control/lib/ipmctl/nvm_linux_amd64.go b/src/control/lib/ipmctl/nvm_linux_amd64.go index 403dad2b6fd..e674568af06 100644 --- a/src/control/lib/ipmctl/nvm_linux_amd64.go +++ b/src/control/lib/ipmctl/nvm_linux_amd64.go @@ -1,5 +1,6 @@ // // (C) Copyright 2022 Intel Corporation. +// (C) Copyright 2026 Hewlett Packard Enterprise Development LP // // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -25,7 +26,6 @@ import "C" import ( "fmt" - "os" "time" "unsafe" @@ -192,45 +192,3 @@ func (n *NvmMgmt) DeleteConfigGoals(log logging.Logger) error { defer logDuration(track(log, "time taken calling nvm_delete_config_goal")) return Rc2err("delete_config_goal", C.nvm_delete_config_goal(nil, 0)) } - -// GetFirmwareInfo fetches the firmware revision and other information from the device -func (n *NvmMgmt) GetFirmwareInfo(uid DeviceUID) (fw DeviceFirmwareInfo, err error) { - cUID := C.CString(uid.String()) - cInfo := new(C.struct_device_fw_info) - - if err = Rc2err( - "get_device_fw_info", - C.nvm_get_device_fw_image_info(cUID, cInfo)); err != nil { - return - } - - fw = *(*DeviceFirmwareInfo)(unsafe.Pointer(cInfo)) - return -} - -// UpdateFirmware updates the firmware on the device -func (n *NvmMgmt) UpdateFirmware(uid DeviceUID, fwPath string, force bool) error { - if len(fwPath) == 0 { - return errors.New("firmware path is required") - } - - if _, err := os.Stat(fwPath); err != nil { - return errors.Wrap(err, "unable to access firmware file") - } - - cUID := C.CString(uid.String()) - cPath := C.CString(fwPath) - cPathLen := C.ulong(len(fwPath)) - var cForce C.uchar - if force { - cForce = 1 - } - - if err := Rc2err( - "update_device_fw", - C.nvm_update_device_fw(cUID, cPath, cPathLen, cForce)); err != nil { - return err - } - - return nil -} diff --git a/src/control/lib/ipmctl/nvm_stubs.go b/src/control/lib/ipmctl/nvm_stubs.go index 52c790dff41..d41175d22e7 100644 --- a/src/control/lib/ipmctl/nvm_stubs.go +++ b/src/control/lib/ipmctl/nvm_stubs.go @@ -1,5 +1,6 @@ // // (C) Copyright 2022 Intel Corporation. +// (C) Copyright 2026 Hewlett Packard Enterprise Development LP // // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -74,13 +75,3 @@ func (n *NvmMgmt) GetRegions(log logging.Logger) ([]PMemRegion, error) { func (n *NvmMgmt) DeleteConfigGoals(log logging.Logger) error { return nil } - -// GetFirmwareInfo fetches the firmware revision and other information from the device -func (n *NvmMgmt) GetFirmwareInfo(uid DeviceUID) (DeviceFirmwareInfo, error) { - return DeviceFirmwareInfo{}, nil -} - -// UpdateFirmware updates the firmware on the device -func (n *NvmMgmt) UpdateFirmware(uid DeviceUID, fwPath string, force bool) error { - return nil -} diff --git a/src/control/lib/ipmctl/nvm_test.go b/src/control/lib/ipmctl/nvm_test.go index 177ae85b81b..254038fcfd2 100644 --- a/src/control/lib/ipmctl/nvm_test.go +++ b/src/control/lib/ipmctl/nvm_test.go @@ -1,5 +1,6 @@ // // (C) Copyright 2018-2022 Intel Corporation. +// (C) Copyright 2026 Hewlett Packard Enterprise Development LP // // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -10,13 +11,9 @@ package ipmctl import ( "fmt" - "os" "os/user" - "path" "testing" - "github.com/pkg/errors" - "github.com/daos-stack/daos/src/control/common/test" "github.com/daos-stack/daos/src/control/logging" ) @@ -67,90 +64,6 @@ func TestNvmDiscovery(t *testing.T) { } } -func TestNvmFwInfo(t *testing.T) { - log, buf := logging.NewTestLogger("firmware") - defer test.ShowBufferOnFailure(t, buf) - - if skipNoPerms(t) { - return - } - - mgmt := NvmMgmt{} - devs := discoverDevices(t, log, mgmt) - - for _, d := range devs { - fwInfo, err := mgmt.GetFirmwareInfo(d.Uid) - if err != nil { - t.Errorf("Failed to get FW info for device %s: %v", d.Uid.String(), err) - continue - } - - fmt.Printf("Device %s: %+v\n", d.Uid.String(), fwInfo) - } -} - -func TestNvmFwUpdate_BadFile(t *testing.T) { - for _, tt := range []struct { - desc string - inputPath string - expErr error - }{ - { - desc: "empty path", - expErr: errors.New("firmware path is required"), - }, - { - desc: "non-existent path", - inputPath: "/not/a/real/path.bin", - expErr: errors.New("unable to access firmware file"), - }, - } { - t.Run(tt.desc, func(t *testing.T) { - var devUID DeviceUID // don't care - this test shouldn't reach the API - - mgmt := NvmMgmt{} - err := mgmt.UpdateFirmware(devUID, tt.inputPath, false) - - test.CmpErr(t, tt.expErr, err) - }) - } -} - -func TestNvmFwUpdate(t *testing.T) { - log, buf := logging.NewTestLogger("firmware") - defer test.ShowBufferOnFailure(t, buf) - - if skipNoPerms(t) { - return - } - - dir, cleanup := test.CreateTestDir(t) - defer cleanup() - - // Actual DIMM will reject this junk file. - // We just need it to get down to the API. - filename := path.Join(dir, "fake.bin") - f, err := os.Create(filename) - if err != nil { - t.Fatal("Failed to create a fake FW file") - } - if _, err := f.WriteString("notrealFW"); err != nil { - t.Fatal(err) - } - f.Close() - - mgmt := NvmMgmt{} - devs := discoverDevices(t, log, mgmt) - - for _, d := range devs { - err := mgmt.UpdateFirmware(d.Uid, filename, false) - - // Got down to NVM API - test.CmpErr(t, errors.New("update_device_fw"), err) - fmt.Printf("Update firmware for device %s: %v\n", d.Uid.String(), err) - } -} - // The actual test functions are in nvm_ctest.go file so that they can use cgo (import "C"). // These wrappers are here for gotest to find. diff --git a/src/control/lib/ipmctl/nvm_types.go b/src/control/lib/ipmctl/nvm_types.go index 78d8f85d855..15403c74402 100644 --- a/src/control/lib/ipmctl/nvm_types.go +++ b/src/control/lib/ipmctl/nvm_types.go @@ -1,5 +1,6 @@ // // (C) Copyright 2018-2022 Intel Corporation. +// (C) Copyright 2026 Hewlett Packard Enterprise Development LP // // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -127,24 +128,3 @@ type PMemRegion struct { Health uint32 // Rolled up health of the underlying PMem modules. Reserved [40]uint8 // reserved } - -// FWUpdateStatus values represent the ipmctl fw_update_status enum -const ( - // FWUpdateStatusUnknown represents unknown status - FWUpdateStatusUnknown = 0 - // FWUpdateStatusStaged represents a staged FW update to be loaded on reboot - FWUpdateStatusStaged = 1 - // FWUpdateStatusSuccess represents a successfully applied FW update - FWUpdateStatusSuccess = 2 - // FWUpdateStatusFailed represents a failed FW update - FWUpdateStatusFailed = 3 -) - -// DeviceFirmwareInfo represents an ipmctl device_fw_info structure -type DeviceFirmwareInfo struct { - ActiveFWVersion Version // currently running FW version - StagedFWVersion Version // FW version to be applied on next reboot - FWImageMaxSize uint32 // maximum FW image size in 4096-byte chunks - FWUpdateStatus uint32 // last update status - Reserved [4]uint8 -} diff --git a/src/control/lib/spdk/README.md b/src/control/lib/spdk/README.md index e2fddd8bdaa..e5aa548c2f5 100644 --- a/src/control/lib/spdk/README.md +++ b/src/control/lib/spdk/README.md @@ -16,7 +16,6 @@ capabilities tailored to the specific needs of DAOS, the NVMe SSD related features are as follows: * device discovery (SPDK environment initialization and device probing) -* device firmware update * VMD enablement and discovery * format (wipe) of device namespaces diff --git a/src/control/lib/spdk/include/nvme_control.h b/src/control/lib/spdk/include/nvme_control.h index 2b587b92f2b..d346903a1b9 100644 --- a/src/control/lib/spdk/include/nvme_control.h +++ b/src/control/lib/spdk/include/nvme_control.h @@ -1,5 +1,6 @@ /** * (C) Copyright 2018-2021 Intel Corporation. +* (C) Copyright 2026 Hewlett Packard Enterprise Development LP * * SPDX-License-Identifier: BSD-2-Clause-Patent */ @@ -38,18 +39,6 @@ nvme_wipe_namespaces(void); struct ret_t * nvme_format(char *ctrlr_pci_addr); -/** - * Update NVMe controller firmware. - * - * \param ctrlr_pci_addr PCI address of NVMe controller. - * \param path Local filepath where firmware image is stored. - * \param slot Identifier of software slot/register to upload to. - * - * \return a pointer to a return struct (ret_t). - */ -struct ret_t * -nvme_fwupdate(char *ctrlr_pci_addr, char *path, unsigned int slot); - /** * Initialize SPDK environment. * diff --git a/src/control/lib/spdk/mocks.go b/src/control/lib/spdk/mocks.go index 7eee1ada845..52991da861e 100644 --- a/src/control/lib/spdk/mocks.go +++ b/src/control/lib/spdk/mocks.go @@ -1,6 +1,6 @@ // // (C) Copyright 2018-2022 Intel Corporation. -// (C) Copyright 2025 Hewlett Packard Enterprise Development LP +// (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP // // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -91,17 +91,6 @@ func (n MockNvmeImpl) Format(log logging.Logger) ([]*FormatResult, error) { return n.Cfg.FormatRes, nil } -// Update calls C.nvme_fwupdate to update controller firmware image. -func (n MockNvmeImpl) Update(log logging.Logger, ctrlrPciAddr string, path string, slot int32) error { - if n.Cfg.UpdateErr != nil { - return n.Cfg.UpdateErr - } - log.Debugf("mock update fw on nvme ssd: %q, image path %q, slot %d", - ctrlrPciAddr, path, slot) - - return nil -} - // Clean removes SPDK lockfiles associated with NVMe SSDs/controllers at given PCI addresses. func (n MockNvmeImpl) Clean(log logging.Logger, pciAddrChecker LockfileAddrCheckFn) ([]string, error) { if n.Cfg.CleanRes == nil { diff --git a/src/control/lib/spdk/nvme.go b/src/control/lib/spdk/nvme.go index 1151328c591..95ba28402d2 100644 --- a/src/control/lib/spdk/nvme.go +++ b/src/control/lib/spdk/nvme.go @@ -1,6 +1,6 @@ // // (C) Copyright 2018-2022 Intel Corporation. -// (C) Copyright 2025 Hewlett Packard Enterprise Development LP +// (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP // // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -38,8 +38,6 @@ type Nvme interface { Discover(logging.Logger) (storage.NvmeControllers, error) // Format NVMe controller namespaces Format(logging.Logger) ([]*FormatResult, error) - // Update updates the firmware on a specific PCI address and slot - Update(log logging.Logger, ctrlrPciAddr string, path string, slot int32) error // Clean removes lockfiles associated with NVMe controllers. Decisions regarding which // lockfiles to remove made using supplied address check function. Clean(logging.Logger, LockfileAddrCheckFn) ([]string, error) diff --git a/src/control/lib/spdk/nvme_default.go b/src/control/lib/spdk/nvme_default.go index 09e50027b2d..d3575c70c56 100644 --- a/src/control/lib/spdk/nvme_default.go +++ b/src/control/lib/spdk/nvme_default.go @@ -1,6 +1,6 @@ // // (C) Copyright 2022-2023 Intel Corporation. -// (C) Copyright 2025 Hewlett Packard Enterprise Development LP +// (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP // (C) Copyright 2025 Google LLC // // SPDX-License-Identifier: BSD-2-Clause-Patent @@ -99,28 +99,6 @@ func (n *NvmeImpl) Format(log logging.Logger) ([]*FormatResult, error) { return results, wrapCleanError(errCollect, errRemLocks) } -// Update updates the firmware image via SPDK in a given slot on the device. -// -// Afterwards remove lockfile for the updated device. -func (n *NvmeImpl) Update(log logging.Logger, ctrlrPciAddr string, path string, slot int32) error { - if n == nil { - return errors.New("nil NvmeImpl") - } - - csPath := C.CString(path) - defer C.free(unsafe.Pointer(csPath)) - - csPci := C.CString(ctrlrPciAddr) - defer C.free(unsafe.Pointer(csPci)) - - _, errCollect := collectCtrlrs(C.nvme_fwupdate(csPci, csPath, C.uint(slot)), - "NVMe Update(): C.nvme_fwupdate") - - errRemLocks := cleanKnownLockfiles(log, n, ctrlrPciAddr) - - return wrapCleanError(errCollect, errRemLocks) -} - // c2GoController is a private translation function. func c2GoController(ctrlr *C.struct_nvme_ctrlr_t) *storage.NvmeController { return &storage.NvmeController{ diff --git a/src/control/lib/spdk/src/nvme_control.c b/src/control/lib/spdk/src/nvme_control.c index bc2b0019ab5..280a5cc2606 100644 --- a/src/control/lib/spdk/src/nvme_control.c +++ b/src/control/lib/spdk/src/nvme_control.c @@ -354,83 +354,6 @@ nvme_format(char *ctrlr_pci_addr) return ret; } -struct ret_t * -nvme_fwupdate(char *ctrlr_pci_addr, char *path, unsigned int slot) -{ - int rc = 1; - int fd = -1; - unsigned int size; - struct stat fw_stat; - void *fw_image = NULL; - enum spdk_nvme_fw_commit_action commit_action; - struct spdk_nvme_status status; - struct ctrlr_entry *ctrlr_entry; - struct ret_t *ret; - - ret = init_ret(); - - ret->rc = get_controller(&ctrlr_entry, ctrlr_pci_addr); - if (ret->rc != 0) - return ret; - - fd = open(path, O_RDONLY); - if (fd < 0) { - sprintf(ret->info, "Open file failed"); - ret->rc = 1; - return ret; - } - rc = fstat(fd, &fw_stat); - if (rc < 0) { - close(fd); - sprintf(ret->info, "Fstat failed"); - ret->rc = 1; - return ret; - } - - if (fw_stat.st_size % 4) { - close(fd); - sprintf(ret->info, "Firmware image size is not multiple of 4"); - ret->rc = 1; - return ret; - } - - size = fw_stat.st_size; - - fw_image = spdk_dma_zmalloc(size, 4096, NULL); - if (fw_image == NULL) { - close(fd); - sprintf(ret->info, "Allocation error"); - ret->rc = 1; - return ret; - } - - if (read(fd, fw_image, size) != (ssize_t)size) { - close(fd); - spdk_dma_free(fw_image); - sprintf(ret->info, "Read firmware image failed"); - ret->rc = 1; - return ret; - } - close(fd); - - commit_action = SPDK_NVME_FW_COMMIT_REPLACE_AND_ENABLE_IMG; - rc = spdk_nvme_ctrlr_update_firmware(ctrlr_entry->ctrlr, fw_image, size, - slot, commit_action, &status); - if (rc == -ENXIO && status.sct == SPDK_NVME_SCT_COMMAND_SPECIFIC && - status.sc == SPDK_NVME_SC_FIRMWARE_REQ_CONVENTIONAL_RESET) { - sprintf(ret->info, - "conventional reset is needed to enable firmware !"); - } else if (rc) { - sprintf(ret->info, "spdk_nvme_ctrlr_update_firmware failed"); - } else { - sprintf(ret->info, "spdk_nvme_ctrlr_update_firmware success"); - } - spdk_dma_free(fw_image); - - ret->rc = rc; - return ret; -} - static int is_addr_in_allowlist(char *pci_addr, const struct spdk_pci_addr *allowlist, int num_allowlist_devices) diff --git a/src/control/pbin/pbin.go b/src/control/pbin/pbin.go index 16784d12ee3..8f7317cb164 100644 --- a/src/control/pbin/pbin.go +++ b/src/control/pbin/pbin.go @@ -1,5 +1,6 @@ // // (C) Copyright 2019-2022 Intel Corporation. +// (C) Copyright 2026 Hewlett Packard Enterprise Development LP // // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -23,13 +24,6 @@ const ( // DaosPrivHelperLogFileEnvVar is the name of the environment variable which // can be set to enable non-ERROR logging in the privileged helper. DaosPrivHelperLogFileEnvVar = "DAOS_HELPER_LOG_FILE" - - // DaosFWName is the name of the firmware helper. - DaosFWName = "daos_firmware_helper" - - // DaosFWLogFileEnvVar is the name of the environment variable that - // can be set to enable non-ERROR logging in the firmware helper. - DaosFWLogFileEnvVar = "DAOS_FIRMWARE_LOG_FILE" ) // PingResp is the response from a privileged helper application to a Ping diff --git a/src/control/run_go_tests.sh b/src/control/run_go_tests.sh index 68abadec46c..c7d59345cfc 100755 --- a/src/control/run_go_tests.sh +++ b/src/control/run_go_tests.sh @@ -187,7 +187,7 @@ $output function get_test_runner() { - test_args="-mod vendor -race -cover -v ./... -tags firmware,fault_injection,test_stubs,spdk" + test_args="-mod vendor -race -cover -v ./... -tags fault_injection,test_stubs,spdk" test_runner="go test" if which gotestsum >/dev/null; then @@ -243,7 +243,7 @@ if $DLV_MODE; then echo "Usage: $0 --dlv [--run ] " >&2 exit 1 fi - DLV_BUILD_FLAGS="-mod vendor -tags firmware,fault_injection,test_stubs,spdk" + DLV_BUILD_FLAGS="-mod vendor -tags fault_injection,test_stubs,spdk" DLV_ARGS=() [[ -n "$DLV_TEST_NAME" ]] && DLV_ARGS=(-- -test.run "$DLV_TEST_NAME") echo "Environment:" diff --git a/src/control/security/grpc_authorization.go b/src/control/security/grpc_authorization.go index d4fb9a2ad86..8464dd0dcde 100644 --- a/src/control/security/grpc_authorization.go +++ b/src/control/security/grpc_authorization.go @@ -37,8 +37,6 @@ var methodAuthorizations = map[string][]Component{ "/ctl.CtlSvc/StorageNvmeAddDevice": {ComponentAdmin}, "/ctl.CtlSvc/NetworkScan": {ComponentAdmin}, "/ctl.CtlSvc/CollectLog": {ComponentAdmin}, - "/ctl.CtlSvc/FirmwareQuery": {ComponentAdmin}, - "/ctl.CtlSvc/FirmwareUpdate": {ComponentAdmin}, "/ctl.CtlSvc/SmdQuery": {ComponentAdmin}, "/ctl.CtlSvc/SmdManage": {ComponentAdmin}, "/ctl.CtlSvc/SetEngineLogMasks": {ComponentAdmin}, diff --git a/src/control/security/grpc_authorization_test.go b/src/control/security/grpc_authorization_test.go index 9eda8601cf5..afb360da674 100644 --- a/src/control/security/grpc_authorization_test.go +++ b/src/control/security/grpc_authorization_test.go @@ -54,8 +54,6 @@ func TestSecurity_ComponentHasAccess(t *testing.T) { "/ctl.CtlSvc/StorageNvmeAddDevice": {ComponentAdmin}, "/ctl.CtlSvc/NetworkScan": {ComponentAdmin}, "/ctl.CtlSvc/CollectLog": {ComponentAdmin}, - "/ctl.CtlSvc/FirmwareQuery": {ComponentAdmin}, - "/ctl.CtlSvc/FirmwareUpdate": {ComponentAdmin}, "/ctl.CtlSvc/SmdQuery": {ComponentAdmin}, "/ctl.CtlSvc/SmdManage": {ComponentAdmin}, "/ctl.CtlSvc/SetEngineLogMasks": {ComponentAdmin}, diff --git a/src/control/server/config/server.go b/src/control/server/config/server.go index 77b9980025b..1ff155f6bcf 100644 --- a/src/control/server/config/server.go +++ b/src/control/server/config/server.go @@ -49,8 +49,9 @@ type SupportConfig struct { } type deprecatedParams struct { - AccessPoints []string `yaml:"access_points,omitempty"` // deprecated in 2.8 - EnableHotplug *bool `yaml:"enable_hotplug,omitempty"` // deprecated in 2.8 + AccessPoints []string `yaml:"access_points,omitempty"` // deprecated in 2.8 + EnableHotplug *bool `yaml:"enable_hotplug,omitempty"` // deprecated in 2.8 + FWHelperLogFile string `yaml:"firmware_helper_log_file,omitempty"` // deprecated in 3.0 } // Server describes configuration options for DAOS control plane. @@ -74,7 +75,6 @@ type Server struct { ControlLogFile string `yaml:"control_log_file,omitempty"` ControlLogJSON bool `yaml:"control_log_json,omitempty"` HelperLogFile string `yaml:"helper_log_file,omitempty"` - FWHelperLogFile string `yaml:"firmware_helper_log_file,omitempty"` FaultPath string `yaml:"fault_path,omitempty"` TelemetryPort int `yaml:"telemetry_port,omitempty"` CoreDumpFilter uint8 `yaml:"core_dump_filter,omitempty"` @@ -352,12 +352,6 @@ func (cfg *Server) WithHelperLogFile(filePath string) *Server { return cfg } -// WithFirmwareHelperLogFile sets the path to the daos_firmware_helper logfile. -func (cfg *Server) WithFirmwareHelperLogFile(filePath string) *Server { - cfg.FWHelperLogFile = filePath - return cfg -} - // WithTelemetryPort sets the port for the telemetry exporter. func (cfg *Server) WithTelemetryPort(port int) *Server { cfg.TelemetryPort = port diff --git a/src/control/server/config/server_test.go b/src/control/server/config/server_test.go index b68ccd0265b..1e124dd76a8 100644 --- a/src/control/server/config/server_test.go +++ b/src/control/server/config/server_test.go @@ -252,7 +252,6 @@ func TestServerConfig_Constructed(t *testing.T) { WithControlLogMask(common.ControlLogLevelError). WithControlLogFile("/var/log/daos/daos_server.log"). WithHelperLogFile("/var/log/daos/daos_server_helper.log"). - WithFirmwareHelperLogFile("/var/log/daos/daos_firmware_helper.log"). WithTelemetryPort(9191). WithSystemName("daos_server"). WithSocketDir("./.daos/daos_server"). diff --git a/src/control/server/ctl_firmware.go b/src/control/server/ctl_firmware.go deleted file mode 100644 index 47a32d43963..00000000000 --- a/src/control/server/ctl_firmware.go +++ /dev/null @@ -1,176 +0,0 @@ -// -// (C) Copyright 2020-2022 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -package server - -import ( - "context" - - "github.com/pkg/errors" - - "github.com/daos-stack/daos/src/control/common/proto/convert" - ctlpb "github.com/daos-stack/daos/src/control/common/proto/ctl" - "github.com/daos-stack/daos/src/control/server/storage" -) - -// FirmwareQuery implements the method defined for the control service if -// firmware management is enabled for this build. -// -// It fetches information about the device firmware on this server based on the -// caller's request parameters. It can fetch firmware information for NVMe, SCM, -// or both. -func (svc *ControlService) FirmwareQuery(parent context.Context, pbReq *ctlpb.FirmwareQueryReq) (*ctlpb.FirmwareQueryResp, error) { - pbResp := new(ctlpb.FirmwareQueryResp) - - if pbReq.QueryScm { - scmResults, err := svc.querySCMFirmware(pbReq) - if err != nil { - return nil, err - } - pbResp.ScmResults = scmResults - } - - if pbReq.QueryNvme { - nvmeResults, err := svc.queryNVMeFirmware(pbReq) - if err != nil { - return nil, err - } - pbResp.NvmeResults = nvmeResults - } - - return pbResp, nil -} - -func (svc *ControlService) querySCMFirmware(pbReq *ctlpb.FirmwareQueryReq) ([]*ctlpb.ScmFirmwareQueryResp, error) { - queryResp, err := svc.storage.QueryScmFirmware(storage.ScmFirmwareQueryRequest{ - FirmwareRev: pbReq.FirmwareRev, - ModelID: pbReq.ModelID, - DeviceUIDs: pbReq.DeviceIDs, - }) - if err != nil { - return nil, err - } - - scmResults := make([]*ctlpb.ScmFirmwareQueryResp, 0, len(queryResp.Results)) - for _, res := range queryResp.Results { - pbResult := &ctlpb.ScmFirmwareQueryResp{} - if err := convert.Types(res.Module, &pbResult.Module); err != nil { - return nil, errors.Wrap(err, "unable to convert SCM module") - } - if res.Info != nil { - pbResult.ActiveVersion = res.Info.ActiveVersion - pbResult.StagedVersion = res.Info.StagedVersion - pbResult.ImageMaxSizeBytes = res.Info.ImageMaxSizeBytes - pbResult.UpdateStatus = uint32(res.Info.UpdateStatus) - } - pbResult.Error = res.Error - scmResults = append(scmResults, pbResult) - } - - return scmResults, nil -} - -func (svc *ControlService) queryNVMeFirmware(pbReq *ctlpb.FirmwareQueryReq) ([]*ctlpb.NvmeFirmwareQueryResp, error) { - queryResp, err := svc.storage.QueryBdevFirmware(storage.NVMeFirmwareQueryRequest{ - FirmwareRev: pbReq.FirmwareRev, - ModelID: pbReq.ModelID, - DeviceAddrs: pbReq.DeviceIDs, - }) - if err != nil { - return nil, err - } - - nvmeResults := make([]*ctlpb.NvmeFirmwareQueryResp, 0, len(queryResp.Results)) - for _, res := range queryResp.Results { - pbResult := &ctlpb.NvmeFirmwareQueryResp{} - if err := convert.Types(res.Device, &pbResult.Device); err != nil { - return nil, errors.Wrap(err, "unable to convert NVMe controller") - } - - nvmeResults = append(nvmeResults, pbResult) - } - - return nvmeResults, nil -} - -// FirmwareUpdate implements the method defined for the control service if -// firmware management is enabled for this build. -// -// It updates the firmware on the storage devices of the specified type. -func (svc *ControlService) FirmwareUpdate(parent context.Context, pbReq *ctlpb.FirmwareUpdateReq) (*ctlpb.FirmwareUpdateResp, error) { - instances := svc.harness.Instances() - for _, srv := range instances { - if srv.IsStarted() { - rank, err := srv.GetRank() - if err != nil { - return nil, errors.New("unidentified server rank is running") - } - return nil, FaultInstancesNotStopped("firmware update", rank) - } - } - - pbResp := new(ctlpb.FirmwareUpdateResp) - var err error - switch pbReq.Type { - case ctlpb.FirmwareUpdateReq_SCM: - err = svc.updateSCM(pbReq, pbResp) - case ctlpb.FirmwareUpdateReq_NVMe: - err = svc.updateNVMe(pbReq, pbResp) - default: - err = errors.New("unrecognized device type") - } - - if err != nil { - return nil, err - } - - return pbResp, nil -} - -func (svc *ControlService) updateSCM(pbReq *ctlpb.FirmwareUpdateReq, pbResp *ctlpb.FirmwareUpdateResp) error { - updateResp, err := svc.storage.UpdateScmFirmware(storage.ScmFirmwareUpdateRequest{ - FirmwarePath: pbReq.FirmwarePath, - FirmwareRev: pbReq.FirmwareRev, - ModelID: pbReq.ModelID, - DeviceUIDs: pbReq.DeviceIDs, - }) - if err != nil { - return err - } - - pbResp.ScmResults = make([]*ctlpb.ScmFirmwareUpdateResp, 0, len(updateResp.Results)) - for _, res := range updateResp.Results { - pbRes := &ctlpb.ScmFirmwareUpdateResp{} - if err := convert.Types(res, pbRes); err != nil { - return err - } - pbRes.Error = res.Error - pbResp.ScmResults = append(pbResp.ScmResults, pbRes) - } - return nil -} - -func (svc *ControlService) updateNVMe(pbReq *ctlpb.FirmwareUpdateReq, pbResp *ctlpb.FirmwareUpdateResp) error { - updateResp, err := svc.storage.UpdateBdevFirmware(storage.NVMeFirmwareUpdateRequest{ - FirmwarePath: pbReq.FirmwarePath, - FirmwareRev: pbReq.FirmwareRev, - ModelID: pbReq.ModelID, - DeviceAddrs: pbReq.DeviceIDs, - }) - if err != nil { - return err - } - - pbResp.NvmeResults = make([]*ctlpb.NvmeFirmwareUpdateResp, 0, len(updateResp.Results)) - for _, res := range updateResp.Results { - pbRes := &ctlpb.NvmeFirmwareUpdateResp{ - PciAddr: res.Device.PciAddr, - Error: res.Error, - } - pbResp.NvmeResults = append(pbResp.NvmeResults, pbRes) - } - return nil -} diff --git a/src/control/server/ctl_firmware_test.go b/src/control/server/ctl_firmware_test.go deleted file mode 100644 index 7cda1fcfe28..00000000000 --- a/src/control/server/ctl_firmware_test.go +++ /dev/null @@ -1,824 +0,0 @@ -// -// (C) Copyright 2020-2024 Intel Corporation. -// (C) Copyright 2026 Hewlett Packard Enterprise Development LP -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -package server - -import ( - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" - - "github.com/daos-stack/daos/src/control/common/proto/convert" - ctlpb "github.com/daos-stack/daos/src/control/common/proto/ctl" - "github.com/daos-stack/daos/src/control/common/test" - "github.com/daos-stack/daos/src/control/logging" - "github.com/daos-stack/daos/src/control/server/config" - "github.com/daos-stack/daos/src/control/server/storage" - "github.com/daos-stack/daos/src/control/server/storage/bdev" - "github.com/daos-stack/daos/src/control/server/storage/scm" -) - -func getPBNvmeQueryResults(t *testing.T, devs storage.NvmeControllers) []*ctlpb.NvmeFirmwareQueryResp { - results := make([]*ctlpb.NvmeFirmwareQueryResp, 0, len(devs)) - for _, dev := range devs { - devPB := &ctlpb.NvmeFirmwareQueryResp{} - if err := convert.Types(dev, &devPB.Device); err != nil { - t.Fatalf("unable to convert NvmeController: %s", err) - } - results = append(results, devPB) - } - - return results -} - -func getProtoNVMeControllers(t *testing.T, ctrlrs storage.NvmeControllers) []*ctlpb.NvmeController { - results := make([]*ctlpb.NvmeController, 0, len(ctrlrs)) - for _, c := range ctrlrs { - cPB := &ctlpb.NvmeController{} - if err := convert.Types(c, &cPB); err != nil { - t.Fatalf("unable to convert NvmeController: %s", err) - } - results = append(results, cPB) - } - - return results -} - -func getProtoScmModules(t *testing.T, modules storage.ScmModules) []*ctlpb.ScmModule { - results := make([]*ctlpb.ScmModule, 0, len(modules)) - for _, mod := range modules { - modPB := &ctlpb.ScmModule{} - if err := convert.Types(mod, &modPB); err != nil { - t.Fatalf("unable to convert ScmModule: %s", err) - } - results = append(results, modPB) - } - - return results -} - -func TestCtlSvc_FirmwareQuery(t *testing.T) { - testFWInfo := &storage.ScmFirmwareInfo{ - ActiveVersion: "MyActiveVersion", - StagedVersion: "MyStagedVersion", - ImageMaxSizeBytes: 1024, - UpdateStatus: storage.ScmUpdateStatusStaged, - } - - mockSCM := storage.MockScmModules(3) - mockPbSCM := getProtoScmModules(t, mockSCM) - - testNVMeDevs := storage.MockNvmeControllers(3) - mockPbNVMeDevs := getProtoNVMeControllers(t, testNVMeDevs) - testNVMeResults := getPBNvmeQueryResults(t, testNVMeDevs) - - for name, tc := range map[string]struct { - bmbc *bdev.MockBackendConfig - smbc *scm.MockBackendConfig - req ctlpb.FirmwareQueryReq - expErr error - expResp *ctlpb.FirmwareQueryResp - }{ - "nothing requested": { - expResp: &ctlpb.FirmwareQueryResp{}, - }, - "SCM - discovery failed": { - req: ctlpb.FirmwareQueryReq{ - QueryScm: true, - }, - smbc: &scm.MockBackendConfig{ - GetModulesErr: errors.New("mock discovery failed"), - }, - expErr: errors.New("mock discovery failed"), - }, - "SCM - no devices": { - req: ctlpb.FirmwareQueryReq{ - QueryScm: true, - }, - smbc: &scm.MockBackendConfig{}, - expResp: &ctlpb.FirmwareQueryResp{ - ScmResults: []*ctlpb.ScmFirmwareQueryResp{}, - }, - }, - "SCM - success with devices": { - req: ctlpb.FirmwareQueryReq{ - QueryScm: true, - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: mockSCM, - GetFirmwareStatusRes: testFWInfo, - }, - expResp: &ctlpb.FirmwareQueryResp{ - ScmResults: []*ctlpb.ScmFirmwareQueryResp{ - { - Module: mockPbSCM[0], - ActiveVersion: testFWInfo.ActiveVersion, - StagedVersion: testFWInfo.StagedVersion, - ImageMaxSizeBytes: testFWInfo.ImageMaxSizeBytes, - UpdateStatus: uint32(testFWInfo.UpdateStatus), - }, - { - Module: mockPbSCM[1], - ActiveVersion: testFWInfo.ActiveVersion, - StagedVersion: testFWInfo.StagedVersion, - ImageMaxSizeBytes: testFWInfo.ImageMaxSizeBytes, - UpdateStatus: uint32(testFWInfo.UpdateStatus), - }, - { - Module: mockPbSCM[2], - ActiveVersion: testFWInfo.ActiveVersion, - StagedVersion: testFWInfo.StagedVersion, - ImageMaxSizeBytes: testFWInfo.ImageMaxSizeBytes, - UpdateStatus: uint32(testFWInfo.UpdateStatus), - }, - }, - }, - }, - "SCM - errors with devices": { - req: ctlpb.FirmwareQueryReq{ - QueryScm: true, - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: mockSCM, - GetFirmwareStatusErr: errors.New("mock query"), - }, - expResp: &ctlpb.FirmwareQueryResp{ - ScmResults: []*ctlpb.ScmFirmwareQueryResp{ - { - Module: mockPbSCM[0], - Error: "mock query", - }, - { - Module: mockPbSCM[1], - Error: "mock query", - }, - { - Module: mockPbSCM[2], - Error: "mock query", - }, - }, - }, - }, - "SCM - filter by FW rev": { - req: ctlpb.FirmwareQueryReq{ - QueryScm: true, - FirmwareRev: "FwRev0", - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: mockSCM, - GetFirmwareStatusRes: testFWInfo, - }, - expResp: &ctlpb.FirmwareQueryResp{ - ScmResults: []*ctlpb.ScmFirmwareQueryResp{ - { - Module: mockPbSCM[0], - ActiveVersion: testFWInfo.ActiveVersion, - StagedVersion: testFWInfo.StagedVersion, - ImageMaxSizeBytes: testFWInfo.ImageMaxSizeBytes, - UpdateStatus: uint32(testFWInfo.UpdateStatus), - }, - }, - }, - }, - "SCM - filter by model ID": { - req: ctlpb.FirmwareQueryReq{ - QueryScm: true, - ModelID: "PartNumber1", - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: mockSCM, - GetFirmwareStatusRes: testFWInfo, - }, - expResp: &ctlpb.FirmwareQueryResp{ - ScmResults: []*ctlpb.ScmFirmwareQueryResp{ - { - Module: mockPbSCM[1], - ActiveVersion: testFWInfo.ActiveVersion, - StagedVersion: testFWInfo.StagedVersion, - ImageMaxSizeBytes: testFWInfo.ImageMaxSizeBytes, - UpdateStatus: uint32(testFWInfo.UpdateStatus), - }, - }, - }, - }, - "SCM - specific devices": { - req: ctlpb.FirmwareQueryReq{ - QueryScm: true, - DeviceIDs: []string{"Device1", "Device2"}, - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: mockSCM, - GetFirmwareStatusRes: testFWInfo, - }, - expResp: &ctlpb.FirmwareQueryResp{ - ScmResults: []*ctlpb.ScmFirmwareQueryResp{ - { - Module: mockPbSCM[1], - ActiveVersion: testFWInfo.ActiveVersion, - StagedVersion: testFWInfo.StagedVersion, - ImageMaxSizeBytes: testFWInfo.ImageMaxSizeBytes, - UpdateStatus: uint32(testFWInfo.UpdateStatus), - }, - { - Module: mockPbSCM[2], - ActiveVersion: testFWInfo.ActiveVersion, - StagedVersion: testFWInfo.StagedVersion, - ImageMaxSizeBytes: testFWInfo.ImageMaxSizeBytes, - UpdateStatus: uint32(testFWInfo.UpdateStatus), - }, - }, - }, - }, - "NVMe - discovery failed": { - req: ctlpb.FirmwareQueryReq{ - QueryNvme: true, - }, - bmbc: &bdev.MockBackendConfig{ - ScanErr: errors.New("mock scan failed"), - }, - expErr: errors.New("mock scan failed"), - }, - "NVMe - no devices": { - req: ctlpb.FirmwareQueryReq{ - QueryNvme: true, - }, - bmbc: &bdev.MockBackendConfig{}, - expResp: &ctlpb.FirmwareQueryResp{ - NvmeResults: []*ctlpb.NvmeFirmwareQueryResp{}, - }, - }, - "NVMe - success with devices": { - req: ctlpb.FirmwareQueryReq{ - QueryNvme: true, - }, - bmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: testNVMeDevs}, - }, - expResp: &ctlpb.FirmwareQueryResp{ - NvmeResults: testNVMeResults, - }, - }, - "NVMe - filter by FW rev": { - req: ctlpb.FirmwareQueryReq{ - QueryNvme: true, - FirmwareRev: "fwRev-0", - }, - bmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: testNVMeDevs}, - }, - expResp: &ctlpb.FirmwareQueryResp{ - NvmeResults: []*ctlpb.NvmeFirmwareQueryResp{ - { - Device: mockPbNVMeDevs[0], - }, - }, - }, - }, - "NVMe - filter by model ID": { - req: ctlpb.FirmwareQueryReq{ - QueryNvme: true, - ModelID: "model-1", - }, - bmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: testNVMeDevs}, - }, - expResp: &ctlpb.FirmwareQueryResp{ - NvmeResults: []*ctlpb.NvmeFirmwareQueryResp{ - { - Device: mockPbNVMeDevs[1], - }, - }, - }, - }, - "NVMe - specific devices": { - req: ctlpb.FirmwareQueryReq{ - QueryNvme: true, - DeviceIDs: []string{"0000:01:00.0", "0000:02:00.0"}, - }, - bmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: testNVMeDevs}, - }, - expResp: &ctlpb.FirmwareQueryResp{ - NvmeResults: []*ctlpb.NvmeFirmwareQueryResp{ - { - Device: mockPbNVMeDevs[1], - }, - { - Device: mockPbNVMeDevs[2], - }, - }, - }, - }, - "both - success with devices": { - req: ctlpb.FirmwareQueryReq{ - QueryNvme: true, - QueryScm: true, - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: mockSCM, - GetFirmwareStatusRes: testFWInfo, - }, - bmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: testNVMeDevs}, - }, - expResp: &ctlpb.FirmwareQueryResp{ - ScmResults: []*ctlpb.ScmFirmwareQueryResp{ - { - Module: mockPbSCM[0], - ActiveVersion: testFWInfo.ActiveVersion, - StagedVersion: testFWInfo.StagedVersion, - ImageMaxSizeBytes: testFWInfo.ImageMaxSizeBytes, - UpdateStatus: uint32(testFWInfo.UpdateStatus), - }, - { - Module: mockPbSCM[1], - ActiveVersion: testFWInfo.ActiveVersion, - StagedVersion: testFWInfo.StagedVersion, - ImageMaxSizeBytes: testFWInfo.ImageMaxSizeBytes, - UpdateStatus: uint32(testFWInfo.UpdateStatus), - }, - { - Module: mockPbSCM[2], - ActiveVersion: testFWInfo.ActiveVersion, - StagedVersion: testFWInfo.StagedVersion, - ImageMaxSizeBytes: testFWInfo.ImageMaxSizeBytes, - UpdateStatus: uint32(testFWInfo.UpdateStatus), - }, - }, - NvmeResults: testNVMeResults, - }, - }, - "both - no SCM found": { - req: ctlpb.FirmwareQueryReq{ - QueryNvme: true, - QueryScm: true, - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: storage.ScmModules{}, - }, - bmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: testNVMeDevs}, - }, - expResp: &ctlpb.FirmwareQueryResp{ - ScmResults: []*ctlpb.ScmFirmwareQueryResp{}, - NvmeResults: testNVMeResults, - }, - }, - "both - no NVMe found": { - req: ctlpb.FirmwareQueryReq{ - QueryNvme: true, - QueryScm: true, - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: mockSCM, - GetFirmwareStatusRes: testFWInfo, - }, - bmbc: &bdev.MockBackendConfig{}, - expResp: &ctlpb.FirmwareQueryResp{ - ScmResults: []*ctlpb.ScmFirmwareQueryResp{ - { - Module: mockPbSCM[0], - ActiveVersion: testFWInfo.ActiveVersion, - StagedVersion: testFWInfo.StagedVersion, - ImageMaxSizeBytes: testFWInfo.ImageMaxSizeBytes, - UpdateStatus: uint32(testFWInfo.UpdateStatus), - }, - { - Module: mockPbSCM[1], - ActiveVersion: testFWInfo.ActiveVersion, - StagedVersion: testFWInfo.StagedVersion, - ImageMaxSizeBytes: testFWInfo.ImageMaxSizeBytes, - UpdateStatus: uint32(testFWInfo.UpdateStatus), - }, - { - Module: mockPbSCM[2], - ActiveVersion: testFWInfo.ActiveVersion, - StagedVersion: testFWInfo.StagedVersion, - ImageMaxSizeBytes: testFWInfo.ImageMaxSizeBytes, - UpdateStatus: uint32(testFWInfo.UpdateStatus), - }, - }, - NvmeResults: []*ctlpb.NvmeFirmwareQueryResp{}, - }, - }, - "both - filter only catches SCM": { - req: ctlpb.FirmwareQueryReq{ - QueryNvme: true, - QueryScm: true, - FirmwareRev: "FWRev0", - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: mockSCM, - GetFirmwareStatusRes: testFWInfo, - }, - bmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: testNVMeDevs}, - }, - expResp: &ctlpb.FirmwareQueryResp{ - ScmResults: []*ctlpb.ScmFirmwareQueryResp{ - { - Module: mockPbSCM[0], - ActiveVersion: testFWInfo.ActiveVersion, - StagedVersion: testFWInfo.StagedVersion, - ImageMaxSizeBytes: testFWInfo.ImageMaxSizeBytes, - UpdateStatus: uint32(testFWInfo.UpdateStatus), - }, - }, - NvmeResults: []*ctlpb.NvmeFirmwareQueryResp{}, - }, - }, - "both - filter only catches NVMe": { - req: ctlpb.FirmwareQueryReq{ - QueryNvme: true, - QueryScm: true, - ModelID: "model-0", - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: mockSCM, - GetFirmwareStatusRes: testFWInfo, - }, - bmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: testNVMeDevs}, - }, - expResp: &ctlpb.FirmwareQueryResp{ - ScmResults: []*ctlpb.ScmFirmwareQueryResp{}, - NvmeResults: []*ctlpb.NvmeFirmwareQueryResp{ - { - Device: mockPbNVMeDevs[0], - }, - }, - }, - }, - "both - specific devices": { - req: ctlpb.FirmwareQueryReq{ - QueryNvme: true, - QueryScm: true, - DeviceIDs: []string{"0000:01:00.0", "Device0", "0000:02:00.0"}, - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: mockSCM, - GetFirmwareStatusRes: testFWInfo, - }, - bmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: testNVMeDevs}, - }, - expResp: &ctlpb.FirmwareQueryResp{ - ScmResults: []*ctlpb.ScmFirmwareQueryResp{ - { - Module: mockPbSCM[0], - ActiveVersion: testFWInfo.ActiveVersion, - StagedVersion: testFWInfo.StagedVersion, - ImageMaxSizeBytes: testFWInfo.ImageMaxSizeBytes, - UpdateStatus: uint32(testFWInfo.UpdateStatus), - }, - }, - NvmeResults: []*ctlpb.NvmeFirmwareQueryResp{ - { - Device: mockPbNVMeDevs[1], - }, - - { - Device: mockPbNVMeDevs[2], - }, - }, - }, - }, - } { - t.Run(name, func(t *testing.T) { - log, buf := logging.NewTestLogger(t.Name()) - defer test.ShowBufferOnFailure(t, buf) - - config := config.DefaultServer() - cs := mockControlService(t, log, config, tc.bmbc, tc.smbc, nil) - - resp, err := cs.FirmwareQuery(test.Context(t), &tc.req) - - test.CmpErr(t, tc.expErr, err) - - if diff := cmp.Diff(tc.expResp, resp, test.DefaultCmpOpts()...); diff != "" { - t.Fatalf("unexpected response (-want, +got):\n%s\n", diff) - } - }) - } -} - -func TestCtlSvc_FirmwareUpdate(t *testing.T) { - mockSCM := storage.MockScmModules(3) - mockPbSCM := getProtoScmModules(t, mockSCM) - mockNVMe := storage.MockNvmeControllers(3) - - for name, tc := range map[string]struct { - bmbc *bdev.MockBackendConfig - smbc *scm.MockBackendConfig - enginesRunning bool - noRankEngines bool - req ctlpb.FirmwareUpdateReq - expErr error - expResp *ctlpb.FirmwareUpdateResp - }{ - "IO engines running": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_SCM, - FirmwarePath: "/some/path", - }, - enginesRunning: true, - expErr: FaultInstancesNotStopped("firmware update", 0), - }, - "IO engines running with no rank": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_SCM, - FirmwarePath: "/some/path", - }, - enginesRunning: true, - noRankEngines: true, - expErr: errors.New("unidentified server rank is running"), - }, - "no path": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_SCM, - }, - expErr: errors.New("missing path to firmware file"), - }, - "invalid device type": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_DeviceType(0xFFFF), - }, - expErr: errors.New("unrecognized device type"), - }, - "SCM - discovery failed": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_SCM, - FirmwarePath: "/some/path", - }, - smbc: &scm.MockBackendConfig{ - GetModulesErr: errors.New("mock discovery failed"), - }, - expErr: errors.New("mock discovery failed"), - }, - "SCM - no devices": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_SCM, - FirmwarePath: "/some/path", - }, - smbc: &scm.MockBackendConfig{}, - expErr: errors.New("no SCM modules"), - }, - "SCM - success with devices": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_SCM, - FirmwarePath: "/some/path", - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: mockSCM, - UpdateFirmwareErr: nil, - }, - expResp: &ctlpb.FirmwareUpdateResp{ - ScmResults: []*ctlpb.ScmFirmwareUpdateResp{ - { - Module: mockPbSCM[0], - }, - { - Module: mockPbSCM[1], - }, - { - Module: mockPbSCM[2], - }, - }, - }, - }, - "SCM - failed with devices": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_SCM, - FirmwarePath: "/some/path", - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: mockSCM, - UpdateFirmwareErr: errors.New("mock update"), - }, - expResp: &ctlpb.FirmwareUpdateResp{ - ScmResults: []*ctlpb.ScmFirmwareUpdateResp{ - { - Module: mockPbSCM[0], - Error: "mock update", - }, - { - Module: mockPbSCM[1], - Error: "mock update", - }, - { - Module: mockPbSCM[2], - Error: "mock update", - }, - }, - }, - }, - "SCM - filter by FW rev": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_SCM, - FirmwarePath: "/some/path", - FirmwareRev: "FWRev2", - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: mockSCM, - UpdateFirmwareErr: nil, - }, - expResp: &ctlpb.FirmwareUpdateResp{ - ScmResults: []*ctlpb.ScmFirmwareUpdateResp{ - { - Module: mockPbSCM[2], - }, - }, - }, - }, - "SCM - filter by model ID": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_SCM, - FirmwarePath: "/some/path", - ModelID: "PartNumber1", - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: mockSCM, - UpdateFirmwareErr: nil, - }, - expResp: &ctlpb.FirmwareUpdateResp{ - ScmResults: []*ctlpb.ScmFirmwareUpdateResp{ - { - Module: mockPbSCM[1], - }, - }, - }, - }, - "SCM - specific devices": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_SCM, - FirmwarePath: "/some/path", - DeviceIDs: []string{"Device1", "Device2"}, - }, - smbc: &scm.MockBackendConfig{ - GetModulesRes: mockSCM, - UpdateFirmwareErr: nil, - }, - expResp: &ctlpb.FirmwareUpdateResp{ - ScmResults: []*ctlpb.ScmFirmwareUpdateResp{ - { - Module: mockPbSCM[1], - }, - { - Module: mockPbSCM[2], - }, - }, - }, - }, - "NVMe - scan failed": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_NVMe, - FirmwarePath: "/some/path", - }, - bmbc: &bdev.MockBackendConfig{ - ScanErr: errors.New("mock scan failed"), - }, - expErr: errors.New("mock scan failed"), - }, - "NVMe - no devices": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_NVMe, - FirmwarePath: "/some/path", - }, - bmbc: &bdev.MockBackendConfig{}, - expErr: errors.New("no NVMe device controllers"), - }, - "NVMe - success with devices": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_NVMe, - FirmwarePath: "/some/path", - }, - bmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: mockNVMe}, - }, - expResp: &ctlpb.FirmwareUpdateResp{ - NvmeResults: []*ctlpb.NvmeFirmwareUpdateResp{ - { - PciAddr: mockNVMe[0].PciAddr, - }, - { - PciAddr: mockNVMe[1].PciAddr, - }, - { - PciAddr: mockNVMe[2].PciAddr, - }, - }, - }, - }, - "NVMe - failure with devices": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_NVMe, - FirmwarePath: "/some/path", - }, - bmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: mockNVMe}, - UpdateErr: errors.New("mock update"), - }, - expResp: &ctlpb.FirmwareUpdateResp{ - NvmeResults: []*ctlpb.NvmeFirmwareUpdateResp{ - { - PciAddr: mockNVMe[0].PciAddr, - Error: "mock update", - }, - { - PciAddr: mockNVMe[1].PciAddr, - Error: "mock update", - }, - { - PciAddr: mockNVMe[2].PciAddr, - Error: "mock update", - }, - }, - }, - }, - "NVMe - filter by FW rev": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_NVMe, - FirmwarePath: "/some/path", - FirmwareRev: "fwRev-0", - }, - bmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: mockNVMe}, - }, - expResp: &ctlpb.FirmwareUpdateResp{ - NvmeResults: []*ctlpb.NvmeFirmwareUpdateResp{ - { - PciAddr: mockNVMe[0].PciAddr, - }, - }, - }, - }, - "NVMe - filter by model ID": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_NVMe, - FirmwarePath: "/some/path", - ModelID: "model-2", - }, - bmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: mockNVMe}, - }, - expResp: &ctlpb.FirmwareUpdateResp{ - NvmeResults: []*ctlpb.NvmeFirmwareUpdateResp{ - { - PciAddr: mockNVMe[2].PciAddr, - }, - }, - }, - }, - "NVMe - specific devices": { - req: ctlpb.FirmwareUpdateReq{ - Type: ctlpb.FirmwareUpdateReq_NVMe, - FirmwarePath: "/some/path", - DeviceIDs: []string{"0000:00:00.0", "0000:01:00.0"}, - }, - bmbc: &bdev.MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: mockNVMe}, - }, - expResp: &ctlpb.FirmwareUpdateResp{ - NvmeResults: []*ctlpb.NvmeFirmwareUpdateResp{ - { - PciAddr: mockNVMe[0].PciAddr, - }, - { - PciAddr: mockNVMe[1].PciAddr, - }, - }, - }, - }, - } { - t.Run(name, func(t *testing.T) { - log, buf := logging.NewTestLogger(t.Name()) - defer test.ShowBufferOnFailure(t, buf) - - cfg := config.DefaultServer() - cs := mockControlService(t, log, cfg, tc.bmbc, tc.smbc, nil) - for i := 0; i < 2; i++ { - instance := NewEngineInstance(log, nil, nil, nil, nil) - setupTestEngine(t, instance, uint32(i), !tc.enginesRunning) - if tc.noRankEngines { - instance._superblock = nil - } - if err := cs.harness.AddInstance(instance); err != nil { - t.Fatal(err) - } - } - - resp, err := cs.FirmwareUpdate(test.Context(t), &tc.req) - - test.CmpErr(t, tc.expErr, err) - - if diff := cmp.Diff(tc.expResp, resp, test.DefaultCmpOpts()...); diff != "" { - t.Fatalf("unexpected response (-want, +got):\n%s\n", diff) - } - }) - } -} diff --git a/src/control/server/harness.go b/src/control/server/harness.go index 5ad9f495cb6..3f9ebe40c71 100644 --- a/src/control/server/harness.go +++ b/src/control/server/harness.go @@ -1,6 +1,6 @@ // // (C) Copyright 2019-2024 Intel Corporation. -// (C) Copyright 2025 Hewlett Packard Enterprise Development LP +// (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP // // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -256,7 +256,7 @@ func (h *EngineHarness) Start(ctx context.Context, db dbLeader, cfg *config.Serv } // Now we want to block any RPCs that might try to mess with storage - // (format, firmware update, etc) before attempting to start I/O Engines + // (format, etc) before attempting to start I/O Engines // which are using the storage. h.started.SetTrue() defer h.started.SetFalse() diff --git a/src/control/server/server_utils.go b/src/control/server/server_utils.go index 3ba48002c90..278d2b1c1e9 100644 --- a/src/control/server/server_utils.go +++ b/src/control/server/server_utils.go @@ -483,12 +483,6 @@ func setDaosHelperEnvs(cfg *config.Server, setenv func(k, v string) error) error } } - if cfg.FWHelperLogFile != "" { - if err := setenv(pbin.DaosFWLogFileEnvVar, cfg.FWHelperLogFile); err != nil { - return errors.Wrap(err, "unable to configure privileged firmware helper logging") - } - } - return nil } diff --git a/src/control/server/storage/bdev.go b/src/control/server/storage/bdev.go index a69023ab977..57ae8d971d9 100644 --- a/src/control/server/storage/bdev.go +++ b/src/control/server/storage/bdev.go @@ -543,8 +543,6 @@ type ( Format(BdevFormatRequest) (*BdevFormatResponse, error) WriteConfig(BdevWriteConfigRequest) (*BdevWriteConfigResponse, error) ReadConfig(BdevReadConfigRequest) (*BdevReadConfigResponse, error) - QueryFirmware(NVMeFirmwareQueryRequest) (*NVMeFirmwareQueryResponse, error) - UpdateFirmware(NVMeFirmwareUpdateRequest) (*NVMeFirmwareUpdateResponse, error) } // BdevPrepareRequest defines the parameters for a Prepare operation. @@ -653,46 +651,6 @@ type ( BdevFormatResponse struct { DeviceResponses BdevDeviceFormatResponses } - - // NVMeFirmwareQueryRequest defines the parameters for a Nvme firmware query. - NVMeFirmwareQueryRequest struct { - pbin.ForwardableRequest - DeviceAddrs []string // requested device PCI addresses, empty for all - ModelID string // filter devices by model ID - FirmwareRev string // filter devices by current FW revision - } - - // NVMeDeviceFirmwareQueryResult represents the result of a firmware query for - // a specific NVMe controller. - NVMeDeviceFirmwareQueryResult struct { - Device NvmeController - } - - // NVMeFirmwareQueryResponse contains the results of the firmware query. - NVMeFirmwareQueryResponse struct { - Results []NVMeDeviceFirmwareQueryResult - } - - // NVMeFirmwareUpdateRequest defines the parameters for a firmware update. - NVMeFirmwareUpdateRequest struct { - pbin.ForwardableRequest - DeviceAddrs []string // requested device PCI addresses, empty for all - FirmwarePath string // location of the firmware binary - ModelID string // filter devices by model ID - FirmwareRev string // filter devices by current FW revision - } - - // NVMeDeviceFirmwareUpdateResult represents the result of a firmware update for - // a specific NVMe controller. - NVMeDeviceFirmwareUpdateResult struct { - Device NvmeController - Error string - } - - // NVMeFirmwareUpdateResponse contains the results of the firmware update. - NVMeFirmwareUpdateResponse struct { - Results []NVMeDeviceFirmwareUpdateResult - } ) // getNumaNodeBusidRange sets range parameters in the input request either to user configured @@ -768,13 +726,11 @@ func filterBdevScanResponse(incBdevs *BdevDeviceList, resp *BdevScanResponse) (* type BdevForwarder struct { BdevAdminForwarder - NVMeFirmwareForwarder } func NewBdevForwarder(log logging.Logger) *BdevForwarder { return &BdevForwarder{ - BdevAdminForwarder: *NewBdevAdminForwarder(log), - NVMeFirmwareForwarder: *NewNVMeFirmwareForwarder(log), + BdevAdminForwarder: *NewBdevAdminForwarder(log), } } @@ -853,69 +809,6 @@ func (f *BdevAdminForwarder) ReadConfig(req BdevReadConfigRequest) (*BdevReadCon return res, nil } -const ( - // NVMeFirmwareQueryMethod is the name of the method used to forward the request to - // update NVMe device firmware. - NVMeFirmwareQueryMethod = "NvmeFirmwareQuery" - - // NVMeFirmwareUpdateMethod is the name of the method used to forward the request to - // update NVMe device firmware. - NVMeFirmwareUpdateMethod = "NvmeFirmwareUpdate" -) - -// NVMeFirmwareForwarder forwards firmware requests to a privileged binary. -type NVMeFirmwareForwarder struct { - pbin.Forwarder -} - -// NewNVMeFirmwareForwarder returns a new bdev FirmwareForwarder. -func NewNVMeFirmwareForwarder(log logging.Logger) *NVMeFirmwareForwarder { - pf := pbin.NewForwarder(log, pbin.DaosFWName) - - return &NVMeFirmwareForwarder{ - Forwarder: *pf, - } -} - -// checkSupport verifies that the firmware support binary is installed. -func (f *NVMeFirmwareForwarder) checkSupport() error { - if f.CanForward() { - return nil - } - - return errors.Errorf("NVMe firmware operations are not supported on this system") -} - -// QueryFirmware forwards a request to query firmware on the NVMe device. -func (f *NVMeFirmwareForwarder) QueryFirmware(req NVMeFirmwareQueryRequest) (*NVMeFirmwareQueryResponse, error) { - if err := f.checkSupport(); err != nil { - return nil, err - } - req.Forwarded = true - - res := new(NVMeFirmwareQueryResponse) - if err := f.SendReq(NVMeFirmwareQueryMethod, req, res); err != nil { - return nil, err - } - - return res, nil -} - -// UpdateFirmware forwards a request to update firmware on the NVMe device. -func (f *NVMeFirmwareForwarder) UpdateFirmware(req NVMeFirmwareUpdateRequest) (*NVMeFirmwareUpdateResponse, error) { - if err := f.checkSupport(); err != nil { - return nil, err - } - req.Forwarded = true - - res := new(NVMeFirmwareUpdateResponse) - if err := f.SendReq(NVMeFirmwareUpdateMethod, req, res); err != nil { - return nil, err - } - - return res, nil -} - // CalcMinHugepages returns the minimum number of hugepages that should be // requested for the given number of targets. func CalcMinHugepages(hugepageSizeKb int, numTargets int) (int, error) { diff --git a/src/control/server/storage/bdev/backend.go b/src/control/server/storage/bdev/backend.go index 0921f56d3e8..24731ea3bce 100644 --- a/src/control/server/storage/bdev/backend.go +++ b/src/control/server/storage/bdev/backend.go @@ -696,18 +696,3 @@ func (sb *spdkBackend) ReadConfig(req storage.BdevReadConfigRequest) (*storage.B resp := &storage.BdevReadConfigResponse{} return resp, nil } - -// UpdateFirmware uses the SPDK bindings to update an NVMe controller's firmware. -func (sb *spdkBackend) UpdateFirmware(pciAddr string, path string, slot int32) error { - sb.log.Debug("spdk backend update firmware") - - if pciAddr == "" { - return FaultBadPCIAddr("") - } - - if err := sb.binding.Update(sb.log, pciAddr, path, slot); err != nil { - return err - } - - return nil -} diff --git a/src/control/server/storage/bdev/backend_test.go b/src/control/server/storage/bdev/backend_test.go index 24934d9db62..616ad73c08e 100644 --- a/src/control/server/storage/bdev/backend_test.go +++ b/src/control/server/storage/bdev/backend_test.go @@ -701,47 +701,6 @@ func TestBackend_writeNvmeConfig(t *testing.T) { } } -func TestBackend_Update(t *testing.T) { - numCtrlrs := 4 - controllers := make(storage.NvmeControllers, 0, numCtrlrs) - for i := 0; i < numCtrlrs; i++ { - c := mockSpdkController(int32(i)) - controllers = append(controllers, &c) - } - - for name, tc := range map[string]struct { - pciAddr string - mec spdk.MockEnvCfg - mnc spdk.MockNvmeCfg - expErr error - }{ - "no PCI addr": { - expErr: FaultBadPCIAddr(""), - }, - "binding update fail": { - pciAddr: controllers[0].PciAddr, - mnc: spdk.MockNvmeCfg{ - UpdateErr: errors.New("spdk says no"), - }, - expErr: errors.New("spdk says no"), - }, - "binding update success": { - pciAddr: controllers[0].PciAddr, - expErr: nil, - }, - } { - t.Run(name, func(t *testing.T) { - log, buf := logging.NewTestLogger(name) - defer test.ShowBufferOnFailure(t, buf) - - b := backendWithMockBinding(log, tc.mec, tc.mnc) - - gotErr := b.UpdateFirmware(tc.pciAddr, "/some/path", 0) - test.CmpErr(t, tc.expErr, gotErr) - }) - } -} - type mockFileInfo struct { name string size int64 diff --git a/src/control/server/storage/bdev/firmware.go b/src/control/server/storage/bdev/firmware.go deleted file mode 100644 index 1d59998e4ab..00000000000 --- a/src/control/server/storage/bdev/firmware.go +++ /dev/null @@ -1,135 +0,0 @@ -// -// (C) Copyright 2020-2022 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -package bdev - -import ( - "github.com/pkg/errors" - - "github.com/daos-stack/daos/src/control/common" - "github.com/daos-stack/daos/src/control/server/storage" -) - -const ( - // defaultFirmwareSlot is the slot automatically chosen for the firmware - // update - defaultFirmwareSlot = 0 -) - -// QueryFirmware requests the firmware information for the NVMe device controller. -func (p *Provider) QueryFirmware(req storage.NVMeFirmwareQueryRequest) (*storage.NVMeFirmwareQueryResponse, error) { - // For the time being this just scans and returns the devices, which include their - // firmware revision. - controllers, err := p.getRequestedControllers(req.DeviceAddrs, req.ModelID, req.FirmwareRev, true) - if err != nil { - return nil, err - } - - results := make([]storage.NVMeDeviceFirmwareQueryResult, len(controllers)) - for i, dev := range controllers { - results[i].Device = *dev - } - resp := &storage.NVMeFirmwareQueryResponse{ - Results: results, - } - - return resp, nil -} - -func (p *Provider) getRequestedControllers(requestedPCIAddrs []string, modelID string, fwRev string, ignoreMissing bool) (storage.NvmeControllers, error) { - controllers, err := p.getRequestedControllersByAddr(requestedPCIAddrs, ignoreMissing) - if err != nil { - return nil, err - } - filtered := filterControllersByModelFirmware(controllers, modelID, fwRev) - if !ignoreMissing && len(filtered) == 0 { - return nil, FaultNoFilterMatch - } - return filtered, nil -} - -func (p *Provider) getRequestedControllersByAddr(requestedPCIAddrs []string, ignoreMissing bool) (storage.NvmeControllers, error) { - resp, err := p.Scan(storage.BdevScanRequest{}) - if err != nil { - return nil, err - } - - if !ignoreMissing && len(resp.Controllers) == 0 { - return nil, errors.New("no NVMe device controllers") - } - - if len(requestedPCIAddrs) == 0 { - return resp.Controllers, nil - } - - if common.StringSliceHasDuplicates(requestedPCIAddrs) { - return nil, FaultDuplicateDevices - } - - result := make(storage.NvmeControllers, 0, len(requestedPCIAddrs)) - for _, addr := range requestedPCIAddrs { - dev, err := getDeviceController(addr, resp.Controllers) - if err != nil { - if ignoreMissing { - continue - } - return nil, err - } - result = append(result, dev) - } - - return result, nil -} - -func getDeviceController(pciAddr string, controllers storage.NvmeControllers) (*storage.NvmeController, error) { - for _, dev := range controllers { - if dev.PciAddr == pciAddr { - return dev, nil - } - } - - return nil, storage.FaultBdevNotFound(false, pciAddr) -} - -func filterControllersByModelFirmware(controllers storage.NvmeControllers, modelID, fwRev string) storage.NvmeControllers { - selected := make(storage.NvmeControllers, 0, len(controllers)) - for _, ctrlr := range controllers { - if common.FilterStringMatches(modelID, ctrlr.Model) && - common.FilterStringMatches(fwRev, ctrlr.FwRev) { - selected = append(selected, ctrlr) - } - } - return selected -} - -// UpdateFirmware updates the NVMe device controller firmware. -func (p *Provider) UpdateFirmware(req storage.NVMeFirmwareUpdateRequest) (*storage.NVMeFirmwareUpdateResponse, error) { - if len(req.FirmwarePath) == 0 { - return nil, errors.New("missing path to firmware file") - } - - controllers, err := p.getRequestedControllers(req.DeviceAddrs, req.ModelID, req.FirmwareRev, false) - if err != nil { - return nil, err - } - - if len(controllers) == 0 { - return nil, errors.New("no NVMe device controllers") - } - - resp := &storage.NVMeFirmwareUpdateResponse{ - Results: make([]storage.NVMeDeviceFirmwareUpdateResult, len(controllers)), - } - for i, con := range controllers { - err = p.backend.UpdateFirmware(con.PciAddr, req.FirmwarePath, defaultFirmwareSlot) - resp.Results[i].Device = *con - if err != nil { - resp.Results[i].Error = err.Error() - } - } - - return resp, nil -} diff --git a/src/control/server/storage/bdev/firmware_test.go b/src/control/server/storage/bdev/firmware_test.go deleted file mode 100644 index 35c4df09a0a..00000000000 --- a/src/control/server/storage/bdev/firmware_test.go +++ /dev/null @@ -1,420 +0,0 @@ -// -// (C) Copyright 2020-2022 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -package bdev - -import ( - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" - - "github.com/daos-stack/daos/src/control/common/test" - "github.com/daos-stack/daos/src/control/logging" - "github.com/daos-stack/daos/src/control/server/storage" -) - -func TestProvider_QueryFirmware(t *testing.T) { - defaultDevs := storage.MockNvmeControllers(3) - - for name, tc := range map[string]struct { - input storage.NVMeFirmwareQueryRequest - backendCfg *MockBackendConfig - expErr error - expRes *storage.NVMeFirmwareQueryResponse - }{ - "NVMe device scan failed": { - input: storage.NVMeFirmwareQueryRequest{}, - backendCfg: &MockBackendConfig{ScanErr: errors.New("mock scan")}, - expErr: errors.New("mock scan"), - }, - "no devices": { - input: storage.NVMeFirmwareQueryRequest{}, - backendCfg: &MockBackendConfig{}, - expRes: &storage.NVMeFirmwareQueryResponse{ - Results: []storage.NVMeDeviceFirmwareQueryResult{}, - }, - }, - "success": { - input: storage.NVMeFirmwareQueryRequest{}, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expRes: &storage.NVMeFirmwareQueryResponse{ - Results: []storage.NVMeDeviceFirmwareQueryResult{ - { - Device: *defaultDevs[0], - }, - { - Device: *defaultDevs[1], - }, - { - Device: *defaultDevs[2], - }, - }, - }, - }, - "request device subset": { - input: storage.NVMeFirmwareQueryRequest{ - DeviceAddrs: []string{"0000:00:00.0", "0000:02:00.0"}, - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expRes: &storage.NVMeFirmwareQueryResponse{ - Results: []storage.NVMeDeviceFirmwareQueryResult{ - { - Device: *defaultDevs[0], - }, - { - Device: *defaultDevs[2], - }, - }, - }, - }, - "request nonexistent device - ignored": { - input: storage.NVMeFirmwareQueryRequest{ - DeviceAddrs: []string{"0000:00:00.0", "fake"}, - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expRes: &storage.NVMeFirmwareQueryResponse{ - Results: []storage.NVMeDeviceFirmwareQueryResult{ - { - Device: *defaultDevs[0], - }, - }, - }, - }, - "request duplicates": { - input: storage.NVMeFirmwareQueryRequest{ - DeviceAddrs: []string{"0000:01:00.0", "0000:01:00.0"}, - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expErr: FaultDuplicateDevices, - }, - "filter by model ID": { - input: storage.NVMeFirmwareQueryRequest{ - ModelID: "model-1", - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expRes: &storage.NVMeFirmwareQueryResponse{ - Results: []storage.NVMeDeviceFirmwareQueryResult{ - { - Device: *defaultDevs[1], - }, - }, - }, - }, - "filter by FW rev": { - input: storage.NVMeFirmwareQueryRequest{ - FirmwareRev: "fwRev-2", - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expRes: &storage.NVMeFirmwareQueryResponse{ - Results: []storage.NVMeDeviceFirmwareQueryResult{ - { - Device: *defaultDevs[2], - }, - }, - }, - }, - "nothing in system matches filters": { - input: storage.NVMeFirmwareQueryRequest{ - ModelID: "model-123", - FirmwareRev: "fwRev-123", - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expRes: &storage.NVMeFirmwareQueryResponse{ - Results: []storage.NVMeDeviceFirmwareQueryResult{}, - }, - }, - "must match all requested filters": { - input: storage.NVMeFirmwareQueryRequest{ - ModelID: "model-0", - FirmwareRev: "fwRev-1", - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expRes: &storage.NVMeFirmwareQueryResponse{ - Results: []storage.NVMeDeviceFirmwareQueryResult{}, - }, - }, - "case insensitive filters": { - input: storage.NVMeFirmwareQueryRequest{ - ModelID: "MODEL-0", - FirmwareRev: "FWREV-0", - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expRes: &storage.NVMeFirmwareQueryResponse{ - Results: []storage.NVMeDeviceFirmwareQueryResult{ - { - Device: *defaultDevs[0], - }, - }, - }, - }, - "nothing in device list matches filters": { - input: storage.NVMeFirmwareQueryRequest{ - DeviceAddrs: []string{"0000:01:00.0", "0000:02:00.0"}, - ModelID: "model-0", - FirmwareRev: "fwRev-0", - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expRes: &storage.NVMeFirmwareQueryResponse{ - Results: []storage.NVMeDeviceFirmwareQueryResult{}, - }, - }, - } { - t.Run(name, func(t *testing.T) { - log, buf := logging.NewTestLogger(t.Name()) - defer test.ShowBufferOnFailure(t, buf) - - p := NewMockProvider(log, tc.backendCfg) - - res, err := p.QueryFirmware(tc.input) - - test.CmpErr(t, tc.expErr, err) - - if diff := cmp.Diff(tc.expRes, res); diff != "" { - t.Fatalf("unexpected response (-want, +got):\n%s\n", diff) - } - }) - } -} - -func TestProvider_UpdateFirmware(t *testing.T) { - defaultDevs := storage.MockNvmeControllers(3) - - testErr := errors.New("test error") - testPath := "/some/path/file.bin" - - for name, tc := range map[string]struct { - input storage.NVMeFirmwareUpdateRequest - backendCfg *MockBackendConfig - expErr error - expRes *storage.NVMeFirmwareUpdateResponse - }{ - "empty path": { - expErr: errors.New("missing path to firmware file"), - }, - "NVMe device scan failed": { - input: storage.NVMeFirmwareUpdateRequest{FirmwarePath: testPath}, - backendCfg: &MockBackendConfig{ScanErr: errors.New("mock scan")}, - expErr: errors.New("mock scan"), - }, - "no devices": { - input: storage.NVMeFirmwareUpdateRequest{FirmwarePath: testPath}, - expErr: errors.New("no NVMe device controllers"), - }, - "success": { - input: storage.NVMeFirmwareUpdateRequest{FirmwarePath: testPath}, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expRes: &storage.NVMeFirmwareUpdateResponse{ - Results: []storage.NVMeDeviceFirmwareUpdateResult{ - { - Device: *defaultDevs[0], - }, - { - Device: *defaultDevs[1], - }, - { - Device: *defaultDevs[2], - }, - }, - }, - }, - "update failed": { - input: storage.NVMeFirmwareUpdateRequest{FirmwarePath: testPath}, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - UpdateErr: testErr, - }, - expRes: &storage.NVMeFirmwareUpdateResponse{ - Results: []storage.NVMeDeviceFirmwareUpdateResult{ - { - Device: *defaultDevs[0], - Error: testErr.Error(), - }, - { - Device: *defaultDevs[1], - Error: testErr.Error(), - }, - { - Device: *defaultDevs[2], - Error: testErr.Error(), - }, - }, - }, - }, - "request device subset": { - input: storage.NVMeFirmwareUpdateRequest{ - DeviceAddrs: []string{"0000:00:00.0", "0000:02:00.0"}, - FirmwarePath: testPath, - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expRes: &storage.NVMeFirmwareUpdateResponse{ - Results: []storage.NVMeDeviceFirmwareUpdateResult{ - { - Device: *defaultDevs[0], - }, - { - Device: *defaultDevs[2], - }, - }, - }, - }, - "request nonexistent device": { - input: storage.NVMeFirmwareUpdateRequest{ - DeviceAddrs: []string{"0000:00:00.0", "fake"}, - FirmwarePath: testPath, - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expErr: storage.FaultBdevNotFound(false, "fake"), - }, - "request duplicates": { - input: storage.NVMeFirmwareUpdateRequest{ - DeviceAddrs: []string{"0000:00:00.0", "0000:00:00.0"}, - FirmwarePath: testPath, - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expErr: FaultDuplicateDevices, - }, - "filter by model ID": { - input: storage.NVMeFirmwareUpdateRequest{ - FirmwarePath: testPath, - ModelID: "model-1", - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expRes: &storage.NVMeFirmwareUpdateResponse{ - Results: []storage.NVMeDeviceFirmwareUpdateResult{ - { - Device: *defaultDevs[1], - }, - }, - }, - }, - "filter by FW rev": { - input: storage.NVMeFirmwareUpdateRequest{ - FirmwarePath: testPath, - FirmwareRev: "fwRev-2", - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expRes: &storage.NVMeFirmwareUpdateResponse{ - Results: []storage.NVMeDeviceFirmwareUpdateResult{ - { - Device: *defaultDevs[2], - }, - }, - }, - }, - "nothing in system matches filters": { - input: storage.NVMeFirmwareUpdateRequest{ - FirmwarePath: testPath, - ModelID: "model-123", - FirmwareRev: "fwRev-123", - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expErr: FaultNoFilterMatch, - }, - "must match all requested filters": { - input: storage.NVMeFirmwareUpdateRequest{ - FirmwarePath: testPath, - ModelID: "model-0", - FirmwareRev: "fwRev-1", - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expErr: FaultNoFilterMatch, - }, - "case insensitive filters": { - input: storage.NVMeFirmwareUpdateRequest{ - FirmwarePath: testPath, - ModelID: "MODEL-0", - FirmwareRev: "FWREV-0", - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expRes: &storage.NVMeFirmwareUpdateResponse{ - Results: []storage.NVMeDeviceFirmwareUpdateResult{ - { - Device: *defaultDevs[0], - }, - }, - }, - }, - "nothing in device list matches filters": { - input: storage.NVMeFirmwareUpdateRequest{ - FirmwarePath: testPath, - DeviceAddrs: []string{"0000:01:00.0", "0000:02:00.0"}, - ModelID: "model-0", - FirmwareRev: "fwRev-0", - }, - backendCfg: &MockBackendConfig{ - ScanRes: &storage.BdevScanResponse{Controllers: defaultDevs}, - }, - expErr: FaultNoFilterMatch, - }, - } { - t.Run(name, func(t *testing.T) { - log, buf := logging.NewTestLogger(t.Name()) - defer test.ShowBufferOnFailure(t, buf) - - p := NewMockProvider(log, tc.backendCfg) - - res, err := p.UpdateFirmware(tc.input) - - test.CmpErr(t, tc.expErr, err) - - if diff := cmp.Diff(tc.expRes, res); diff != "" { - t.Fatalf("unexpected response (-want, +got):\n%s\n", diff) - } - }) - } -} - -/* todo_tiering -func TestProvider_WithFirmwareForwarder(t *testing.T) { - log, buf := logging.NewTestLogger(t.Name()) - defer test.ShowBufferOnFailure(t, buf) - - provider := NewProvider(log, DefaultMockBackend()) - - if provider.fwFwd == nil { - t.Fatal("forwarder is nil") - } -} -todo_tiering */ diff --git a/src/control/server/storage/bdev/mocks.go b/src/control/server/storage/bdev/mocks.go index 300d4ae892a..f84d8d449c7 100644 --- a/src/control/server/storage/bdev/mocks.go +++ b/src/control/server/storage/bdev/mocks.go @@ -1,5 +1,6 @@ // // (C) Copyright 2019-2022 Intel Corporation. +// (C) Copyright 2026 Hewlett Packard Enterprise Development LP // (C) Copyright 2025 Google LLC // // SPDX-License-Identifier: BSD-2-Clause-Patent @@ -110,10 +111,6 @@ func (mb *MockBackend) Reset(req storage.BdevPrepareRequest) (*storage.BdevPrepa } } -func (mb *MockBackend) UpdateFirmware(_ string, _ string, _ int32) error { - return mb.cfg.UpdateErr -} - func (mb *MockBackend) WriteConfig(req storage.BdevWriteConfigRequest) (*storage.BdevWriteConfigResponse, error) { mb.Lock() mb.WriteConfCalls = append(mb.WriteConfCalls, req) diff --git a/src/control/server/storage/bdev/provider.go b/src/control/server/storage/bdev/provider.go index d823dad185b..ccf340e4d01 100644 --- a/src/control/server/storage/bdev/provider.go +++ b/src/control/server/storage/bdev/provider.go @@ -1,6 +1,6 @@ // // (C) Copyright 2019-2023 Intel Corporation. -// (C) Copyright 2025 Hewlett Packard Enterprise Development LP +// (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP // (C) Copyright 2025 Google LLC // // SPDX-License-Identifier: BSD-2-Clause-Patent @@ -24,7 +24,6 @@ type ( Reset(storage.BdevPrepareRequest) (*storage.BdevPrepareResponse, error) Scan(storage.BdevScanRequest) (*storage.BdevScanResponse, error) Format(storage.BdevFormatRequest) (*storage.BdevFormatResponse, error) - UpdateFirmware(pciAddr string, path string, slot int32) error WriteConfig(storage.BdevWriteConfigRequest) (*storage.BdevWriteConfigResponse, error) ReadConfig(storage.BdevReadConfigRequest) (*storage.BdevReadConfigResponse, error) } diff --git a/src/control/server/storage/mocks.go b/src/control/server/storage/mocks.go index f795c29dc29..fda2dc796e9 100644 --- a/src/control/server/storage/mocks.go +++ b/src/control/server/storage/mocks.go @@ -422,22 +422,18 @@ func (m *MockMetadataProvider) NeedsFormat(MetadataFormatRequest) (bool, error) // MockScmProvider defines a mock version of an ScmProvider. type MockScmProvider struct { - MountRes *MountResponse - MountErr error - UnmountRes *MountResponse - UnmountErr error - FormatRes *ScmFormatResponse - FormatErr error - CheckFormatRes *ScmFormatResponse - CheckFormatErr error - ScanRes *ScmScanResponse - ScanErr error - PrepareRes *ScmPrepareResponse - PrepareErr error - FirmwareQueryRes *ScmFirmwareQueryResponse - FirmwareQueryErr error - FirmwareUpdateRes *ScmFirmwareUpdateResponse - FirmwareUpdateErr error + MountRes *MountResponse + MountErr error + UnmountRes *MountResponse + UnmountErr error + FormatRes *ScmFormatResponse + FormatErr error + CheckFormatRes *ScmFormatResponse + CheckFormatErr error + ScanRes *ScmScanResponse + ScanErr error + PrepareRes *ScmPrepareResponse + PrepareErr error } func (m *MockScmProvider) Mount(ScmMountRequest) (*MountResponse, error) { @@ -464,30 +460,18 @@ func (m *MockScmProvider) Prepare(ScmPrepareRequest) (*ScmPrepareResponse, error return m.PrepareRes, m.PrepareErr } -func (m *MockScmProvider) QueryFirmware(ScmFirmwareQueryRequest) (*ScmFirmwareQueryResponse, error) { - return m.FirmwareQueryRes, m.FirmwareQueryErr -} - -func (m *MockScmProvider) UpdateFirmware(ScmFirmwareUpdateRequest) (*ScmFirmwareUpdateResponse, error) { - return m.FirmwareUpdateRes, m.FirmwareUpdateErr -} - type mockBdevProvider struct { - callCounts map[string]int - PrepareErr error - PrepareResp *BdevPrepareResponse - ScanErr error - ScanResp *BdevScanResponse - FormatErr error - FormatResp *BdevFormatResponse - WriteConfigErr error - WriteConfigResp *BdevWriteConfigResponse - ReadConfigErr error - ReadConfigResp *BdevReadConfigResponse - QueryFirmwareErr error - QueryFirmwareResp *NVMeFirmwareQueryResponse - UpdateFirmwareErr error - UpdateFirmwareResp *NVMeFirmwareUpdateResponse + callCounts map[string]int + PrepareErr error + PrepareResp *BdevPrepareResponse + ScanErr error + ScanResp *BdevScanResponse + FormatErr error + FormatResp *BdevFormatResponse + WriteConfigErr error + WriteConfigResp *BdevWriteConfigResponse + ReadConfigErr error + ReadConfigResp *BdevReadConfigResponse } func (m *mockBdevProvider) addCall(name string) { @@ -521,13 +505,3 @@ func (m *mockBdevProvider) ReadConfig(BdevReadConfigRequest) (*BdevReadConfigRes m.addCall("ReadConfig") return m.ReadConfigResp, m.ReadConfigErr } - -func (m *mockBdevProvider) QueryFirmware(NVMeFirmwareQueryRequest) (*NVMeFirmwareQueryResponse, error) { - m.addCall("QueryFirmware") - return m.QueryFirmwareResp, m.QueryFirmwareErr -} - -func (m *mockBdevProvider) UpdateFirmware(NVMeFirmwareUpdateRequest) (*NVMeFirmwareUpdateResponse, error) { - m.addCall("UpdateFirmware") - return m.UpdateFirmwareResp, m.UpdateFirmwareErr -} diff --git a/src/control/server/storage/provider.go b/src/control/server/storage/provider.go index e6f1380cc29..402da64b190 100644 --- a/src/control/server/storage/provider.go +++ b/src/control/server/storage/provider.go @@ -433,16 +433,6 @@ func (p *Provider) GetBdevConfigs() TierConfigs { return p.engineStorage.Tiers.BdevConfigs() } -// QueryScmFirmware queries PMem SSD firmware. -func (p *Provider) QueryScmFirmware(req ScmFirmwareQueryRequest) (*ScmFirmwareQueryResponse, error) { - return p.scm.QueryFirmware(req) -} - -// UpdateScmFirmware queries PMem SSD firmware. -func (p *Provider) UpdateScmFirmware(req ScmFirmwareUpdateRequest) (*ScmFirmwareUpdateResponse, error) { - return p.scm.UpdateFirmware(req) -} - // PrepareBdevs attempts to configure NVMe devices to be usable by DAOS. func (p *Provider) PrepareBdevs(req BdevPrepareRequest) (*BdevPrepareResponse, error) { resp, err := p.bdev.Prepare(req) @@ -695,16 +685,6 @@ func (p *Provider) BdevRoleMetaConfigured() bool { return false } -// QueryBdevFirmware queries NVMe SSD firmware. -func (p *Provider) QueryBdevFirmware(req NVMeFirmwareQueryRequest) (*NVMeFirmwareQueryResponse, error) { - return p.bdev.QueryFirmware(req) -} - -// UpdateBdevFirmware queries NVMe SSD firmware. -func (p *Provider) UpdateBdevFirmware(req NVMeFirmwareUpdateRequest) (*NVMeFirmwareUpdateResponse, error) { - return p.bdev.UpdateFirmware(req) -} - // UpgradeBdevConfig updates an existing SPDK bdev config, if necessary. func (p *Provider) UpgradeBdevConfig(ctx context.Context, ctrlrs NvmeControllers) error { if !p.HasBlockDevices() { diff --git a/src/control/server/storage/scm.go b/src/control/server/storage/scm.go index 45a132f0d0b..d86ac14acd5 100644 --- a/src/control/server/storage/scm.go +++ b/src/control/server/storage/scm.go @@ -127,43 +127,8 @@ type ( // ScmNamespaces is a type alias for a slice of ScmNamespace references. ScmNamespaces []*ScmNamespace - - // ScmFirmwareUpdateStatus represents the status of a firmware update on the module. - ScmFirmwareUpdateStatus uint32 - - // ScmFirmwareInfo describes the firmware information of an PMem module. - ScmFirmwareInfo struct { - ActiveVersion string - StagedVersion string - ImageMaxSizeBytes uint32 - UpdateStatus ScmFirmwareUpdateStatus - } -) - -const ( - // ScmUpdateStatusUnknown indicates that the firmware update status is unknown. - ScmUpdateStatusUnknown ScmFirmwareUpdateStatus = iota - // ScmUpdateStatusStaged indicates that a new firmware version has been staged. - ScmUpdateStatusStaged - // ScmUpdateStatusSuccess indicates that the firmware update was successfully applied. - ScmUpdateStatusSuccess - // ScmUpdateStatusFailed indicates that the firmware update failed. - ScmUpdateStatusFailed ) -// String translates the update status to a string -func (s ScmFirmwareUpdateStatus) String() string { - switch s { - case ScmUpdateStatusStaged: - return "Staged" - case ScmUpdateStatusSuccess: - return "Success" - case ScmUpdateStatusFailed: - return "Failed" - } - return "Unknown" -} - func (sm *ScmModule) String() string { health := "" if sm.HealthState != "" { @@ -319,8 +284,6 @@ type ( CheckFormat(ScmFormatRequest) (*ScmFormatResponse, error) Scan(ScmScanRequest) (*ScmScanResponse, error) Prepare(ScmPrepareRequest) (*ScmPrepareResponse, error) - QueryFirmware(ScmFirmwareQueryRequest) (*ScmFirmwareQueryResponse, error) - UpdateFirmware(ScmFirmwareUpdateRequest) (*ScmFirmwareUpdateResponse, error) } // ScmPrepareRequest defines the parameters for a Prepare operation. @@ -388,59 +351,15 @@ type ( Ramdisk *RamdiskParams KernelConfigPath string } - - // ScmFirmwareQueryRequest defines the parameters for a firmware query. - ScmFirmwareQueryRequest struct { - pbin.ForwardableRequest - DeviceUIDs []string // requested device UIDs, empty for all - ModelID string // filter by model ID - FirmwareRev string // filter by current FW revision - } - - // ScmModuleFirmware represents the results of a firmware query for a specific - // PMem module. - ScmModuleFirmware struct { - Module ScmModule - Info *ScmFirmwareInfo - Error string - } - - // ScmFirmwareQueryResponse contains the results of a successful firmware query. - ScmFirmwareQueryResponse struct { - Results []ScmModuleFirmware - } - - // ScmFirmwareUpdateRequest defines the parameters for a firmware update. - ScmFirmwareUpdateRequest struct { - pbin.ForwardableRequest - DeviceUIDs []string // requested device UIDs, empty for all - FirmwarePath string // location of the firmware binary - ModelID string // filter devices by model ID - FirmwareRev string // filter devices by current FW revision - } - - // ScmFirmwareUpdateResult represents the result of a firmware update for - // a specific PMem module. - ScmFirmwareUpdateResult struct { - Module ScmModule - Error string - } - - // ScmFirmwareUpdateResponse contains the results of the firmware update. - ScmFirmwareUpdateResponse struct { - Results []ScmFirmwareUpdateResult - } ) type ScmForwarder struct { ScmAdminForwarder - ScmFwForwarder } func NewScmForwarder(log logging.Logger) *ScmForwarder { return &ScmForwarder{ ScmAdminForwarder: *NewScmAdminForwarder(log), - ScmFwForwarder: *NewScmFwForwarder(log), } } @@ -530,68 +449,6 @@ func (f *ScmAdminForwarder) Prepare(req ScmPrepareRequest) (*ScmPrepareResponse, return res, nil } -const ( - // ScmFirmwareQueryMethod is the method name used when forwarding the request - // to query SCM firmware. - ScmFirmwareQueryMethod = "ScmFirmwareQuery" - // ScmFirmwareUpdateMethod is the method name used when forwarding the request - // to update SCM firmware. - ScmFirmwareUpdateMethod = "ScmFirmwareUpdate" -) - -// ScmFwForwarder forwards firmware requests to a privileged binary. -type ScmFwForwarder struct { - pbin.Forwarder -} - -// NewScmFwForwarder returns a new ScmFwForwarder. -func NewScmFwForwarder(log logging.Logger) *ScmFwForwarder { - pf := pbin.NewForwarder(log, pbin.DaosFWName) - - return &ScmFwForwarder{ - Forwarder: *pf, - } -} - -// checkSupport verifies that the firmware support binary is installed. -func (f *ScmFwForwarder) checkSupport() error { - if f.Forwarder.CanForward() { - return nil - } - - return errors.Errorf("SCM firmware operations are not supported on this system") -} - -// Query forwards an SCM firmware query request. -func (f *ScmFwForwarder) QueryFirmware(req ScmFirmwareQueryRequest) (*ScmFirmwareQueryResponse, error) { - if err := f.checkSupport(); err != nil { - return nil, err - } - req.Forwarded = true - - res := new(ScmFirmwareQueryResponse) - if err := f.SendReq(ScmFirmwareQueryMethod, req, res); err != nil { - return nil, err - } - - return res, nil -} - -// Update forwards a request to update firmware on the SCM. -func (f *ScmFwForwarder) UpdateFirmware(req ScmFirmwareUpdateRequest) (*ScmFirmwareUpdateResponse, error) { - if err := f.checkSupport(); err != nil { - return nil, err - } - req.Forwarded = true - - res := new(ScmFirmwareUpdateResponse) - if err := f.SendReq(ScmFirmwareUpdateMethod, req, res); err != nil { - return nil, err - } - - return res, nil -} - // CalcRamdiskSize returns recommended tmpfs RAM-disk size calculated as // (total mem - hugepage mem - sys rsvd mem - engine rsvd mem) / nr engines. // All values in units of bytes and return value is for a single RAM-disk/engine. diff --git a/src/control/server/storage/scm/firmware.go b/src/control/server/storage/scm/firmware.go deleted file mode 100644 index 0f4bb66782f..00000000000 --- a/src/control/server/storage/scm/firmware.go +++ /dev/null @@ -1,127 +0,0 @@ -// -// (C) Copyright 2020-2022 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -package scm - -import ( - "fmt" - "sort" - - "github.com/pkg/errors" - - "github.com/daos-stack/daos/src/control/common" - "github.com/daos-stack/daos/src/control/server/storage" -) - -// QueryFirmware fetches the status of SCM device firmware. -func (p *Provider) QueryFirmware(req storage.ScmFirmwareQueryRequest) (*storage.ScmFirmwareQueryResponse, error) { - // For query we won't complain about bad IDs - modules, err := p.getRequestedModules(req.DeviceUIDs, true) - if err != nil { - return nil, err - } - modules = filterModules(modules, req.FirmwareRev, req.ModelID) - - resp := &storage.ScmFirmwareQueryResponse{ - Results: make([]storage.ScmModuleFirmware, len(modules)), - } - for i, mod := range modules { - fwInfo, err := p.backend.GetFirmwareStatus(mod.UID) - resp.Results[i].Module = *mod - resp.Results[i].Info = fwInfo - if err != nil { - resp.Results[i].Error = err.Error() - } - } - - return resp, nil -} - -func (p *Provider) getRequestedModules(requestedUIDs []string, ignoreMissing bool) (storage.ScmModules, error) { - // Retrieve details of modules attached to all sockets. - modules, err := p.backend.getModules(sockAny) - if err != nil { - return nil, err - } - - if !ignoreMissing && len(modules) == 0 { - return nil, errors.New("no SCM modules") - } - - if len(requestedUIDs) == 0 { - return modules, nil - } - - if common.StringSliceHasDuplicates(requestedUIDs) { - return nil, FaultDuplicateDevices - } - sort.Strings(requestedUIDs) - - result := make(storage.ScmModules, 0, len(modules)) - for _, uid := range requestedUIDs { - mod, err := getModule(uid, modules) - if err != nil { - if ignoreMissing { - continue - } - return nil, err - } - result = append(result, mod) - } - - return result, nil -} - -func getModule(uid string, modules storage.ScmModules) (*storage.ScmModule, error) { - for _, mod := range modules { - if mod.UID == uid { - return mod, nil - } - } - - return nil, fmt.Errorf("no module found with UID %q", uid) -} - -func filterModules(modules storage.ScmModules, fwRev string, modelID string) storage.ScmModules { - filtered := make(storage.ScmModules, 0, len(modules)) - for _, mod := range modules { - if common.FilterStringMatches(fwRev, mod.FirmwareRevision) && - common.FilterStringMatches(modelID, mod.PartNumber) { - filtered = append(filtered, mod) - } - } - return filtered -} - -// UpdateFirmware updates the SCM device firmware. -func (p *Provider) UpdateFirmware(req storage.ScmFirmwareUpdateRequest) (*storage.ScmFirmwareUpdateResponse, error) { - if len(req.FirmwarePath) == 0 { - return nil, errors.New("missing path to firmware file") - } - - modules, err := p.getRequestedModules(req.DeviceUIDs, false) - if err != nil { - return nil, err - } - modules = filterModules(modules, req.FirmwareRev, req.ModelID) - - if len(modules) == 0 { - return nil, FaultNoFilterMatch - } - - resp := &storage.ScmFirmwareUpdateResponse{ - Results: make([]storage.ScmFirmwareUpdateResult, len(modules)), - } - for i, mod := range modules { - err = p.backend.UpdateFirmware(mod.UID, req.FirmwarePath) - resp.Results[i].Module = *mod - if err != nil { - resp.Results[i].Error = err.Error() - } - } - - return resp, nil -} diff --git a/src/control/server/storage/scm/firmware_test.go b/src/control/server/storage/scm/firmware_test.go deleted file mode 100644 index 3be75a141c7..00000000000 --- a/src/control/server/storage/scm/firmware_test.go +++ /dev/null @@ -1,450 +0,0 @@ -// -// (C) Copyright 2020-2022 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -package scm - -import ( - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" - - "github.com/daos-stack/daos/src/control/common/test" - "github.com/daos-stack/daos/src/control/logging" - "github.com/daos-stack/daos/src/control/server/storage" -) - -func TestProvider_QueryFirmware(t *testing.T) { - defaultModules := storage.ScmModules{ - storage.MockScmModule(1), - storage.MockScmModule(2), - storage.MockScmModule(3), - } - - fwInfo := &storage.ScmFirmwareInfo{ - ActiveVersion: "ACTIVE", - StagedVersion: "STAGED", - ImageMaxSizeBytes: 1 << 20, - UpdateStatus: storage.ScmUpdateStatusStaged, - } - - for name, tc := range map[string]struct { - input storage.ScmFirmwareQueryRequest - backendCfg *MockBackendConfig - expErr error - expRes *storage.ScmFirmwareQueryResponse - }{ - "discovery failed": { - input: storage.ScmFirmwareQueryRequest{}, - backendCfg: &MockBackendConfig{ - GetModulesErr: errors.New("mock discovery"), - }, - expErr: errors.New("mock discovery"), - }, - "no modules": { - input: storage.ScmFirmwareQueryRequest{}, - expRes: &storage.ScmFirmwareQueryResponse{ - Results: []storage.ScmModuleFirmware{}, - }, - }, - "success": { - input: storage.ScmFirmwareQueryRequest{}, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - GetFirmwareStatusRes: fwInfo, - }, - expRes: &storage.ScmFirmwareQueryResponse{ - Results: []storage.ScmModuleFirmware{ - { - Module: *defaultModules[0], - Info: fwInfo, - }, - { - Module: *defaultModules[1], - Info: fwInfo, - }, - { - Module: *defaultModules[2], - Info: fwInfo, - }, - }, - }, - }, - "get status failed": { - input: storage.ScmFirmwareQueryRequest{}, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - GetFirmwareStatusErr: errors.New("mock query"), - }, - expRes: &storage.ScmFirmwareQueryResponse{ - Results: []storage.ScmModuleFirmware{ - { - Module: *defaultModules[0], - Error: "mock query", - }, - { - Module: *defaultModules[1], - Error: "mock query", - }, - { - Module: *defaultModules[2], - Error: "mock query", - }, - }, - }, - }, - "request nonexistent is ignored": { - input: storage.ScmFirmwareQueryRequest{ - DeviceUIDs: []string{"Device1", "NotReal"}, - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - GetFirmwareStatusRes: fwInfo, - }, - expRes: &storage.ScmFirmwareQueryResponse{ - Results: []storage.ScmModuleFirmware{ - { - Module: *defaultModules[0], - Info: fwInfo, - }, - }, - }, - }, - "request device subset": { - input: storage.ScmFirmwareQueryRequest{ - DeviceUIDs: []string{"Device1", "Device3"}, - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - GetFirmwareStatusRes: fwInfo, - }, - expRes: &storage.ScmFirmwareQueryResponse{ - Results: []storage.ScmModuleFirmware{ - { - Module: *defaultModules[0], - Info: fwInfo, - }, - { - Module: *defaultModules[2], - Info: fwInfo, - }, - }, - }, - }, - "request duplicate devices": { - input: storage.ScmFirmwareQueryRequest{ - DeviceUIDs: []string{"Device1", "Device3", "Device1"}, - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - GetFirmwareStatusRes: fwInfo, - }, - expErr: FaultDuplicateDevices, - }, - "filter by FW rev": { - input: storage.ScmFirmwareQueryRequest{ - FirmwareRev: "FWRev1", - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - GetFirmwareStatusRes: fwInfo, - }, - expRes: &storage.ScmFirmwareQueryResponse{ - Results: []storage.ScmModuleFirmware{ - { - Module: *defaultModules[0], - Info: fwInfo, - }, - }, - }, - }, - "filter by model ID": { - input: storage.ScmFirmwareQueryRequest{ - ModelID: "PartNumber2", - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - GetFirmwareStatusRes: fwInfo, - }, - expRes: &storage.ScmFirmwareQueryResponse{ - Results: []storage.ScmModuleFirmware{ - { - Module: *defaultModules[1], - Info: fwInfo, - }, - }, - }, - }, - "nothing matches both filters": { - input: storage.ScmFirmwareQueryRequest{ - FirmwareRev: "FWRev1", - ModelID: "PartNumber2", - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - GetFirmwareStatusRes: fwInfo, - }, - expRes: &storage.ScmFirmwareQueryResponse{ - Results: []storage.ScmModuleFirmware{}, - }, - }, - "filter is case insensitive": { - input: storage.ScmFirmwareQueryRequest{ - ModelID: "PARTNUMBER2", - FirmwareRev: "FWREV2", - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - GetFirmwareStatusRes: fwInfo, - }, - expRes: &storage.ScmFirmwareQueryResponse{ - Results: []storage.ScmModuleFirmware{ - { - Module: *defaultModules[1], - Info: fwInfo, - }, - }, - }, - }, - "nothing in device list matches filters": { - input: storage.ScmFirmwareQueryRequest{ - DeviceUIDs: []string{"Device2", "Device3"}, - FirmwareRev: "FWRev1", - ModelID: "PartNumber1", - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - GetFirmwareStatusRes: fwInfo, - }, - expRes: &storage.ScmFirmwareQueryResponse{ - Results: []storage.ScmModuleFirmware{}, - }, - }, - } { - t.Run(name, func(t *testing.T) { - log, buf := logging.NewTestLogger(t.Name()) - defer test.ShowBufferOnFailure(t, buf) - - p := NewMockProvider(log, tc.backendCfg, nil) - - res, err := p.QueryFirmware(tc.input) - - test.CmpErr(t, tc.expErr, err) - if diff := cmp.Diff(tc.expRes, res); diff != "" { - t.Fatalf("unexpected response (-want, +got):\n%s\n", diff) - } - }) - } -} - -func TestProvider_UpdateFirmware(t *testing.T) { - defaultModules := storage.ScmModules{ - storage.MockScmModule(1), - storage.MockScmModule(2), - storage.MockScmModule(3), - } - - testErr := errors.New("test error") - testPath := "/some/path/file.bin" - - for name, tc := range map[string]struct { - input storage.ScmFirmwareUpdateRequest - backendCfg *MockBackendConfig - expErr error - expRes *storage.ScmFirmwareUpdateResponse - }{ - "empty path": { - expErr: errors.New("missing path to firmware file"), - }, - "discovery failed": { - input: storage.ScmFirmwareUpdateRequest{ - FirmwarePath: testPath, - }, - backendCfg: &MockBackendConfig{ - GetModulesErr: errors.New("mock discovery"), - }, - expErr: errors.New("mock discovery"), - }, - "no modules": { - input: storage.ScmFirmwareUpdateRequest{ - FirmwarePath: testPath, - }, - expErr: errors.New("no SCM modules"), - }, - "success": { - input: storage.ScmFirmwareUpdateRequest{ - FirmwarePath: testPath, - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - }, - expRes: &storage.ScmFirmwareUpdateResponse{ - Results: []storage.ScmFirmwareUpdateResult{ - { - Module: *defaultModules[0], - }, - { - Module: *defaultModules[1], - }, - { - Module: *defaultModules[2], - }, - }, - }, - }, - "update failed": { - input: storage.ScmFirmwareUpdateRequest{ - FirmwarePath: testPath, - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - UpdateFirmwareErr: testErr, - }, - expRes: &storage.ScmFirmwareUpdateResponse{ - Results: []storage.ScmFirmwareUpdateResult{ - { - Module: *defaultModules[0], - Error: testErr.Error(), - }, - { - Module: *defaultModules[1], - Error: testErr.Error(), - }, - { - Module: *defaultModules[2], - Error: testErr.Error(), - }, - }, - }, - }, - "request device subset": { - input: storage.ScmFirmwareUpdateRequest{ - FirmwarePath: testPath, - DeviceUIDs: []string{"Device3", "Device2"}, - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - }, - expRes: &storage.ScmFirmwareUpdateResponse{ - Results: []storage.ScmFirmwareUpdateResult{ - { - Module: *defaultModules[1], - }, - { - Module: *defaultModules[2], - }, - }, - }, - }, - "request nonexistent device": { - input: storage.ScmFirmwareUpdateRequest{ - FirmwarePath: testPath, - DeviceUIDs: []string{"Device3", "NotReal"}, - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - }, - expErr: errors.New("no module found with UID \"NotReal\""), - }, - "request duplicate devices": { - input: storage.ScmFirmwareUpdateRequest{ - FirmwarePath: testPath, - DeviceUIDs: []string{"Device3", "Device3"}, - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - }, - expErr: FaultDuplicateDevices, - }, - "filter by FW rev": { - input: storage.ScmFirmwareUpdateRequest{ - FirmwarePath: testPath, - FirmwareRev: "FWRev1", - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - }, - expRes: &storage.ScmFirmwareUpdateResponse{ - Results: []storage.ScmFirmwareUpdateResult{ - { - Module: *defaultModules[0], - }, - }, - }, - }, - "filter by model ID": { - input: storage.ScmFirmwareUpdateRequest{ - FirmwarePath: testPath, - ModelID: "PartNumber2", - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - }, - expRes: &storage.ScmFirmwareUpdateResponse{ - Results: []storage.ScmFirmwareUpdateResult{ - { - Module: *defaultModules[1], - }, - }, - }, - }, - "nothing matches both filters": { - input: storage.ScmFirmwareUpdateRequest{ - FirmwarePath: testPath, - FirmwareRev: "FWRev1", - ModelID: "PartNumber2", - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - }, - expErr: FaultNoFilterMatch, - }, - "filter is case insensitive": { - input: storage.ScmFirmwareUpdateRequest{ - FirmwarePath: testPath, - ModelID: "PARTNUMBER2", - FirmwareRev: "FWREV2", - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - }, - expRes: &storage.ScmFirmwareUpdateResponse{ - Results: []storage.ScmFirmwareUpdateResult{ - { - Module: *defaultModules[1], - }, - }, - }, - }, - "nothing in device list matches filters": { - input: storage.ScmFirmwareUpdateRequest{ - FirmwarePath: testPath, - DeviceUIDs: []string{"Device2", "Device3"}, - FirmwareRev: "FWRev1", - ModelID: "PartNumber1", - }, - backendCfg: &MockBackendConfig{ - GetModulesRes: defaultModules, - }, - expErr: FaultNoFilterMatch, - }, - } { - t.Run(name, func(t *testing.T) { - log, buf := logging.NewTestLogger(t.Name()) - defer test.ShowBufferOnFailure(t, buf) - - p := NewMockProvider(log, tc.backendCfg, nil) - - res, err := p.UpdateFirmware(tc.input) - - test.CmpErr(t, tc.expErr, err) - - if diff := cmp.Diff(tc.expRes, res); diff != "" { - t.Fatalf("unexpected response (-want, +got):\n%s\n", diff) - } - }) - } -} diff --git a/src/control/server/storage/scm/ipmctl_firmware.go b/src/control/server/storage/scm/ipmctl_firmware.go deleted file mode 100644 index cc171dcf1b8..00000000000 --- a/src/control/server/storage/scm/ipmctl_firmware.go +++ /dev/null @@ -1,98 +0,0 @@ -// -// (C) Copyright 2022-2024 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -package scm - -import ( - "github.com/pkg/errors" - - "github.com/daos-stack/daos/src/control/lib/ipmctl" - "github.com/daos-stack/daos/src/control/server/storage" -) - -// Function pointer to enable mocking during unit tests. -var getLibipmctl = libipmctlGet - -func libipmctlGet() ipmctl.IpmCtl { - return &ipmctl.NvmMgmt{} -} - -func scmFirmwareUpdateStatusFromIpmctl(ipmctlStatus uint32) storage.ScmFirmwareUpdateStatus { - switch ipmctlStatus { - case ipmctl.FWUpdateStatusFailed: - return storage.ScmUpdateStatusFailed - case ipmctl.FWUpdateStatusSuccess: - return storage.ScmUpdateStatusSuccess - case ipmctl.FWUpdateStatusStaged: - return storage.ScmUpdateStatusStaged - } - return storage.ScmUpdateStatusUnknown -} - -func uidStringToIpmctl(uidStr string) (ipmctl.DeviceUID, error) { - var uid ipmctl.DeviceUID - n := copy(uid[:], uidStr) - if n == 0 { - return ipmctl.DeviceUID{}, errors.New("invalid SCM module UID") - } - return uid, nil -} - -// noFirmwareVersion is the version string reported if there is no firmware version -const noFirmwareVersion = "00.00.00.0000" - -// GetFirmwareStatus gets the current firmware status for a specific device. -func (cr *cmdRunner) GetFirmwareStatus(deviceUID string) (*storage.ScmFirmwareInfo, error) { - uid, err := uidStringToIpmctl(deviceUID) - if err != nil { - return nil, errors.New("invalid SCM module UID") - } - - lib := getLibipmctl() - if err := lib.Init(cr.log); err != nil { - return nil, err - } - - info, err := lib.GetFirmwareInfo(uid) - if err != nil { - return nil, errors.Wrapf(err, "failed to get firmware info for device %q", deviceUID) - } - - // Avoid displaying the staged version string if there is no staged version - stagedVersion := info.StagedFWVersion.String() - if stagedVersion == noFirmwareVersion { - stagedVersion = "" - } - - return &storage.ScmFirmwareInfo{ - ActiveVersion: info.ActiveFWVersion.String(), - StagedVersion: stagedVersion, - ImageMaxSizeBytes: info.FWImageMaxSize * 4096, - UpdateStatus: scmFirmwareUpdateStatusFromIpmctl(info.FWUpdateStatus), - }, nil -} - -// UpdateFirmware attempts to update the firmware on the given device with the binary at -// the path provided. -func (cr *cmdRunner) UpdateFirmware(deviceUID string, firmwarePath string) error { - uid, err := uidStringToIpmctl(deviceUID) - if err != nil { - return errors.New("invalid SCM module UID") - } - - lib := getLibipmctl() - if err := lib.Init(cr.log); err != nil { - return err - } - - // Force option permits minor version downgrade. - err = lib.UpdateFirmware(uid, firmwarePath, true) - if err != nil { - return errors.Wrapf(err, "failed to update firmware for device %q", deviceUID) - } - - return nil -} diff --git a/src/control/server/storage/scm/ipmctl_firmware_test.go b/src/control/server/storage/scm/ipmctl_firmware_test.go deleted file mode 100644 index edf252881ce..00000000000 --- a/src/control/server/storage/scm/ipmctl_firmware_test.go +++ /dev/null @@ -1,182 +0,0 @@ -// -// (C) Copyright 2022-2024 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -package scm - -import ( - "testing" - - "github.com/daos-stack/daos/src/control/common/test" - "github.com/daos-stack/daos/src/control/lib/ipmctl" - "github.com/daos-stack/daos/src/control/logging" - "github.com/daos-stack/daos/src/control/server/storage" - "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" -) - -func TestIpmctl_fwInfoStatusToUpdateStatus(t *testing.T) { - for name, tc := range map[string]struct { - input uint32 - expResult storage.ScmFirmwareUpdateStatus - }{ - "unknown": { - input: ipmctl.FWUpdateStatusUnknown, - expResult: storage.ScmUpdateStatusUnknown, - }, - "success": { - input: ipmctl.FWUpdateStatusSuccess, - expResult: storage.ScmUpdateStatusSuccess, - }, - "failure": { - input: ipmctl.FWUpdateStatusFailed, - expResult: storage.ScmUpdateStatusFailed, - }, - "staged": { - input: ipmctl.FWUpdateStatusStaged, - expResult: storage.ScmUpdateStatusStaged, - }, - "out of range": { - input: uint32(500), - expResult: storage.ScmUpdateStatusUnknown, - }, - } { - t.Run(name, func(t *testing.T) { - result := scmFirmwareUpdateStatusFromIpmctl(tc.input) - - test.AssertEqual(t, tc.expResult, result, "didn't match") - }) - } -} - -func TestIpmctl_GetFirmwareStatus(t *testing.T) { - testUID := "TestUID" - testActiveVersion := "1.0.0.1" - testStagedVersion := "2.0.0.2" - fwInfo := ipmctl.DeviceFirmwareInfo{ - FWImageMaxSize: 65, - FWUpdateStatus: ipmctl.FWUpdateStatusStaged, - } - _ = copy(fwInfo.ActiveFWVersion[:], testActiveVersion) - _ = copy(fwInfo.StagedFWVersion[:], testStagedVersion) - - // Representing a DIMM without a staged FW version - fwInfoUnstaged := ipmctl.DeviceFirmwareInfo{ - FWImageMaxSize: 1, - FWUpdateStatus: ipmctl.FWUpdateStatusSuccess, - } - _ = copy(fwInfoUnstaged.ActiveFWVersion[:], testActiveVersion) - _ = copy(fwInfoUnstaged.StagedFWVersion[:], noFirmwareVersion) - - for name, tc := range map[string]struct { - inputUID string - cfg *mockIpmctlCfg - expErr error - expResult *storage.ScmFirmwareInfo - }{ - "empty deviceUID": { - expErr: errors.New("invalid SCM module UID"), - }, - "ipmctl.GetFirmwareInfo failed": { - inputUID: testUID, - cfg: &mockIpmctlCfg{ - getFWInfoRet: errors.New("mock GetFirmwareInfo failed"), - }, - expErr: errors.Errorf("failed to get firmware info for device %q: mock GetFirmwareInfo failed", testUID), - }, - "success": { - inputUID: testUID, - cfg: &mockIpmctlCfg{ - fwInfo: fwInfo, - }, - expResult: &storage.ScmFirmwareInfo{ - ActiveVersion: testActiveVersion, - StagedVersion: testStagedVersion, - ImageMaxSizeBytes: fwInfo.FWImageMaxSize * 4096, - UpdateStatus: storage.ScmUpdateStatusStaged, - }, - }, - "nothing staged": { - inputUID: testUID, - cfg: &mockIpmctlCfg{ - fwInfo: fwInfoUnstaged, - }, - expResult: &storage.ScmFirmwareInfo{ - ActiveVersion: testActiveVersion, - ImageMaxSizeBytes: 4096, - UpdateStatus: storage.ScmUpdateStatusSuccess, - }, - }, - } { - t.Run(name, func(t *testing.T) { - log, buf := logging.NewTestLogger(t.Name()) - defer test.ShowBufferOnFailure(t, buf) - - getLibipmctl = func() ipmctl.IpmCtl { - return newMockIpmctl(tc.cfg) - } - defer func() { - getLibipmctl = libipmctlGet - }() - - cr, err := newCmdRunner(log, nil, nil) - if err != nil { - t.Fatal(err) - } - - result, err := cr.GetFirmwareStatus(tc.inputUID) - - test.CmpErr(t, tc.expErr, err) - if diff := cmp.Diff(tc.expResult, result); diff != "" { - t.Errorf("wrong firmware info (-want, +got):\n%s\n", diff) - } - }) - } -} - -func TestIpmctl_UpdateFirmware(t *testing.T) { - testUID := "testUID" - for name, tc := range map[string]struct { - inputUID string - cfg *mockIpmctlCfg - expErr error - }{ - "bad UID": { - cfg: &mockIpmctlCfg{}, - expErr: errors.New("invalid SCM module UID"), - }, - "success": { - inputUID: testUID, - cfg: &mockIpmctlCfg{}, - }, - "ipmctl UpdateFirmware failed": { - inputUID: testUID, - cfg: &mockIpmctlCfg{ - updateFirmwareRet: errors.New("mock UpdateFirmware failed"), - }, - expErr: errors.Errorf("failed to update firmware for device %q: mock UpdateFirmware failed", testUID), - }, - } { - t.Run(name, func(t *testing.T) { - log, buf := logging.NewTestLogger(t.Name()) - defer test.ShowBufferOnFailure(t, buf) - - getLibipmctl = func() ipmctl.IpmCtl { - return newMockIpmctl(tc.cfg) - } - defer func() { - getLibipmctl = libipmctlGet - }() - - cr, err := newCmdRunner(log, nil, nil) - if err != nil { - t.Fatal(err) - } - - err = cr.UpdateFirmware(tc.inputUID, "/dont/care") - test.CmpErr(t, tc.expErr, err) - }) - } -} diff --git a/src/control/server/storage/scm/mocks.go b/src/control/server/storage/scm/mocks.go index 4d209af8dca..5ea2c1da171 100644 --- a/src/control/server/storage/scm/mocks.go +++ b/src/control/server/storage/scm/mocks.go @@ -317,13 +317,10 @@ const ( type ( mockIpmctlCfg struct { - initErr error - delGoalsErr error - getRegionsErr error - regions []ipmctl.PMemRegion - getFWInfoRet error - fwInfo ipmctl.DeviceFirmwareInfo - updateFirmwareRet error + initErr error + delGoalsErr error + getRegionsErr error + regions []ipmctl.PMemRegion } mockIpmctl struct { @@ -347,14 +344,6 @@ func (m *mockIpmctl) GetRegions(_ logging.Logger) ([]ipmctl.PMemRegion, error) { return m.cfg.regions, m.cfg.getRegionsErr } -func (m *mockIpmctl) GetFirmwareInfo(uid ipmctl.DeviceUID) (ipmctl.DeviceFirmwareInfo, error) { - return m.cfg.fwInfo, m.cfg.getFWInfoRet -} - -func (m *mockIpmctl) UpdateFirmware(uid ipmctl.DeviceUID, fwPath string, force bool) error { - return m.cfg.updateFirmwareRet -} - func newMockIpmctl(cfg *mockIpmctlCfg) *mockIpmctl { if cfg == nil { cfg = &mockIpmctlCfg{} @@ -392,17 +381,14 @@ func mockModule(uid string, pi, si, ci, chi, chp uint32) *storage.ScmModule { // implementation providing capability to access and configure // SCM modules and namespaces. type MockBackendConfig struct { - GetModulesRes storage.ScmModules - GetModulesErr error - GetNamespacesRes storage.ScmNamespaces - GetNamespacesErr error - PrepRes *storage.ScmPrepareResponse - PrepErr error - PrepResetRes *storage.ScmPrepareResponse - PrepResetErr error - GetFirmwareStatusErr error - GetFirmwareStatusRes *storage.ScmFirmwareInfo - UpdateFirmwareErr error + GetModulesRes storage.ScmModules + GetModulesErr error + GetNamespacesRes storage.ScmNamespaces + GetNamespacesErr error + PrepRes *storage.ScmPrepareResponse + PrepErr error + PrepResetRes *storage.ScmPrepareResponse + PrepResetErr error } type MockBackend struct { @@ -458,14 +444,6 @@ func (mb *MockBackend) prepReset(req storage.ScmPrepareRequest, _ *storage.ScmSc return mb.cfg.PrepResetRes, mb.cfg.PrepResetErr } -func (mb *MockBackend) GetFirmwareStatus(deviceUID string) (*storage.ScmFirmwareInfo, error) { - return mb.cfg.GetFirmwareStatusRes, mb.cfg.GetFirmwareStatusErr -} - -func (mb *MockBackend) UpdateFirmware(deviceUID string, firmwarePath string) error { - return mb.cfg.UpdateFirmwareErr -} - func NewMockBackend(cfg *MockBackendConfig) *MockBackend { if cfg == nil { cfg = &MockBackendConfig{} diff --git a/src/control/server/storage/scm/provider.go b/src/control/server/storage/scm/provider.go index f72bdb7e875..83d78b25d42 100644 --- a/src/control/server/storage/scm/provider.go +++ b/src/control/server/storage/scm/provider.go @@ -41,8 +41,6 @@ type ( getNamespaces(int) (storage.ScmNamespaces, error) prep(storage.ScmPrepareRequest, *storage.ScmScanResponse) (*storage.ScmPrepareResponse, error) prepReset(storage.ScmPrepareRequest, *storage.ScmScanResponse) (*storage.ScmPrepareResponse, error) - GetFirmwareStatus(deviceUID string) (*storage.ScmFirmwareInfo, error) - UpdateFirmware(deviceUID string, firmwarePath string) error } // SystemProvider provides operating system capabilities. diff --git a/src/proto/Makefile b/src/proto/Makefile index 519dfe2d819..d71b69ff7c9 100644 --- a/src/proto/Makefile +++ b/src/proto/Makefile @@ -1,5 +1,6 @@ # # (C) Copyright 2019-2021 Intel Corporation. +# (C) Copyright 2026 Hewlett Packard Enterprise Development LP # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -58,7 +59,6 @@ GO_CONTROL_FILES = common/proto/shared/ranks.pb.go\ common/proto/ctl/ctl.pb.go\ common/proto/ctl/network.pb.go\ common/proto/ctl/support.pb.go\ - common/proto/ctl/firmware.pb.go\ common/proto/ctl/ranks.pb.go\ common/proto/ctl/check.pb.go\ common/proto/chk/chk.pb.go\ diff --git a/src/proto/ctl/ctl.proto b/src/proto/ctl/ctl.proto index fbc44b9cf39..9cd2bdec479 100644 --- a/src/proto/ctl/ctl.proto +++ b/src/proto/ctl/ctl.proto @@ -12,7 +12,6 @@ option go_package = "github.com/daos-stack/daos/src/control/common/proto/ctl"; import "ctl/storage.proto"; import "ctl/network.proto"; -import "ctl/firmware.proto"; import "ctl/smd.proto"; import "ctl/ranks.proto"; import "ctl/server.proto"; @@ -35,10 +34,6 @@ service CtlSvc { rpc StorageNvmeAddDevice(NvmeAddDeviceReq) returns(NvmeAddDeviceResp) {}; // Perform a fabric scan to determine the available provider, device, NUMA node combinations rpc NetworkScan (NetworkScanReq) returns (NetworkScanResp) {}; - // Retrieve firmware details from storage devices on server - rpc FirmwareQuery(FirmwareQueryReq) returns (FirmwareQueryResp) {}; - // Update firmware on storage devices on server - rpc FirmwareUpdate(FirmwareUpdateReq) returns (FirmwareUpdateResp) {}; // Query the per-server metadata rpc SmdQuery(SmdQueryReq) returns (SmdQueryResp) {} // Manage devices (per-server) identified in SMD table diff --git a/src/proto/ctl/firmware.proto b/src/proto/ctl/firmware.proto deleted file mode 100644 index c1b8de4e56b..00000000000 --- a/src/proto/ctl/firmware.proto +++ /dev/null @@ -1,66 +0,0 @@ -// -// (C) Copyright 2020-2021 Intel Corporation. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - -syntax = "proto3"; -package ctl; - -option go_package = "github.com/daos-stack/daos/src/control/common/proto/ctl"; - -import "ctl/storage_scm.proto"; -import "ctl/smd.proto"; - -message FirmwareQueryReq { - bool queryScm = 1; // Should we query SCM devices? - bool queryNvme = 2; // Should we query NVMe devices? - repeated string deviceIDs = 3; // Filter by specific devices - string modelID = 4; // Filter by model ID - string firmwareRev = 5; // Filter by current firmware revision -} - -message ScmFirmwareQueryResp { - ScmModule module = 1; // The module of this firmware - string activeVersion = 2; // Active FW version - string stagedVersion = 3; // Staged FW version - uint32 imageMaxSizeBytes = 4; // Maximum size of FW image accepted - uint32 updateStatus = 5; // Status of FW update - string error = 6; // Error string, if any -} - -message NvmeFirmwareQueryResp { - NvmeController device = 1; // Controller information includes FW rev -} - -message FirmwareQueryResp { - repeated ScmFirmwareQueryResp scmResults = 1; - repeated NvmeFirmwareQueryResp nvmeResults = 2; -} - -message FirmwareUpdateReq { - string firmwarePath = 1; // Path to firmware file - enum DeviceType { - SCM = 0; - NVMe = 1; - } - DeviceType type = 2; // Type of device this firmware applies to - repeated string deviceIDs = 3; // Devices this update applies to - string modelID = 4; // Model ID this update applies to - string firmwareRev = 5; // Starting FW rev this update applies to -} - -message ScmFirmwareUpdateResp { - ScmModule module = 1; // SCM device - string error = 2; // empty if successful -} - -message NvmeFirmwareUpdateResp { - string pciAddr = 1; // PCI address of the NVMe device - string error = 2; // empty if successful -} - -message FirmwareUpdateResp { - repeated ScmFirmwareUpdateResp scmResults = 1; // results for SCM update - repeated NvmeFirmwareUpdateResp nvmeResults = 2; // results for NVMe update -} diff --git a/utils/config/daos_server.yml b/utils/config/daos_server.yml index a16693c3564..8434fef6507 100644 --- a/utils/config/daos_server.yml +++ b/utils/config/daos_server.yml @@ -297,12 +297,6 @@ #helper_log_file: /var/log/daos/daos_server_helper.log # # -## Enable daos_firmware_helper (privileged helper) logging. -# -## default: disabled (errors only to control_log_file) -#firmware_helper_log_file: /var/log/daos/daos_firmware_helper.log -# -# ## Enable HTTP endpoint for remote telemetry collection. # ## default endpoint state: disabled diff --git a/utils/docker/Dockerfile.el.8 b/utils/docker/Dockerfile.el.8 index 8eef34f4cf7..3242393b027 100644 --- a/utils/docker/Dockerfile.el.8 +++ b/utils/docker/Dockerfile.el.8 @@ -159,7 +159,7 @@ ARG DAOS_BUILD=$DAOS_DEPS_BUILD # Build DAOS RUN [ "$DAOS_BUILD" != "yes" ] || { \ scons --jobs $JOBS install PREFIX=/opt/daos COMPILER=$COMPILER \ - FIRMWARE_MGMT=1 BUILD_TYPE=$DAOS_BUILD_TYPE TARGET_TYPE=$DAOS_TARGET_TYPE && \ + BUILD_TYPE=$DAOS_BUILD_TYPE TARGET_TYPE=$DAOS_TARGET_TYPE && \ ([ "$DAOS_KEEP_BUILD" != "no" ] || /bin/rm -rf build) && \ go clean -cache && \ cp -r utils/config/examples /opt/daos; \ diff --git a/utils/docker/Dockerfile.el.9 b/utils/docker/Dockerfile.el.9 index ac1a99798fc..ac62efab1ba 100644 --- a/utils/docker/Dockerfile.el.9 +++ b/utils/docker/Dockerfile.el.9 @@ -155,7 +155,7 @@ ARG DAOS_BUILD=$DAOS_DEPS_BUILD # Build DAOS RUN [ "$DAOS_BUILD" != "yes" ] || { \ scons --jobs $JOBS install PREFIX=/opt/daos COMPILER=$COMPILER \ - FIRMWARE_MGMT=1 BUILD_TYPE=$DAOS_BUILD_TYPE \ + BUILD_TYPE=$DAOS_BUILD_TYPE \ TARGET_TYPE=$DAOS_TARGET_TYPE && \ ([ "$DAOS_KEEP_BUILD" != "no" ] || /bin/rm -rf build) && \ go clean -cache && \ diff --git a/utils/docker/Dockerfile.leap.15 b/utils/docker/Dockerfile.leap.15 index a9c2129d9f2..a780c999d3b 100644 --- a/utils/docker/Dockerfile.leap.15 +++ b/utils/docker/Dockerfile.leap.15 @@ -184,8 +184,7 @@ ARG DAOS_BUILD=$DAOS_DEPS_BUILD # Build DAOS RUN [ "$DAOS_BUILD" != "yes" ] || { \ scons --jobs $JOBS install PREFIX=/opt/daos COMPILER=$COMPILER \ - BUILD_TYPE=$DAOS_BUILD_TYPE TARGET_TYPE=$DAOS_TARGET_TYPE \ - FIRMWARE_MGMT=1 && \ + BUILD_TYPE=$DAOS_BUILD_TYPE TARGET_TYPE=$DAOS_TARGET_TYPE && \ ([ "$DAOS_KEEP_BUILD" != "no" ] || /bin/rm -rf build) && \ go clean -cache && \ cp -r utils/config/examples /opt/daos; \ diff --git a/utils/docker/Dockerfile.ubuntu b/utils/docker/Dockerfile.ubuntu index b65e3eddad8..749b245fa70 100644 --- a/utils/docker/Dockerfile.ubuntu +++ b/utils/docker/Dockerfile.ubuntu @@ -151,8 +151,7 @@ ARG DAOS_BUILD=$DAOS_DEPS_BUILD RUN [ "$DAOS_BUILD" != "yes" ] || \ { export MPI_PKG=any && \ scons --jobs $JOBS install PREFIX=/opt/daos COMPILER=$COMPILER \ - BUILD_TYPE=$DAOS_BUILD_TYPE TARGET_TYPE=$DAOS_TARGET_TYPE \ - FIRMWARE_MGMT=1 && \ + BUILD_TYPE=$DAOS_BUILD_TYPE TARGET_TYPE=$DAOS_TARGET_TYPE && \ ([ "$DAOS_KEEP_BUILD" != "no" ] || /bin/rm -rf build) && \ go clean -cache && cp -r utils/config/examples /opt/daos; } diff --git a/utils/rpms/daos.changelog b/utils/rpms/daos.changelog index 6ce0f163a31..ea4c9c39b13 100644 --- a/utils/rpms/daos.changelog +++ b/utils/rpms/daos.changelog @@ -1,4 +1,7 @@ %changelog +* Mon June 26 2026 Kris Jacque 2.9.100-5 +- Remove defunct daos_firmware package + * Mon May 04 2026 Cedric Koch-Hofer 2.9.100-4 - Add gperftools-devel as a build dependency of daos-devel diff --git a/utils/rpms/daos.rpmlintrc b/utils/rpms/daos.rpmlintrc index c9ca3970645..8d12742109a 100644 --- a/utils/rpms/daos.rpmlintrc +++ b/utils/rpms/daos.rpmlintrc @@ -8,7 +8,6 @@ addFilter("daos\.(src|x86_64): W: name-repeated-in-summary DAOS") addFilter("daos\.spec: W: invalid-url Source0: daos-[\d\.]+\.tar\.gz") # suid binary false positives -addFilter("daos-firmware\.x86_64: E: (setuid-binary|non-standard-executable-perm) \/usr\/bin\/daos_firmware") addFilter("daos-server\.x86_64: E: (setuid-binary|non-standard-executable-perm) \/usr\/bin\/daos_admin") addFilter("daos-server\.x86_64: E: (setuid-binary|non-standard-executable-perm) \/usr\/bin\/daos_server") addFilter("daos-server\.x86_64: E: setgid-binary \/usr\/bin\/daos_server daos_server 2755") @@ -20,9 +19,9 @@ addFilter("daos-client\.x86_64: E: post(i|u)n-without-ldconfig \/usr\/lib64\/lib addFilter("daos-(client|server)\.x86_64: W: dangerous-command-in-%post(un)? rm") # lots of missing manpages -addFilter("W: no-manual-page-for-binary (cart_ctl|daos_agent|dfuse|self_test|acl_dump_test|agent_tests|crt_launch|daos_debug_set_params|daos_gen_io_conf|daos_perf|daos_racer|daos_run_io_conf|daos_test|dfs_test|dfuse_test|drpc_engine_test|drpc_test|eq_tests|fault_status|hello_drpc|job_tests|jobtest|security_test|daos_firmware|daos_admin|daos_engine|daos_metrics|daos_server|daos_storage_estimator.py|evt_ctl|jump_pl_map|obj_ctl|pl_bench|rdbt|ring_pl_map|smd_ut|bio_ut|vea_stress|vea_ut|vos_perf|vos_tests|dtx_tests|dtx_ut|ddb|ddb_tests|ddb_ut|dlck)") +addFilter("W: no-manual-page-for-binary (cart_ctl|daos_agent|dfuse|self_test|acl_dump_test|agent_tests|crt_launch|daos_debug_set_params|daos_gen_io_conf|daos_perf|daos_racer|daos_run_io_conf|daos_test|dfs_test|dfuse_test|drpc_engine_test|drpc_test|eq_tests|fault_status|hello_drpc|job_tests|jobtest|security_test|daos_admin|daos_engine|daos_metrics|daos_server|daos_storage_estimator.py|evt_ctl|jump_pl_map|obj_ctl|pl_bench|rdbt|ring_pl_map|smd_ut|bio_ut|vea_stress|vea_ut|vos_perf|vos_tests|dtx_tests|dtx_ut|ddb|ddb_tests|ddb_ut|dlck)") -addFilter("daos-(server|firmware)\.x86_64: W: non-standard-(u|g)id \/.+ daos_server") +addFilter("daos-server\.x86_64: W: non-standard-(u|g)id \/.+ daos_server") # https://github.com/rpm-software-management/rpmlint/issues/924 # https://github.com/rpm-software-management/rpmlint/pull/925 @@ -69,7 +68,6 @@ addFilter("daos-admin\.x86_64: W: position-independent-executable-suggested /usr addFilter("daos-client\.x86_64: W: position-independent-executable-suggested /usr/bin/daos") addFilter("daos-client\.x86_64: W: position-independent-executable-suggested /usr/bin/daos_agent") addFilter("daos-client-tests\.x86_64: W: position-independent-executable-suggested /usr/bin/hello_drpc") -addFilter("daos-firmware\.x86_64: W: position-independent-executable-suggested /usr/bin/daos_firmware_helper") addFilter("daos-server\.x86_64: W: position-independent-executable-suggested /usr/bin/daos_server") addFilter("daos-server\.x86_64: W: position-independent-executable-suggested /usr/bin/daos_server_helper") addFilter("daos-server\.x86_64: W: position-independent-executable-suggested /usr/bin/ddb") diff --git a/utils/rpms/daos.sh b/utils/rpms/daos.sh index a71991cc525..440a45cd292 100755 --- a/utils/rpms/daos.sh +++ b/utils/rpms/daos.sh @@ -427,23 +427,6 @@ if [ "${OUTPUT_TYPE:-rpm}" = "rpm" ]; then build_package "daos-serialize" fi -if [ -f "${SL_PREFIX}/bin/daos_firmware_helper" ]; then - TARGET_PATH="${bindir}/daos_firmware_helper" - list_files files "${SL_PREFIX}/bin/daos_firmware_helper" - append_install_list "${files[@]}" - -cat << EOF > "${tmp}/post_install_firmware" -#!/bin/bash -chown root:daos_server ${bindir}/daos_firmware_helper -chmod 4750 ${bindir}/daos_firmware_helper -EOF - chmod +x "${tmp}/post_install_firmware" - EXTRA_OPTS+=("--after-install" "${tmp}/post_install_firmware") - - DEPENDS=("daos-server = ${VERSION}-${RELEASE}") - build_package "daos-firmware" -fi - TARGET_PATH="${libdir}" DEPENDS=("daos-client-tests = ${VERSION}-${RELEASE}") DEPENDS+=("hdf5-${openmpi_lib}") diff --git a/utils/rpms/daos.spec b/utils/rpms/daos.spec index 9adc6ec0bbc..fe17d5347a7 100644 --- a/utils/rpms/daos.spec +++ b/utils/rpms/daos.spec @@ -7,7 +7,7 @@ %bcond_without olddaos %if %{with server} -%global daos_build_args FIRMWARE_MGMT=yes +%global daos_build_args %else %global daos_build_args client test %endif @@ -302,15 +302,6 @@ Requires: libuuid-devel %description devel This is the package needed to build software with the DAOS library. -%if %{with server} -%package firmware -Summary: The DAOS firmware management helper -Requires: %{name}-server%{?_isa} = %{version}-%{release} - -%description firmware -This is the package needed to manage server storage firmware on DAOS servers. -%endif - %package serialize Summary: DAOS serialization library that uses HDF5 BuildRequires: hdf5-devel @@ -476,7 +467,6 @@ fi # set daos_server_helper to be setuid root in order to perform privileged tasks %attr(4750,root,daos_server) %{_bindir}/daos_server_helper # set daos_server to be setgid daos_server in order to invoke daos_server_helper -# and/or daos_firmware_helper %attr(2755,root,daos_server) %{_bindir}/daos_server %{_bindir}/daos_engine %{_bindir}/daos_metrics @@ -627,13 +617,6 @@ fi %{_libdir}/*.a %{daoshome}/python -%if %{with server} -%files firmware -%doc README.md -# set daos_firmware_helper to be setuid root in order to perform privileged tasks -%attr(4750,root,daos_server) %{_bindir}/daos_firmware_helper -%endif - %files serialize %doc README.md %{_libdir}/libdaos_serialize.so From 3860e647c47dffd23d2fc7408a2ab21bb99c3f8b Mon Sep 17 00:00:00 2001 From: Kris Jacque Date: Wed, 1 Jul 2026 17:00:08 +0000 Subject: [PATCH 2/2] Fix RPM date Features: control Signed-off-by: Kris Jacque --- utils/rpms/daos.changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/rpms/daos.changelog b/utils/rpms/daos.changelog index ea4c9c39b13..e4c88858b89 100644 --- a/utils/rpms/daos.changelog +++ b/utils/rpms/daos.changelog @@ -1,5 +1,5 @@ %changelog -* Mon June 26 2026 Kris Jacque 2.9.100-5 +* Wed Jul 01 2026 Kris Jacque 2.9.100-5 - Remove defunct daos_firmware package * Mon May 04 2026 Cedric Koch-Hofer 2.9.100-4