Skip to content

Commit

Permalink
feat: add mayastor nvmf rdma capability flag in features
Browse files Browse the repository at this point in the history
Signed-off-by: Diwakar Sharma <diwakar.sharma@datacore.com>
  • Loading branch information
dsharma-dc committed Oct 4, 2024
1 parent 247f269 commit b5eb7e6
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 8 deletions.
4 changes: 3 additions & 1 deletion io-engine/src/core/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,13 @@ impl MayastorFeatures {
let lvm = env::var("ENABLE_LVM").as_deref() == Ok("true");
let snapshot_rebuild =
env::var("ENABLE_SNAPSHOT_REBUILD").as_deref() == Ok("true");

let rdma_capable_io_engine =
env::var("ENABLE_RDMA").as_deref() == Ok("true");
MayastorFeatures {
asymmetric_namespace_access: ana,
logical_volume_manager: lvm,
snapshot_rebuild,
rdma_capable_io_engine,
}
}
/// Get all the supported and enabled features.
Expand Down
7 changes: 7 additions & 0 deletions io-engine/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,12 +530,19 @@ pub struct MayastorFeatures {
pub logical_volume_manager: bool,
/// When set to true, support for snapshot rebuild is enabled.
pub snapshot_rebuild: bool,
/// When set to true, the io-engine instance supports RDMA transport.
pub rdma_capable_io_engine: bool,
}
impl MayastorFeatures {
/// Check if LVM feature is enabled.
pub fn lvm(&self) -> bool {
self.logical_volume_manager
}

/// Get nvmf target's rdma feature state.
pub fn rdma_capable_io_engine(&self) -> bool {
self.rdma_capable_io_engine
}
}

/// Bugfix information to expose to the control-plane.
Expand Down
1 change: 1 addition & 0 deletions io-engine/src/grpc/v1/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ impl From<MayastorFeatures> for host_rpc::MayastorFeatures {
asymmetric_namespace_access: f.asymmetric_namespace_access,
logical_volume_manager: Some(f.logical_volume_manager),
snapshot_rebuild: Some(f.snapshot_rebuild),
rdma_capable_io_engine: Some(f.rdma_capable_io_engine),
}
}
}
Expand Down
19 changes: 14 additions & 5 deletions io-engine/src/subsys/nvmf/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ impl Target {
tgt: NonNull::dangling(),
poll_group_count: 0,
next_state: TargetState::Init,
rdma: MayastorEnvironment::global_or_default().rdma(),
// If mayastor args/env requests this to be true then it'll
// be set to true after ensuring rdma transport is created and
// listener is enabled.
rdma: false,
}
}

Expand Down Expand Up @@ -284,16 +287,22 @@ impl Target {
trid_replica.trsvcid.as_str(),
);

if self.rdma {
if MayastorEnvironment::global_or_default().rdma() {
// listen RDMA also.
let _ = self.listen_rdma().map_err(|e| {
warn!(
let _ = self
.listen_rdma()
.map(|_| {
self.rdma = true;
})
.map_err(|e| {
warn!(
"failed to listen rdma on address. err: {e}:\
The target will however keep running with \
only tcp listener, with performance expectations of tcp"
);
});
});
}

self.next_state();
Ok(())
}
Expand Down
1 change: 0 additions & 1 deletion io-engine/src/subsys/nvmf/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ pub async fn create_and_add_transports(add_rdma: bool) -> Result<(), Error> {
});

if let Err(e) = ret {
// XXX: How to reset Target.rdma = false
// todo: add event mechanism for Target and Nvmfsubsystem
warn!(
"RDMA enablement failed {e}.\
Expand Down
2 changes: 1 addition & 1 deletion utils/dependencies

0 comments on commit b5eb7e6

Please sign in to comment.