diff --git a/build.rs b/build.rs index ca079a75..47ef381e 100644 --- a/build.rs +++ b/build.rs @@ -28,6 +28,7 @@ fn main() { "protobuf/v1/nexus.proto", "protobuf/v1/registration.proto", "protobuf/v1/snapshot.proto", + "protobuf/v1/test.proto", ], &["protobuf/v1"], ) diff --git a/protobuf/mayastor.proto b/protobuf/mayastor.proto index 795e0ef7..d9f0654f 100644 --- a/protobuf/mayastor.proto +++ b/protobuf/mayastor.proto @@ -51,11 +51,6 @@ service Mayastor { rpc FaultNexusChild (FaultNexusChildRequest) returns (Null) {} rpc ShutdownNexus (ShutdownNexusRequest) returns (Null) {} - // Nexus-level fault injection and other development methods - rpc InjectNexusFault (InjectNexusFaultRequest) returns (Null) {} - rpc RemoveInjectedNexusFault (RemoveInjectedNexusFaultRequest) returns (Null) {} - rpc ListInjectedNexusFaults (ListInjectedNexusFaultsRequest) returns (ListInjectedNexusFaultsReply) {} - // This method is called by control plane to construct a block device // (/dev/...) that will be used to connect the nexus to the OS. rpc PublishNexus (PublishNexusRequest) returns (PublishNexusReply) {} @@ -393,29 +388,6 @@ message FaultNexusChildRequest { string uri = 2; // URI of the child device to be faulted } -message InjectNexusFaultRequest { - string uuid = 1; // uuid of the nexus - string uri = 2; // Fault injection URI -} - -message RemoveInjectedNexusFaultRequest { - string uuid = 1; // uuid of the nexus - string uri = 2; // Fault injection URI -} - -message InjectedFault { - string device_name = 1; - bool is_active = 2; -} - -message ListInjectedNexusFaultsRequest { - string uuid = 1; // uuid of the nexus -} - -message ListInjectedNexusFaultsReply { - repeated InjectedFault injections = 1; -} - // this message will be subject to change as we will add support for remote // storage protocols. message PublishNexusRequest { diff --git a/protobuf/v1/nexus.proto b/protobuf/v1/nexus.proto index bc871cb5..2a5132f0 100644 --- a/protobuf/v1/nexus.proto +++ b/protobuf/v1/nexus.proto @@ -25,11 +25,6 @@ service NexusRpc { rpc ShutdownNexus (ShutdownNexusRequest) returns (ShutdownNexusResponse) {} - // Nexus-level fault injection and other development methods - rpc InjectNexusFault (InjectNexusFaultRequest) returns (google.protobuf.Empty) {} - rpc RemoveInjectedNexusFault (RemoveInjectedNexusFaultRequest) returns (google.protobuf.Empty) {} - rpc ListInjectedNexusFaults (ListInjectedNexusFaultsRequest) returns (ListInjectedNexusFaultsReply) {} - // This method is called by control plane to construct a block device // (/dev/...) that will be used to connect the nexus to the OS. rpc PublishNexus (PublishNexusRequest) returns (PublishNexusResponse) {} @@ -211,29 +206,6 @@ message FaultNexusChildResponse { Nexus nexus = 1; } -message InjectNexusFaultRequest { - string uuid = 1; // uuid of the nexus - string uri = 2; // Fault injection URI -} - -message RemoveInjectedNexusFaultRequest { - string uuid = 1; // uuid of the nexus - string uri = 2; // Fault injection URI -} - -message InjectedFault { - string device_name = 1; - bool is_active = 2; -} - -message ListInjectedNexusFaultsRequest { - string uuid = 1; // uuid of the nexus -} - -message ListInjectedNexusFaultsReply { - repeated InjectedFault injections = 1; -} - // this message will be subject to change as we will add support for remote // storage protocols. message PublishNexusRequest { diff --git a/protobuf/v1/test.proto b/protobuf/v1/test.proto new file mode 100644 index 00000000..8faffbae --- /dev/null +++ b/protobuf/v1/test.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; + +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; + +package mayastor.v1; + +// Service to be used by test code, it is not meant to be used in production! +service TestRpc { + // + // Fault injection methods. + // + + // Add a fault injection. + rpc AddInjection (AddInjectionRequest) returns (google.protobuf.Empty) {} + + // Remove a fault injection. + rpc RemoveInjection (RemoveInjectionRequest) returns (google.protobuf.Empty) {} + + // List existing fault injections. + rpc ListInjections (ListInjectionsRequest) returns (ListInjectionsReply) {} +} + +message Injection { + // URI that was used to add the fault injection. + string uri = 1; + // Target device name to which the injection applies. + string device_name = 2; + // True if the injection is currently active (injection active condition + // has been met). + bool is_active = 3; +} + +message AddInjectionRequest { + // URI that defines injection target and parameters. + string uri = 1; +} + +message RemoveInjectionRequest { + // URI that was used to add the fault injection. + string uri = 1; +} + +message ListInjectionsRequest { +} + +message ListInjectionsReply { + repeated Injection injections = 1; +} diff --git a/src/v1.rs b/src/v1.rs index 5c7fd21e..bc5e160d 100644 --- a/src/v1.rs +++ b/src/v1.rs @@ -82,17 +82,25 @@ pub mod nexus { AddChildNexusRequest, AddChildNexusResponse, Child, ChildAction, ChildOperationRequest, ChildOperationResponse, ChildState, ChildStateReason, CreateNexusRequest, CreateNexusResponse, DestroyNexusRequest, FaultNexusChildRequest, FaultNexusChildResponse, - GetNvmeAnaStateRequest, GetNvmeAnaStateResponse, InjectNexusFaultRequest, InjectedFault, - ListInjectedNexusFaultsReply, ListInjectedNexusFaultsRequest, ListNexusOptions, - ListNexusResponse, ListRebuildHistoryRequest, ListRebuildHistoryResponse, Nexus, - NexusNvmePreemption, NexusState, NvmeAnaState, NvmeReservation, PauseRebuildRequest, - PauseRebuildResponse, PublishNexusRequest, PublishNexusResponse, RebuildHistoryRecord, - RebuildHistoryRequest, RebuildHistoryResponse, RebuildJobState, RebuildStateRequest, - RebuildStateResponse, RebuildStatsRequest, RebuildStatsResponse, RemoveChildNexusRequest, - RemoveChildNexusResponse, RemoveInjectedNexusFaultRequest, ResumeRebuildRequest, - ResumeRebuildResponse, SetNvmeAnaStateRequest, SetNvmeAnaStateResponse, ShareProtocol, - ShutdownNexusRequest, ShutdownNexusResponse, StartRebuildRequest, StartRebuildResponse, - StopRebuildRequest, StopRebuildResponse, UnpublishNexusRequest, UnpublishNexusResponse, + GetNvmeAnaStateRequest, GetNvmeAnaStateResponse, ListNexusOptions, ListNexusResponse, + ListRebuildHistoryRequest, ListRebuildHistoryResponse, Nexus, NexusNvmePreemption, + NexusState, NvmeAnaState, NvmeReservation, PauseRebuildRequest, PauseRebuildResponse, + PublishNexusRequest, PublishNexusResponse, RebuildHistoryRecord, RebuildHistoryRequest, + RebuildHistoryResponse, RebuildJobState, RebuildStateRequest, RebuildStateResponse, + RebuildStatsRequest, RebuildStatsResponse, RemoveChildNexusRequest, + RemoveChildNexusResponse, ResumeRebuildRequest, ResumeRebuildResponse, + SetNvmeAnaStateRequest, SetNvmeAnaStateResponse, ShareProtocol, ShutdownNexusRequest, + ShutdownNexusResponse, StartRebuildRequest, StartRebuildResponse, StopRebuildRequest, + StopRebuildResponse, UnpublishNexusRequest, UnpublishNexusResponse, + }; +} + +pub mod test { + pub use super::pb::{ + test_rpc_client::TestRpcClient, + test_rpc_server::{TestRpc, TestRpcServer}, + AddInjectionRequest, Injection, ListInjectionsReply, ListInjectionsRequest, + RemoveInjectionRequest, }; }