diff --git a/src/bio/smd.pb-c.c b/src/bio/smd.pb-c.c index 005fb834528..fe972fe3ef3 100644 --- a/src/bio/smd.pb-c.c +++ b/src/bio/smd.pb-c.c @@ -2208,69 +2208,39 @@ const ProtobufCMessageDescriptor ctl__led_manage_req__descriptor = (ProtobufCMessageInit) ctl__led_manage_req__init, NULL,NULL,NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor ctl__dev_replace_req__field_descriptors[3] = -{ - { - "old_dev_uuid", - 1, - PROTOBUF_C_LABEL_NONE, - PROTOBUF_C_TYPE_STRING, - 0, /* quantifier_offset */ - offsetof(Ctl__DevReplaceReq, old_dev_uuid), - NULL, - &protobuf_c_empty_string, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "new_dev_uuid", - 2, - PROTOBUF_C_LABEL_NONE, - PROTOBUF_C_TYPE_STRING, - 0, /* quantifier_offset */ - offsetof(Ctl__DevReplaceReq, new_dev_uuid), - NULL, - &protobuf_c_empty_string, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "no_reint", - 3, - PROTOBUF_C_LABEL_NONE, - PROTOBUF_C_TYPE_BOOL, - 0, /* quantifier_offset */ - offsetof(Ctl__DevReplaceReq, no_reint), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, +static const ProtobufCFieldDescriptor ctl__dev_replace_req__field_descriptors[2] = { + { + "old_dev_uuid", 1, PROTOBUF_C_LABEL_NONE, PROTOBUF_C_TYPE_STRING, 0, /* quantifier_offset */ + offsetof(Ctl__DevReplaceReq, old_dev_uuid), NULL, &protobuf_c_empty_string, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "new_dev_uuid", 2, PROTOBUF_C_LABEL_NONE, PROTOBUF_C_TYPE_STRING, 0, /* quantifier_offset */ + offsetof(Ctl__DevReplaceReq, new_dev_uuid), NULL, &protobuf_c_empty_string, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, }; static const unsigned ctl__dev_replace_req__field_indices_by_name[] = { - 1, /* field[1] = new_dev_uuid */ - 2, /* field[2] = no_reint */ - 0, /* field[0] = old_dev_uuid */ -}; -static const ProtobufCIntRange ctl__dev_replace_req__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 3 } + 1, /* field[1] = new_dev_uuid */ + 0, /* field[0] = old_dev_uuid */ }; -const ProtobufCMessageDescriptor ctl__dev_replace_req__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "ctl.DevReplaceReq", - "DevReplaceReq", - "Ctl__DevReplaceReq", - "ctl", - sizeof(Ctl__DevReplaceReq), - 3, - ctl__dev_replace_req__field_descriptors, - ctl__dev_replace_req__field_indices_by_name, - 1, ctl__dev_replace_req__number_ranges, - (ProtobufCMessageInit) ctl__dev_replace_req__init, - NULL,NULL,NULL /* reserved[123] */ +static const ProtobufCIntRange ctl__dev_replace_req__number_ranges[1 + 1] = {{1, 0}, {0, 2}}; +const ProtobufCMessageDescriptor ctl__dev_replace_req__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "ctl.DevReplaceReq", + "DevReplaceReq", + "Ctl__DevReplaceReq", + "ctl", + sizeof(Ctl__DevReplaceReq), + 2, + ctl__dev_replace_req__field_descriptors, + ctl__dev_replace_req__field_indices_by_name, + 1, + ctl__dev_replace_req__number_ranges, + (ProtobufCMessageInit)ctl__dev_replace_req__init, + NULL, + NULL, + NULL /* reserved[123] */ }; static const ProtobufCFieldDescriptor ctl__set_faulty_req__field_descriptors[1] = { diff --git a/src/bio/smd.pb-c.h b/src/bio/smd.pb-c.h index 88205a1b6de..531829ea4bc 100644 --- a/src/bio/smd.pb-c.h +++ b/src/bio/smd.pb-c.h @@ -241,12 +241,12 @@ struct _Ctl__BioHealthResp uint32_t link_neg_width; }; #define CTL__BIO_HEALTH_RESP__INIT \ - { \ - PROTOBUF_C_MESSAGE_INIT(&ctl__bio_health_resp__descriptor) \ - , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - (char *)protobuf_c_empty_string, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 \ - } + { \ + PROTOBUF_C_MESSAGE_INIT(&ctl__bio_health_resp__descriptor) \ + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + (char *)protobuf_c_empty_string, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 \ + } /* * Namespace represents a namespace created on an NvmeController. @@ -413,9 +413,9 @@ struct _Ctl__SmdDevReq ProtobufCMessage base; }; #define CTL__SMD_DEV_REQ__INIT \ - { \ - PROTOBUF_C_MESSAGE_INIT(&ctl__smd_dev_req__descriptor) \ - } + { \ + PROTOBUF_C_MESSAGE_INIT(&ctl__smd_dev_req__descriptor) \ + } struct _Ctl__SmdDevResp { @@ -601,16 +601,13 @@ struct _Ctl__DevReplaceReq /* * UUID of new (hot-plugged) blobstore/device */ - char *new_dev_uuid; - /* - * Skip device reintegration if set - */ - protobuf_c_boolean no_reint; + char *new_dev_uuid; }; -#define CTL__DEV_REPLACE_REQ__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&ctl__dev_replace_req__descriptor) \ - , (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string, 0 } - +#define CTL__DEV_REPLACE_REQ__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT(&ctl__dev_replace_req__descriptor) \ + , (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string \ + } struct _Ctl__SetFaultyReq { diff --git a/src/control/cmd/dmg/json_test.go b/src/control/cmd/dmg/json_test.go index 8187f5b1078..9021f1c8d5d 100644 --- a/src/control/cmd/dmg/json_test.go +++ b/src/control/cmd/dmg/json_test.go @@ -76,10 +76,11 @@ func TestDmg_JsonOutput(t *testing.T) { testArgs = append(testArgs, "-l", "foo.com", "-a", test.MockPCIAddr(), "-e", "0") case "storage set nvme-faulty": - testArgs = append(testArgs, "--force", "-u", test.MockUUID()) + testArgs = append(testArgs, "--host", "foo.com", "--force", "-u", + test.MockUUID()) case "storage replace nvme": - testArgs = append(testArgs, "--old-uuid", test.MockUUID(), - "--new-uuid", test.MockUUID()) + testArgs = append(testArgs, "--host", "foo.com", "--old-uuid", + test.MockUUID(), "--new-uuid", test.MockUUID()) case "storage led identify", "storage led check", "storage led clear": testArgs = append(testArgs, test.MockUUID()) case "pool create": diff --git a/src/control/cmd/dmg/main.go b/src/control/cmd/dmg/main.go index fc6355e76f8..c88845a304c 100644 --- a/src/control/cmd/dmg/main.go +++ b/src/control/cmd/dmg/main.go @@ -41,8 +41,7 @@ type ( } singleHostCmd struct { - HostList singleHostFlag `short:"l" long:"host-list" default:"localhost" description:"Single host address <ipv4addr/hostname> to connect to"` - host string + Host singleHostFlag `short:"l" long:"host" required:"1" description:"Single host address <ipv4addr/hostname> to connect to"` } ctlInvoker interface { @@ -52,6 +51,25 @@ type ( ctlInvokerCmd struct { ctlInvoker control.Invoker } + + cmdLogger interface { + setLog(*logging.LeveledLogger) + } + + // cmdConfigSetter is an interface for setting the control config on a command + cmdConfigSetter interface { + setConfig(*control.Config) + } + + // cfgCmd is a structure that can be used by commands that need the control config. + cfgCmd struct { + config *control.Config + } + + baseCmd struct { + cmdutil.NoArgsCmd + cmdutil.LogCmd + } ) func (cmd *ctlInvokerCmd) setInvoker(c control.Invoker) { @@ -69,43 +87,8 @@ func (cmd *hostListCmd) setHostList(newList *hostlist.HostSet) { cmd.HostList.Replace(newList) } -func (cmd *singleHostCmd) getHostList() []string { - if cmd.host == "" { - if cmd.HostList.Count() == 0 { - cmd.host = "localhost" - } else { - cmd.host = cmd.HostList.Slice()[0] - } - } - return []string{cmd.host} -} - -func (cmd *singleHostCmd) setHostList(newList *hostlist.HostSet) { - cmd.HostList.Replace(newList) -} - -type cmdLogger interface { - setLog(*logging.LeveledLogger) -} - -type baseCmd struct { - cmdutil.NoArgsCmd - cmdutil.LogCmd -} - -// cmdConfigSetter is an interface for setting the control config on a command -type cmdConfigSetter interface { - setConfig(*control.Config) -} - -// cfgCmd is a structure that can be used by commands that need the control -// config. -type cfgCmd struct { - config *control.Config -} - -func (c *cfgCmd) setConfig(cfg *control.Config) { - c.config = cfg +func (cmd *cfgCmd) setConfig(cfg *control.Config) { + cmd.config = cfg } type cliOptions struct { diff --git a/src/control/cmd/dmg/storage_query.go b/src/control/cmd/dmg/storage_query.go index 2075350cebe..8604bb81100 100644 --- a/src/control/cmd/dmg/storage_query.go +++ b/src/control/cmd/dmg/storage_query.go @@ -40,11 +40,15 @@ type smdQueryCmd struct { func (cmd *smdQueryCmd) makeRequest(ctx context.Context, req *control.SmdQueryReq, opts ...pretty.PrintConfigOption) error { req.SetHostList(cmd.getHostList()) + cmd.Tracef("smd query request: %+v", req) + resp, err := control.SmdQuery(ctx, cmd.ctlInvoker, req) if err != nil { return err // control api returned an error, disregard response } + cmd.Tracef("smd query response: %+v", resp) + if cmd.JSONOutputEnabled() { return cmd.OutputJSON(resp, resp.Errors()) } @@ -155,13 +159,10 @@ func (cmd *usageQueryCmd) Execute(_ []string) error { type smdManageCmd struct { baseCmd ctlInvokerCmd - hostListCmd cmdutil.JSONOutputCmd } func (cmd *smdManageCmd) makeRequest(ctx context.Context, req *control.SmdManageReq, opts ...pretty.PrintConfigOption) error { - req.SetHostList(cmd.getHostList()) - cmd.Tracef("smd manage request: %+v", req) resp, err := control.SmdManage(ctx, cmd.ctlInvoker, req) @@ -169,7 +170,7 @@ func (cmd *smdManageCmd) makeRequest(ctx context.Context, req *control.SmdManage return err // control api returned an error, disregard response } - cmd.Tracef("smd managee response: %+v", resp) + cmd.Tracef("smd manage response: %+v", resp) if cmd.JSONOutputEnabled() { return cmd.OutputJSON(resp, resp.Errors()) @@ -195,6 +196,7 @@ type setFaultyCmd struct { type nvmeSetFaultyCmd struct { smdManageCmd + singleHostCmd UUID string `short:"u" long:"uuid" description:"Device UUID to set" required:"1"` Force bool `short:"f" long:"force" description:"Do not require confirmation"` } @@ -213,6 +215,7 @@ func (cmd *nvmeSetFaultyCmd) Execute(_ []string) error { Operation: control.SetFaultyOp, IDs: cmd.UUID, } + req.SetHostList(cmd.Host.Slice()) return cmd.makeRequest(cmd.MustLogCtx(), req) } @@ -224,9 +227,9 @@ type storageReplaceCmd struct { // nvmeReplaceCmd is the struct representing the replace nvme storage subcommand type nvmeReplaceCmd struct { smdManageCmd + singleHostCmd OldDevUUID string `long:"old-uuid" description:"Device UUID of hot-removed SSD" required:"1"` NewDevUUID string `long:"new-uuid" description:"Device UUID of new device" required:"1"` - NoReint bool `long:"no-reint" description:"Bypass reintegration of device and just bring back online."` } // Execute is run when storageReplaceCmd activates @@ -236,23 +239,18 @@ func (cmd *nvmeReplaceCmd) Execute(_ []string) error { cmd.Notice("Attempting to reuse a previously set FAULTY device!") } - // TODO: Implement no-reint flag option - if cmd.NoReint { - return errors.New("NoReint is not currently implemented") - } - req := &control.SmdManageReq{ - Operation: control.DevReplaceOp, - IDs: cmd.OldDevUUID, - ReplaceUUID: cmd.NewDevUUID, - ReplaceNoReint: cmd.NoReint, + Operation: control.DevReplaceOp, + IDs: cmd.OldDevUUID, + ReplaceUUID: cmd.NewDevUUID, } + req.SetHostList(cmd.Host.Slice()) return cmd.makeRequest(cmd.MustLogCtx(), req) } type ledCmd struct { smdManageCmd - + hostListCmd Args struct { IDs string `positional-arg-name:"ids" description:"Comma-separated list of identifiers which could be either VMD backing device (NVMe SSD) PCI addresses or device UUIDs. All SSDs selected if arg not provided."` } `positional-args:"yes"` @@ -287,6 +285,7 @@ func (cmd *ledIdentifyCmd) Execute(_ []string) error { } req.Operation = control.LedResetOp } + req.SetHostList(cmd.getHostList()) return cmd.makeRequest(cmd.MustLogCtx(), req, pretty.PrintOnlyLEDInfo()) } @@ -305,5 +304,6 @@ func (cmd *ledCheckCmd) Execute(_ []string) error { Operation: control.LedCheckOp, IDs: cmd.Args.IDs, } + req.SetHostList(cmd.getHostList()) return cmd.makeRequest(cmd.MustLogCtx(), req, pretty.PrintOnlyLEDInfo()) } diff --git a/src/control/cmd/dmg/storage_query_test.go b/src/control/cmd/dmg/storage_query_test.go index d07685490ff..190ddaee217 100644 --- a/src/control/cmd/dmg/storage_query_test.go +++ b/src/control/cmd/dmg/storage_query_test.go @@ -122,64 +122,80 @@ func TestStorageQueryCommands(t *testing.T) { nil, }, { - "Set FAULTY device status (force)", + "Set FAULTY device status (missing host)", "storage set nvme-faulty --uuid 842c739b-86b5-462f-a7ba-b4a91b674f3d -f", - printRequest(t, &control.SmdManageReq{ - Operation: control.SetFaultyOp, - IDs: "842c739b-86b5-462f-a7ba-b4a91b674f3d", - }), - nil, - }, - { - "Set FAULTY device status (without force)", - "storage set nvme-faulty --uuid abcd", - "StorageSetFaulty", - errors.New("consent not given"), + "", + errors.New("not specified"), }, { "Set FAULTY device status (with > 1 host)", "storage set nvme-faulty -l host-[1-2] -f --uuid 842c739b-86b5-462f-a7ba-b4a91b674f3d", - "StorageSetFaulty", - errors.New("> 1 host"), + "", + errors.New("must specify a single host"), }, { - "Set FAULTY device status (with > 1 host) with legacy hostlist", - "-l host-[1-2] storage set nvme-faulty -f --uuid 842c739b-86b5-462f-a7ba-b4a91b674f3d", - "StorageSetFaulty", - errors.New("> 1 host"), + "Set FAULTY device status (force)", + "storage set nvme-faulty --host foo --uuid 842c739b-86b5-462f-a7ba-b4a91b674f3d -f", + printRequest(t, func() *control.SmdManageReq { + req := &control.SmdManageReq{ + Operation: control.SetFaultyOp, + IDs: "842c739b-86b5-462f-a7ba-b4a91b674f3d", + } + req.SetHostList([]string{"foo"}) + return req + }()), + nil, + }, + { + "Set FAULTY device status (without force)", + "storage set nvme-faulty --host foo --uuid abcd", + "", + errors.New("consent not given"), }, { "Set FAULTY device status without device specified", - "storage set nvme-faulty", - "StorageSetFaulty", + "storage set nvme-faulty --host foo", + "", errors.New("the required flag `-u, --uuid' was not specified"), }, { - "Reuse a FAULTY device", + "Reuse a FAULTY device (missing host)", "storage replace nvme --old-uuid 842c739b-86b5-462f-a7ba-b4a91b674f3d --new-uuid 842c739b-86b5-462f-a7ba-b4a91b674f3d", - printRequest(t, &control.SmdManageReq{ - Operation: control.DevReplaceOp, - IDs: "842c739b-86b5-462f-a7ba-b4a91b674f3d", - ReplaceUUID: "842c739b-86b5-462f-a7ba-b4a91b674f3d", - ReplaceNoReint: false, - }), + "", + errors.New("not specified"), + }, + { + "Reuse a FAULTY device", + "storage replace nvme --host foo --old-uuid 842c739b-86b5-462f-a7ba-b4a91b674f3d --new-uuid 842c739b-86b5-462f-a7ba-b4a91b674f3d", + printRequest(t, func() *control.SmdManageReq { + req := &control.SmdManageReq{ + Operation: control.DevReplaceOp, + IDs: "842c739b-86b5-462f-a7ba-b4a91b674f3d", + ReplaceUUID: "842c739b-86b5-462f-a7ba-b4a91b674f3d", + } + req.SetHostList([]string{"foo"}) + return req + }()), nil, }, { "Replace an evicted device with a new device", - "storage replace nvme --old-uuid 842c739b-86b5-462f-a7ba-b4a91b674f3d --new-uuid 2ccb8afb-5d32-454e-86e3-762ec5dca7be", - printRequest(t, &control.SmdManageReq{ - Operation: control.DevReplaceOp, - IDs: "842c739b-86b5-462f-a7ba-b4a91b674f3d", - ReplaceUUID: "2ccb8afb-5d32-454e-86e3-762ec5dca7be", - ReplaceNoReint: false, - }), + "storage replace nvme --host foo --old-uuid 842c739b-86b5-462f-a7ba-b4a91b674f3d --new-uuid 2ccb8afb-5d32-454e-86e3-762ec5dca7be", + printRequest(t, func() *control.SmdManageReq { + req := &control.SmdManageReq{ + Operation: control.DevReplaceOp, + IDs: "842c739b-86b5-462f-a7ba-b4a91b674f3d", + ReplaceUUID: "2ccb8afb-5d32-454e-86e3-762ec5dca7be", + } + req.SetHostList([]string{"foo"}) + return req + }()), nil, }, { "Try to replace a device without a new device UUID specified", - "storage replace nvme --old-uuid 842c739b-86b5-462f-a7ba-b4a91b674f3d", - "StorageReplaceNvme", + "storage replace nvme -l foo --old-uuid 842c739b-86b5-462f-a7ba-b4a91b674f3d", + "", errors.New("the required flag `--new-uuid' was not specified"), }, { diff --git a/src/control/cmd/dmg/telemetry.go b/src/control/cmd/dmg/telemetry.go index fd63164b438..40b84d1512f 100644 --- a/src/control/cmd/dmg/telemetry.go +++ b/src/control/cmd/dmg/telemetry.go @@ -1,5 +1,5 @@ // -// (C) Copyright 2019-2023 Intel Corporation. +// (C) Copyright 2019-2024 Intel Corporation. // // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -310,7 +310,7 @@ type metricsListCmd struct { // Execute runs the command to list metrics from the DAOS storage nodes. func (cmd *metricsListCmd) Execute(args []string) error { - host, err := getMetricsHost(cmd.getHostList()) + host, err := getMetricsHost(cmd.Host.Slice()) if err != nil { return err } @@ -365,7 +365,7 @@ type metricsQueryCmd struct { // Execute runs the command to query metrics from the DAOS storage nodes. func (cmd *metricsQueryCmd) Execute(args []string) error { - host, err := getMetricsHost(cmd.getHostList()) + host, err := getMetricsHost(cmd.Host.Slice()) if err != nil { return err } diff --git a/src/control/cmd/dmg/utils.go b/src/control/cmd/dmg/utils.go index 683b5e975ad..b8b97e43ff8 100644 --- a/src/control/cmd/dmg/utils.go +++ b/src/control/cmd/dmg/utils.go @@ -1,5 +1,5 @@ // -// (C) Copyright 2018-2022 Intel Corporation. +// (C) Copyright 2018-2024 Intel Corporation. // // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -19,6 +19,7 @@ import ( type singleHostFlag ui.HostSetFlag +// UnmarshalFlag implements the go-flags.Unmarshaler interface. func (shf *singleHostFlag) UnmarshalFlag(value string) error { if err := (*ui.HostSetFlag)(shf).UnmarshalFlag(value); err != nil { return err diff --git a/src/control/common/proto/ctl/smd.pb.go b/src/control/common/proto/ctl/smd.pb.go index 089c35cc7d4..66dedd0c4cc 100644 --- a/src/control/common/proto/ctl/smd.pb.go +++ b/src/control/common/proto/ctl/smd.pb.go @@ -1390,7 +1390,6 @@ type DevReplaceReq struct { OldDevUuid string `protobuf:"bytes,1,opt,name=old_dev_uuid,json=oldDevUuid,proto3" json:"old_dev_uuid,omitempty"` // UUID of old (hot-removed) blobstore/device NewDevUuid string `protobuf:"bytes,2,opt,name=new_dev_uuid,json=newDevUuid,proto3" json:"new_dev_uuid,omitempty"` // UUID of new (hot-plugged) blobstore/device - NoReint bool `protobuf:"varint,3,opt,name=no_reint,json=noReint,proto3" json:"no_reint,omitempty"` // Skip device reintegration if set } func (x *DevReplaceReq) Reset() { @@ -1439,13 +1438,6 @@ func (x *DevReplaceReq) GetNewDevUuid() string { return "" } -func (x *DevReplaceReq) GetNoReint() bool { - if x != nil { - return x.NoReint - } - return false -} - type SetFaultyReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2314,61 +2306,60 @@ var file_ctl_smd_proto_rawDesc = []byte{ 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x08, 0x6c, 0x65, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x6c, 0x65, 0x64, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x69, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x6c, 0x65, 0x64, 0x44, - 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x69, 0x6e, 0x73, 0x22, 0x6e, 0x0a, 0x0d, 0x44, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x69, 0x6e, 0x73, 0x22, 0x53, 0x0a, 0x0d, 0x44, 0x65, 0x76, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x6c, 0x64, 0x5f, 0x64, 0x65, 0x76, 0x5f, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x6c, 0x64, 0x44, 0x65, 0x76, 0x55, 0x75, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0c, 0x6e, 0x65, 0x77, 0x5f, 0x64, 0x65, 0x76, 0x5f, 0x75, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x65, 0x77, 0x44, 0x65, 0x76, 0x55, 0x75, 0x69, 0x64, - 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x5f, 0x72, 0x65, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x07, 0x6e, 0x6f, 0x52, 0x65, 0x69, 0x6e, 0x74, 0x22, 0x22, 0x0a, 0x0c, 0x53, - 0x65, 0x74, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x75, - 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x22, - 0x4f, 0x0a, 0x0d, 0x44, 0x65, 0x76, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x26, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, - 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x53, - 0x6d, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x22, 0x98, 0x01, 0x0a, 0x0c, 0x53, 0x6d, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x52, 0x65, - 0x71, 0x12, 0x25, 0x0a, 0x03, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, - 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x4c, 0x65, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x52, 0x65, - 0x71, 0x48, 0x00, 0x52, 0x03, 0x6c, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x07, 0x72, 0x65, 0x70, 0x6c, - 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x74, 0x6c, 0x2e, - 0x44, 0x65, 0x76, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x48, 0x00, 0x52, - 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x12, 0x2b, 0x0a, 0x06, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x53, - 0x65, 0x74, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, 0x71, 0x48, 0x00, 0x52, 0x06, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x79, 0x42, 0x04, 0x0a, 0x02, 0x6f, 0x70, 0x22, 0xe1, 0x01, 0x0a, 0x0d, - 0x53, 0x6d, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x31, 0x0a, - 0x05, 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, - 0x74, 0x6c, 0x2e, 0x53, 0x6d, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x6b, 0x73, - 0x1a, 0x48, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x26, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x53, 0x6d, 0x64, 0x44, 0x65, 0x76, 0x69, - 0x63, 0x65, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x53, 0x0a, 0x08, 0x52, 0x61, - 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x12, 0x33, 0x0a, 0x07, 0x72, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x74, - 0x6c, 0x2e, 0x53, 0x6d, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x2e, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x2a, - 0x4c, 0x0a, 0x0c, 0x4e, 0x76, 0x6d, 0x65, 0x44, 0x65, 0x76, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, - 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, - 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x4e, 0x45, 0x57, 0x10, - 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x56, 0x49, 0x43, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, 0x0d, - 0x0a, 0x09, 0x55, 0x4e, 0x50, 0x4c, 0x55, 0x47, 0x47, 0x45, 0x44, 0x10, 0x04, 0x2a, 0x44, 0x0a, - 0x08, 0x4c, 0x65, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x41, 0x10, - 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x51, 0x55, 0x49, 0x43, 0x4b, 0x5f, 0x42, 0x4c, 0x49, 0x4e, 0x4b, - 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x4c, - 0x4f, 0x57, 0x5f, 0x42, 0x4c, 0x49, 0x4e, 0x4b, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x4f, 0x46, - 0x46, 0x10, 0x04, 0x2a, 0x28, 0x0a, 0x09, 0x4c, 0x65, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x45, 0x54, - 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x53, 0x45, 0x54, 0x10, 0x02, 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, + 0x22, 0x22, 0x0a, 0x0c, 0x53, 0x65, 0x74, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, 0x71, + 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x75, 0x75, 0x69, 0x64, 0x22, 0x4f, 0x0a, 0x0d, 0x44, 0x65, 0x76, 0x4d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x26, 0x0a, + 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, + 0x63, 0x74, 0x6c, 0x2e, 0x53, 0x6d, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x06, 0x64, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x98, 0x01, 0x0a, 0x0c, 0x53, 0x6d, 0x64, 0x4d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x25, 0x0a, 0x03, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x4c, 0x65, 0x64, 0x4d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x48, 0x00, 0x52, 0x03, 0x6c, 0x65, 0x64, 0x12, 0x2e, 0x0a, + 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, + 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x52, + 0x65, 0x71, 0x48, 0x00, 0x52, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x12, 0x2b, 0x0a, + 0x06, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, + 0x63, 0x74, 0x6c, 0x2e, 0x53, 0x65, 0x74, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, 0x71, + 0x48, 0x00, 0x52, 0x06, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x79, 0x42, 0x04, 0x0a, 0x02, 0x6f, 0x70, + 0x22, 0xe1, 0x01, 0x0a, 0x0d, 0x53, 0x6d, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x12, 0x31, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x53, 0x6d, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x52, 0x05, + 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x1a, 0x48, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, + 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x26, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x53, 0x6d, + 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x1a, + 0x53, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x72, + 0x61, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x12, + 0x33, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x74, 0x6c, 0x2e, 0x53, 0x6d, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x73, 0x2a, 0x4c, 0x0a, 0x0c, 0x4e, 0x76, 0x6d, 0x65, 0x44, 0x65, 0x76, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, + 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x07, 0x0a, + 0x03, 0x4e, 0x45, 0x57, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x56, 0x49, 0x43, 0x54, 0x45, + 0x44, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x50, 0x4c, 0x55, 0x47, 0x47, 0x45, 0x44, + 0x10, 0x04, 0x2a, 0x44, 0x0a, 0x08, 0x4c, 0x65, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x06, + 0x0a, 0x02, 0x4e, 0x41, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x51, 0x55, 0x49, 0x43, 0x4b, 0x5f, + 0x42, 0x4c, 0x49, 0x4e, 0x4b, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4e, 0x10, 0x02, 0x12, + 0x0e, 0x0a, 0x0a, 0x53, 0x4c, 0x4f, 0x57, 0x5f, 0x42, 0x4c, 0x49, 0x4e, 0x4b, 0x10, 0x03, 0x12, + 0x07, 0x0a, 0x03, 0x4f, 0x46, 0x46, 0x10, 0x04, 0x2a, 0x28, 0x0a, 0x09, 0x4c, 0x65, 0x64, 0x41, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x00, 0x12, 0x07, + 0x0a, 0x03, 0x53, 0x45, 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x53, 0x45, 0x54, + 0x10, 0x02, 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 ( diff --git a/src/control/lib/control/server_meta.go b/src/control/lib/control/server_meta.go index 246b0b18631..8b08cae15e2 100644 --- a/src/control/lib/control/server_meta.go +++ b/src/control/lib/control/server_meta.go @@ -80,7 +80,6 @@ type ( IDs string // comma separated list of IDs Rank ranklist.Rank ReplaceUUID string // For device replacement, UUID of new device - ReplaceNoReint bool // For device replacement, indicate no reintegration IdentifyTimeout uint32 // For LED identify, blink duration in minutes Operation SmdManageOpcode } @@ -306,7 +305,6 @@ func packPBSmdManageReq(req *SmdManageReq, pbReq *ctlpb.SmdManageReq) error { Replace: &ctlpb.DevReplaceReq{ OldDevUuid: req.IDs, NewDevUuid: req.ReplaceUUID, - NoReint: req.ReplaceNoReint, }, } case LedCheckOp: diff --git a/src/control/lib/control/server_meta_test.go b/src/control/lib/control/server_meta_test.go index 82ec3bd038c..affc59bd210 100644 --- a/src/control/lib/control/server_meta_test.go +++ b/src/control/lib/control/server_meta_test.go @@ -505,17 +505,15 @@ func TestControl_packPBSmdManageReq(t *testing.T) { }, "dev-replace": { req: &SmdManageReq{ - Operation: DevReplaceOp, - IDs: test.MockUUID(1), - ReplaceUUID: test.MockUUID(2), - ReplaceNoReint: true, + Operation: DevReplaceOp, + IDs: test.MockUUID(1), + ReplaceUUID: test.MockUUID(2), }, expPBReq: &ctlpb.SmdManageReq{ Op: &ctlpb.SmdManageReq_Replace{ Replace: &ctlpb.DevReplaceReq{ OldDevUuid: test.MockUUID(1), NewDevUuid: test.MockUUID(2), - NoReint: true, }, }, }, @@ -655,7 +653,6 @@ func TestControl_SmdManage(t *testing.T) { }, expErr: errors.New("> 1 host"), }, - // set-faulty API calls do not return SMD info. "set-faulty": { req: &SmdManageReq{ Operation: SetFaultyOp, diff --git a/src/mgmt/smd.pb-c.c b/src/mgmt/smd.pb-c.c index 005fb834528..fe972fe3ef3 100644 --- a/src/mgmt/smd.pb-c.c +++ b/src/mgmt/smd.pb-c.c @@ -2208,69 +2208,39 @@ const ProtobufCMessageDescriptor ctl__led_manage_req__descriptor = (ProtobufCMessageInit) ctl__led_manage_req__init, NULL,NULL,NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor ctl__dev_replace_req__field_descriptors[3] = -{ - { - "old_dev_uuid", - 1, - PROTOBUF_C_LABEL_NONE, - PROTOBUF_C_TYPE_STRING, - 0, /* quantifier_offset */ - offsetof(Ctl__DevReplaceReq, old_dev_uuid), - NULL, - &protobuf_c_empty_string, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "new_dev_uuid", - 2, - PROTOBUF_C_LABEL_NONE, - PROTOBUF_C_TYPE_STRING, - 0, /* quantifier_offset */ - offsetof(Ctl__DevReplaceReq, new_dev_uuid), - NULL, - &protobuf_c_empty_string, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "no_reint", - 3, - PROTOBUF_C_LABEL_NONE, - PROTOBUF_C_TYPE_BOOL, - 0, /* quantifier_offset */ - offsetof(Ctl__DevReplaceReq, no_reint), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, +static const ProtobufCFieldDescriptor ctl__dev_replace_req__field_descriptors[2] = { + { + "old_dev_uuid", 1, PROTOBUF_C_LABEL_NONE, PROTOBUF_C_TYPE_STRING, 0, /* quantifier_offset */ + offsetof(Ctl__DevReplaceReq, old_dev_uuid), NULL, &protobuf_c_empty_string, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "new_dev_uuid", 2, PROTOBUF_C_LABEL_NONE, PROTOBUF_C_TYPE_STRING, 0, /* quantifier_offset */ + offsetof(Ctl__DevReplaceReq, new_dev_uuid), NULL, &protobuf_c_empty_string, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, }; static const unsigned ctl__dev_replace_req__field_indices_by_name[] = { - 1, /* field[1] = new_dev_uuid */ - 2, /* field[2] = no_reint */ - 0, /* field[0] = old_dev_uuid */ -}; -static const ProtobufCIntRange ctl__dev_replace_req__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 3 } + 1, /* field[1] = new_dev_uuid */ + 0, /* field[0] = old_dev_uuid */ }; -const ProtobufCMessageDescriptor ctl__dev_replace_req__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "ctl.DevReplaceReq", - "DevReplaceReq", - "Ctl__DevReplaceReq", - "ctl", - sizeof(Ctl__DevReplaceReq), - 3, - ctl__dev_replace_req__field_descriptors, - ctl__dev_replace_req__field_indices_by_name, - 1, ctl__dev_replace_req__number_ranges, - (ProtobufCMessageInit) ctl__dev_replace_req__init, - NULL,NULL,NULL /* reserved[123] */ +static const ProtobufCIntRange ctl__dev_replace_req__number_ranges[1 + 1] = {{1, 0}, {0, 2}}; +const ProtobufCMessageDescriptor ctl__dev_replace_req__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "ctl.DevReplaceReq", + "DevReplaceReq", + "Ctl__DevReplaceReq", + "ctl", + sizeof(Ctl__DevReplaceReq), + 2, + ctl__dev_replace_req__field_descriptors, + ctl__dev_replace_req__field_indices_by_name, + 1, + ctl__dev_replace_req__number_ranges, + (ProtobufCMessageInit)ctl__dev_replace_req__init, + NULL, + NULL, + NULL /* reserved[123] */ }; static const ProtobufCFieldDescriptor ctl__set_faulty_req__field_descriptors[1] = { diff --git a/src/mgmt/smd.pb-c.h b/src/mgmt/smd.pb-c.h index 88205a1b6de..531829ea4bc 100644 --- a/src/mgmt/smd.pb-c.h +++ b/src/mgmt/smd.pb-c.h @@ -241,12 +241,12 @@ struct _Ctl__BioHealthResp uint32_t link_neg_width; }; #define CTL__BIO_HEALTH_RESP__INIT \ - { \ - PROTOBUF_C_MESSAGE_INIT(&ctl__bio_health_resp__descriptor) \ - , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - (char *)protobuf_c_empty_string, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 \ - } + { \ + PROTOBUF_C_MESSAGE_INIT(&ctl__bio_health_resp__descriptor) \ + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + (char *)protobuf_c_empty_string, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 \ + } /* * Namespace represents a namespace created on an NvmeController. @@ -413,9 +413,9 @@ struct _Ctl__SmdDevReq ProtobufCMessage base; }; #define CTL__SMD_DEV_REQ__INIT \ - { \ - PROTOBUF_C_MESSAGE_INIT(&ctl__smd_dev_req__descriptor) \ - } + { \ + PROTOBUF_C_MESSAGE_INIT(&ctl__smd_dev_req__descriptor) \ + } struct _Ctl__SmdDevResp { @@ -601,16 +601,13 @@ struct _Ctl__DevReplaceReq /* * UUID of new (hot-plugged) blobstore/device */ - char *new_dev_uuid; - /* - * Skip device reintegration if set - */ - protobuf_c_boolean no_reint; + char *new_dev_uuid; }; -#define CTL__DEV_REPLACE_REQ__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&ctl__dev_replace_req__descriptor) \ - , (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string, 0 } - +#define CTL__DEV_REPLACE_REQ__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT(&ctl__dev_replace_req__descriptor) \ + , (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string \ + } struct _Ctl__SetFaultyReq { diff --git a/src/proto/ctl/smd.proto b/src/proto/ctl/smd.proto index 00c704e6a81..57cb414634a 100644 --- a/src/proto/ctl/smd.proto +++ b/src/proto/ctl/smd.proto @@ -198,8 +198,7 @@ message LedManageReq { message DevReplaceReq { string old_dev_uuid = 1; // UUID of old (hot-removed) blobstore/device - string new_dev_uuid = 2; // UUID of new (hot-plugged) blobstore/device - bool no_reint = 3; // Skip device reintegration if set + string new_dev_uuid = 2; // UUID of new (hot-plugged) blobstore/device } message SetFaultyReq { diff --git a/src/tests/ftest/control/dmg_storage_query.py b/src/tests/ftest/control/dmg_storage_query.py index 924709163b8..02f90dc8984 100644 --- a/src/tests/ftest/control/dmg_storage_query.py +++ b/src/tests/ftest/control/dmg_storage_query.py @@ -252,7 +252,8 @@ def test_dmg_storage_query_device_state(self): manager.update_expected_states(0, ["Errored"]) expect_failed_engine = True try: - self.dmg.storage_set_faulty(uuid=device['uuid']) + self.dmg.storage_set_faulty(host=device['hosts'].split(':')[0], + uuid=device['uuid']) except CommandFailure: if not expect_failed_engine: self.fail("Error setting the faulty state for {}".format(device['uuid'])) diff --git a/src/tests/ftest/deployment/disk_failure.py b/src/tests/ftest/deployment/disk_failure.py index 23f2132171c..57c7502db76 100644 --- a/src/tests/ftest/deployment/disk_failure.py +++ b/src/tests/ftest/deployment/disk_failure.py @@ -1,5 +1,5 @@ """ - (C) Copyright 2022-2023 Intel Corporation. + (C) Copyright 2022-2024 Intel Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent """ @@ -8,7 +8,6 @@ import time from avocado import fail_on -from ClusterShell.NodeSet import NodeSet from dmg_utils import get_dmg_response, get_storage_query_device_info from exception_utils import CommandFailure from general_utils import list_to_str @@ -67,14 +66,12 @@ def verify_disk_failure(self, num_pool): # Evict a random target from the system evict_device = random.choice(device_info) # nosec self.log.info("Evicting random target: %s", evict_device["uuid"]) - original_hostlist = self.dmg_command.hostlist try: - self.dmg_command.hostlist = evict_device["hosts"].split(":")[0] - get_dmg_response(self.dmg_command.storage_set_faulty, uuid=evict_device["uuid"]) + get_dmg_response(self.dmg_command.storage_set_faulty, + host=evict_device["hosts"].split(":")[0], + uuid=evict_device["uuid"]) except CommandFailure: self.fail("Error evicting target {}".format(evict_device["uuid"])) - finally: - self.dmg_command.hostlist = original_hostlist done = "Completed setting all devices to fault" self.print_and_assert_on_rebuild_failure(done) for thread in threads: @@ -82,16 +79,13 @@ def verify_disk_failure(self, num_pool): # Now replace the faulty NVME device. self.log.info("Replacing evicted target: %s", evict_device["uuid"]) - original_hostlist = self.dmg_command.hostlist try: - self.dmg_command.hostlist = evict_device["hosts"].split(":")[0] - get_dmg_response( - self.dmg_command.storage_replace_nvme, old_uuid=evict_device["uuid"], - new_uuid=evict_device["uuid"]) + get_dmg_response(self.dmg_command.storage_replace_nvme, + host=evict_device["hosts"].split(":")[0], + old_uuid=evict_device["uuid"], + new_uuid=evict_device["uuid"]) except CommandFailure as error: self.fail(str(error)) - finally: - self.dmg_command.hostlist = original_hostlist time.sleep(10) self.log.info( "Reintegrating evicted target: uuid=%s, rank=%s, targets=%s", @@ -142,13 +136,14 @@ def test_disk_fault_to_normal(self): for key in sorted(device): self.log.info(" %s: %s", key, device[key]) try: - self.dmg_command.hostlist = NodeSet(host) # Set the device as faulty - get_dmg_response(self.dmg_command.storage_set_faulty, uuid=device["uuid"]) + get_dmg_response(self.dmg_command.storage_set_faulty, host=host, + uuid=device["uuid"]) # Replace the device with same uuid. passed = False for _ in range(10): - data = self.dmg_command.storage_replace_nvme(old_uuid=device["uuid"], + data = self.dmg_command.storage_replace_nvme(host=host, + old_uuid=device["uuid"], new_uuid=device["uuid"]) if not data['error'] and len(data['response']['host_errors']) == 0: passed = True @@ -158,5 +153,3 @@ def test_disk_fault_to_normal(self): self.fail('Replacing faulty device did not pass after 10 retries') except CommandFailure as error: self.fail(str(error)) - finally: - self.dmg_command.hostlist = self.server_managers[0].hosts diff --git a/src/tests/ftest/util/dmg_utils.py b/src/tests/ftest/util/dmg_utils.py index 34e21f66d0a..effc3172bac 100644 --- a/src/tests/ftest/util/dmg_utils.py +++ b/src/tests/ftest/util/dmg_utils.py @@ -252,16 +252,18 @@ def storage_format(self, force=False, timeout=30, verbose=False): self.timeout = saved_timeout return self.result - def storage_set_faulty(self, uuid, force=True): + def storage_set_faulty(self, host, uuid, force=True): """Get the result of the 'dmg storage set nvme-faulty' command. Args: + host (str): Identifier of host on which action should be performed. uuid (str): Device UUID to query. force (bool, optional): Force setting device state to FAULTY. Defaults to True. """ return self._get_json_result( - ("storage", "set", "nvme-faulty"), uuid=uuid, force=force) + ("storage", "set", "nvme-faulty"), host=host, uuid=uuid, + force=force) def storage_query_list_devices(self, rank=None, health=False, uuid=None): """Get the result of the 'dmg storage query list-devices' command. @@ -338,13 +340,13 @@ def storage_led_check(self, ids=None): return self._get_json_result( ("storage", "led", "check"), ids=ids) - def storage_replace_nvme(self, old_uuid, new_uuid, no_reint=False): + def storage_replace_nvme(self, host, old_uuid, new_uuid): """Get the result of the 'dmg storage replace nvme' command. Args: + host (str): Identifier of host on which action should be performed. old_uuid (str): Old NVME Device ID. new_uuid (str): New NVME Device ID replacing the old device. - no_reint (bool, optional): Don't perform reintegration. Defaults to False. Returns: dict: JSON formatted dmg command result. @@ -354,8 +356,8 @@ def storage_replace_nvme(self, old_uuid, new_uuid, no_reint=False): """ return self._get_json_result( - ("storage", "replace", "nvme"), old_uuid=old_uuid, - new_uuid=new_uuid, no_reint=no_reint) + ("storage", "replace", "nvme"), host=host, old_uuid=old_uuid, + new_uuid=new_uuid) def storage_scan_nvme_health(self): """Get the result of the 'dmg storage scan --nvme-health' command. diff --git a/src/tests/ftest/util/dmg_utils_base.py b/src/tests/ftest/util/dmg_utils_base.py index 31ba1b50f33..72fb0a69de3 100644 --- a/src/tests/ftest/util/dmg_utils_base.py +++ b/src/tests/ftest/util/dmg_utils_base.py @@ -685,7 +685,7 @@ def __init__(self): super().__init__("/run/dmg/storage/replace/nvme/*", "nvme") self.old_uuid = FormattedParameter("--old-uuid {}", None) self.new_uuid = FormattedParameter("--new-uuid {}", None) - self.no_reint = FormattedParameter("--no-reint", False) + self.host = FormattedParameter("--host {}", None) class LedSubCommand(CommandWithSubCommand): """Defines an object for the dmg storage LED command""" @@ -809,6 +809,7 @@ def __init__(self): super().__init__("/run/dmg/storage/query/device-state/*", "nvme-faulty") self.uuid = FormattedParameter("-u {}", None) self.force = FormattedParameter("--force", False) + self.host = FormattedParameter("--host {}", None) class SystemSubCommand(CommandWithSubCommand): """Defines an object for the dmg system sub command.""" @@ -954,7 +955,7 @@ class ListSubCommand(CommandWithParameters): def __init__(self): """Create a dmg telemetry metrics list object.""" super().__init__("/run/dmg/telemetry/metrics/list/*", "list") - self.host = FormattedParameter("--host-list={}", None) + self.host = FormattedParameter("--host={}", None) self.port = FormattedParameter("--port={}", None) class QuerySubCommand(CommandWithParameters): @@ -963,7 +964,7 @@ class QuerySubCommand(CommandWithParameters): def __init__(self): """Create a dmg telemetry metrics query object.""" super().__init__("/run/dmg/telemetry/metrics/query/*", "query") - self.host = FormattedParameter("--host-list={}", None) + self.host = FormattedParameter("--host={}", None) self.port = FormattedParameter("--port={}", None) self.metrics = FormattedParameter("--metrics={}", None) diff --git a/src/tests/ftest/util/nvme_utils.py b/src/tests/ftest/util/nvme_utils.py index 4f4c9dd8eea..2394e22e10e 100644 --- a/src/tests/ftest/util/nvme_utils.py +++ b/src/tests/ftest/util/nvme_utils.py @@ -55,7 +55,7 @@ def set_device_faulty(test, dmg, server, uuid, pool=None, has_sys_xs=False, **kw dict: the json response from the dmg storage set-faulty command. """ - dmg.hostlist = server + kwargs['host'] = server kwargs['uuid'] = uuid try: response = get_dmg_response(dmg.storage_set_faulty, **kwargs) diff --git a/src/tests/ftest/vmd/fault_reintegration.py b/src/tests/ftest/vmd/fault_reintegration.py index b7220d42943..5a10aed7679 100644 --- a/src/tests/ftest/vmd/fault_reintegration.py +++ b/src/tests/ftest/vmd/fault_reintegration.py @@ -168,7 +168,8 @@ def test_nvme_fault_reintegration(self): self.log_step( "Marking the {} device as faulty and verifying it is 'EVICTED' and its " "LED is 'ON'".format(test_dev)) - set_device_faulty(self, self.dmg, self.dmg.hostlist, test_dev, self.pool) + set_device_faulty(self, self.dmg, self.hostlist_servers[0], test_dev, + self.pool) # check device state after set nvme-faulty if not self.verify_dev_led_state(test_dev, "EVICTED", "ON"): @@ -215,7 +216,8 @@ def test_nvme_fault_reintegration(self): # 9. self.log_step("Replace the same drive back.") get_dmg_response( - self.dmg.storage_replace_nvme, old_uuid=test_dev, new_uuid=test_dev) + self.dmg.storage_replace_nvme, host=self.hostlist_servers[0], + old_uuid=test_dev, new_uuid=test_dev) # Wait for rebuild to start self.pool.wait_for_rebuild_to_start() # Wait for rebuild to complete diff --git a/src/tests/ftest/vmd/led.py b/src/tests/ftest/vmd/led.py index d6cb33330d9..b736d0c4abe 100644 --- a/src/tests/ftest/vmd/led.py +++ b/src/tests/ftest/vmd/led.py @@ -1,5 +1,5 @@ """ - (C) Copyright 2020-2023 Intel Corporation. + (C) Copyright 2020-2024 Intel Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent """ @@ -126,11 +126,13 @@ def test_disk_failure_recover(self): uuid_list = sorted(uuid_dict.keys()) self.log.info("Devices on hosts %s: %s", hosts, uuid_list) self.log.info("First device on hosts %s: %s", hosts, uuid_list[0]) - resp = set_device_faulty(self, self.dmg, hosts.split(':')[0], uuid_list[0]) + host = hosts.split(':')[0] + resp = set_device_faulty(self, self.dmg, host, uuid_list[0]) self.log.info("Sleeping for 15 seconds ...") time.sleep(15) self.log.info(resp) - resp = self.dmg.storage_replace_nvme(old_uuid=uuid_list[0], new_uuid=uuid_list[0]) + resp = self.dmg.storage_replace_nvme( + host=host, old_uuid=uuid_list[0], new_uuid=uuid_list[0]) self.log.info("Sleeping for 60 seconds ...") time.sleep(60) self.log.info(resp)