Skip to content

Commit

Permalink
Merge pull request #56 from openebs/cherry
Browse files Browse the repository at this point in the history
    feat(test/features): expose test features
    
    Signed-off-by: Tiago Castro <[email protected]>

---

    feat(io-engine/api/cksum): add wipe checksum
    
    Checksums a replica which can be used to verify data between volume replicas.
    For speed sake we're reusing the existing wipe replicas as it's a very good
    fit for this and we can reuse the entire infra around it.
    todo: consider renaming wipe etc
    
    Signed-off-by: Tiago Castro <[email protected]>

---

    feat(eventing): event specific details for host events
    
    Signed-off-by: Vandana Varakantham <[email protected]>
    Signed-off-by: Tiago Castro <[email protected]>
  • Loading branch information
tiagolobocastro authored Dec 8, 2023
2 parents b591fb0 + 5cb2ba1 commit 36fa598
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 7 deletions.
4 changes: 4 additions & 0 deletions apis/events/protobuf/v1/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,8 @@ message NvmePathEventDetails {
message HostInitiatorEventDetails {
string host_nqn = 1;
string subsystem_nqn = 2;
// The target on which the host is connected to the subsystem - Nexus/Replica
string target = 3;
// Target uuid
string uuid = 4;
}
13 changes: 13 additions & 0 deletions apis/events/src/event_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,19 @@ impl EventSource {
}
}

/// Add target(nexus/replica) details to host event meta data.
pub fn with_target_data(mut self, target: &str, uuid: &str) -> Self {
if let Some(mut event_details) = self.event_details {
if let Some(mut host_initiator_details) = event_details.host_initiator_details {
host_initiator_details.target = target.to_string();
host_initiator_details.uuid = uuid.to_string();
event_details.host_initiator_details = Some(host_initiator_details);
}
self.event_details = Some(event_details);
}
self
}

/// Add host event specific data to event source.
pub fn with_host_initiator_data(mut self, host_nqn: &str) -> Self {
if let Some(mut event_details) = self.event_details {
Expand Down
32 changes: 28 additions & 4 deletions apis/io-engine/protobuf/v1/test.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ package mayastor.v1;

// Service to be used by test code, it is not meant to be used in production!
service TestRpc {
// Get all the features supported by the test service.
rpc GetFeatures (google.protobuf.Empty) returns (TestFeatures) {}

// Replica related methods.
//
// Wipe a replica using the selected method.
Expand All @@ -28,6 +31,13 @@ service TestRpc {
rpc ListFaultInjections (ListFaultInjectionsRequest) returns (ListFaultInjectionsReply) {}
}

message TestFeatures {
// Supported wipe methods.
repeated WipeOptions.WipeMethod wipe_methods = 1;
// Supported checksum algorithms.
repeated WipeOptions.CheckSumAlgorithm cksum_algs = 2;
}

message WipeReplicaRequest {
// Uuid of the replica.
string uuid = 1;
Expand All @@ -43,19 +53,28 @@ message WipeReplicaRequest {
message WipeOptions {
enum WipeMethod {
// Don't actually wipe, just pretend.
NONE = 0;
NONE = 0;
// Wipe by writing zeroes.
WRITE_ZEROES = 1;
WRITE_ZEROES = 1;
// Wipe by sending unmap/trim.
UNMAP = 2;
UNMAP = 2;
// Wipe by writing a given patter (see write_pattern(6) field).
WRITE_PATTERN = 3;
WRITE_PATTERN = 3;
// Checksum the bdev.
CHECKSUM = 4;
}
// Method used to wipe the bdev.
WipeMethod wipe_method = 1;
// When using WRITE_PATTERN, wipe using this 32bit write pattern
// Default: 0xDEADBEEF.
optional uint32 write_pattern = 2;

enum CheckSumAlgorithm {
// The CRC32C is a variant of CRC32.
Crc32c = 0;
}
// When using CHECKSUM, use the following algorithm.
CheckSumAlgorithm cksum_alg = 3;
}

message StreamWipeOptions {
Expand Down Expand Up @@ -88,6 +107,11 @@ message WipeReplicaResponse {
uint64 remaining_bytes = 8;
// Duration since the start of the wipe.
google.protobuf.Duration since = 9;
// When using CHECKSUM, output of the algorithm.
oneof checksum {
// 32bit CRC.
uint32 crc32 = 10;
}
}

message FaultInjection {
Expand Down
7 changes: 4 additions & 3 deletions apis/io-engine/src/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ pub mod test {
pub use super::pb::{
test_rpc_client::TestRpcClient,
test_rpc_server::{TestRpc, TestRpcServer},
wipe_options, wipe_replica_request, AddFaultInjectionRequest, FaultInjection,
ListFaultInjectionsReply, ListFaultInjectionsRequest, RemoveFaultInjectionRequest,
StreamWipeOptions, WipeOptions, WipeReplicaRequest, WipeReplicaResponse,
wipe_options, wipe_replica_request, wipe_replica_response, AddFaultInjectionRequest,
FaultInjection, ListFaultInjectionsReply, ListFaultInjectionsRequest,
RemoveFaultInjectionRequest, StreamWipeOptions, TestFeatures, WipeOptions,
WipeReplicaRequest, WipeReplicaResponse,
};
}

Expand Down

0 comments on commit 36fa598

Please sign in to comment.