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 <dmitry.savitskiy@datacore.com>
  • Loading branch information
dsavitskiy committed Aug 14, 2023
1 parent a17cf94 commit a141ff9
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 69 deletions.
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
38 changes: 38 additions & 0 deletions protobuf/v1/test.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ service TestRpc {
// The replica MUST NOT have any user data and must not be currently used
// by any nexus => this will cause data loss!
rpc WipeReplica (WipeReplicaRequest) returns (stream WipeReplicaResponse) {}

//
// Fault injection methods.
//
// Add a fault injection.
rpc AddFaultInjection (AddFaultInjectionRequest) returns (google.protobuf.Empty) {}

// Remove a fault injection.
rpc RemoveFaultInjection (RemoveFaultInjectionRequest) returns (google.protobuf.Empty) {}

// List existing fault injections.
rpc ListFaultInjections (ListFaultInjectionsRequest) returns (ListInjectionsReply) {}
}

message WipeReplicaRequest {
Expand Down Expand Up @@ -78,3 +90,29 @@ message WipeReplicaResponse {
google.protobuf.Duration since = 9;
}

message FaultInjection {
// 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 AddFaultInjectionRequest {
// URI that defines injection target and parameters.
string uri = 1;
}

message RemoveFaultInjectionRequest {
// URI that was used to add the fault injection.
string uri = 1;
}

message ListFaultInjectionsRequest {
}

message ListInjectionsReply {
repeated FaultInjection injections = 1;
}
26 changes: 13 additions & 13 deletions src/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,26 +83,26 @@ 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},
wipe_options, wipe_replica_request, StreamWipeOptions, WipeOptions, WipeReplicaRequest,
WipeReplicaResponse,
wipe_options, wipe_replica_request, AddFaultInjectionRequest, FaultInjection,
ListFaultInjectionsReply, ListFaultnjectionsRequest, RemoveFaultInjectionRequest,
StreamWipeOptions, WipeOptions, WipeReplicaRequest, WipeReplicaResponse,
};
}

Expand Down

0 comments on commit a141ff9

Please sign in to comment.