Skip to content

Commit

Permalink
feat(api): fault injection made more generic
Browse files Browse the repository at this point in the history
Fault injection support moved from nexus API to a new testing API,
and made more generic.
Injectiosn removed from v0 API.

Signed-off-by: Dmitry Savitskiy <[email protected]>
  • Loading branch information
dsavitskiy committed Jul 28, 2023
1 parent 400c703 commit e03b92d
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 67 deletions.
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ fn main() {
"protobuf/v1/nexus.proto",
"protobuf/v1/registration.proto",
"protobuf/v1/snapshot.proto",
"protobuf/v1/testing.proto",
],
&["protobuf/v1"],
)
Expand Down
28 changes: 0 additions & 28 deletions protobuf/mayastor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down Expand Up @@ -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 {
Expand Down
28 changes: 0 additions & 28 deletions protobuf/v1/nexus.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down Expand Up @@ -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 {
Expand Down
35 changes: 35 additions & 0 deletions protobuf/v1/testing.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
syntax = "proto3";

package mayastor.v1;

import "google/protobuf/wrappers.proto";
import "google/protobuf/empty.proto";
import "common.proto";

service TestingRpc {
// Fault injection.
rpc AddInjection (AddInjectionRequest) returns (google.protobuf.Empty) {}
rpc RemoveInjection (RemoveInjectionRequest) returns (google.protobuf.Empty) {}
rpc ListInjections (ListInjectionsRequest) returns (ListInjectionsReply) {}
}

message Injection {
string uri = 1;
string device_name = 2;
bool is_active = 3;
}

message AddInjectionRequest {
string uri = 1;
}

message RemoveInjectionRequest {
string uri = 1;
}

message ListInjectionsRequest {
}

message ListInjectionsReply {
repeated Injection injections = 1;
}
30 changes: 19 additions & 11 deletions src/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 testing {
pub use super::pb::{
testing_rpc_client::TestingRpcClient,
testing_rpc_server::{TestingRpc, TestingRpcServer},
AddInjectionRequest, Injection, ListInjectionsReply, ListInjectionsRequest,
RemoveInjectionRequest,
};
}

Expand Down

0 comments on commit e03b92d

Please sign in to comment.