Skip to content

Commit

Permalink
build: update nixpkgs and deps
Browse files Browse the repository at this point in the history
Signed-off-by: Tiago Castro <[email protected]>
  • Loading branch information
tiagolobocastro committed Nov 1, 2024
1 parent 9f22912 commit 62aafa9
Show file tree
Hide file tree
Showing 83 changed files with 1,017 additions and 611 deletions.
File renamed without changes.
1,164 changes: 795 additions & 369 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions control-plane/agents/src/bin/core/controller/io_engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ pub(crate) trait NexusChildApi<Add, Rm, Flt> {
/// Remove a child from its parent nexus via gRPC.
async fn remove_child(&self, request: &RemoveNexusChild) -> Result<Rm, SvcError>;
/// Fault a child from its parent nexus via gRPC.
#[allow(unused)]
async fn fault_child(&self, request: &FaultNexusChild) -> Result<Flt, SvcError>;
}

Expand All @@ -150,6 +151,7 @@ where
}

/// Offline a child within its parent nexus via gRPC.
#[allow(unused)]
async fn offline_child(&self, request: Ctx) -> Result<Nexus, SvcError> {
self.child_action(NexusChildAction::new(
request,
Expand All @@ -172,6 +174,7 @@ pub(crate) trait NexusSnapshotApi {
#[async_trait]
pub(crate) trait NexusChildRebuildApi {
/// Lists rebuild history for a given nexus.
#[allow(unused)]
async fn get_rebuild_history(
&self,
request: &GetRebuildRecord,
Expand Down Expand Up @@ -209,6 +212,7 @@ pub(crate) trait ReplicaSnapshotApi {
) -> Result<Replica, SvcError>;

/// List snapshot clones.
#[allow(unused)]
async fn list_snapshot_clones(
&self,
request: &ListSnapshotClones,
Expand All @@ -225,6 +229,7 @@ pub(crate) trait HostApi {

/// Interface for snapshot rebuilding operations.
#[async_trait]
#[allow(dead_code)]
pub(crate) trait SnapshotRebuildApi {
/// Create a new snapshot rebuild.
async fn create_snap_rebuild(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub(crate) use transport::{CreateNexusSnapReplDescr, CreateNexusSnapshot};
/// A response for the nexus snapshot request.
pub struct CreateNexusSnapshotResp {
/// The nexus involved in the snapshot operation.
#[allow(unused)]
pub nexus: transport::Nexus,
/// Timestamp when the nexus was paused to take the snapshot on all replicas.
pub snap_time: SystemTime,
Expand All @@ -34,13 +35,15 @@ pub(crate) struct RebuildHistoryResp {
}

/// Create a Snapshot Rebuild on target node where the replica resides on.
#[allow(dead_code)]
pub(crate) struct CreateSnapRebuild {
/// The uuid of the rebuilding replica.
pub(crate) replica_uuid: transport::ReplicaId,
/// The nvmf URI of the source Snapshot.
pub(crate) source_uri: String,
}
/// The status of the snapshot Rebuild.
#[allow(dead_code)]
pub(crate) type SnapshotRebuildStatus = rpc::v1::snapshot_rebuild::RebuildStatus;
#[derive(Debug)]
#[allow(dead_code)]
Expand Down Expand Up @@ -75,13 +78,16 @@ pub(crate) struct SnapshotRebuild {
pub(crate) end_timestamp: Option<SystemTime>,
}
/// List all or a specific snapshot rebuild.
#[allow(dead_code)]
pub(crate) struct ListSnapRebuild {
/// Select a specific target replica.
pub(crate) uuid: Option<transport::ReplicaId>,
}
/// A list of snapshot rebuilds.
#[allow(dead_code)]
pub(crate) type ListSnapRebuildRsp = Vec<SnapshotRebuild>;
/// Destroy a snapshot rebuild.
#[allow(dead_code)]
pub(crate) struct DestroySnapRebuild {
/// The uuid of the particular rebuild to destroy, which is also the uuid of the replica
/// which is being rebuilt.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ impl IoEngineToAgent for v0::block_device::Filesystem {
}

/// Node Agent Conversions

impl IoEngineToAgent for v0::BlockDevice {
type AgentMessage = transport::BlockDevice;
fn to_agent(&self) -> Self::AgentMessage {
Expand Down Expand Up @@ -129,7 +128,6 @@ impl TryIoEngineToAgent for v0::ReplicaV2 {
}

/// Nexus Agent conversions

impl TryIoEngineToAgent for v0::NexusV2 {
type AgentMessage = transport::Nexus;

Expand Down Expand Up @@ -321,7 +319,6 @@ impl AgentToIoEngine for transport::DestroyPool {
}

/// Volume Agent Conversions

impl AgentToIoEngine for transport::CreateNexus {
type IoEngineMessage = v0::CreateNexusV2Request;
fn to_rpc(&self) -> Self::IoEngineMessage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub(crate) struct RpcClient {
nexus: NexusClient,
pool: PoolClient,
snapshot: SnapshotClient,
#[allow(dead_code)]
snapshot_rebuild: SnapshotRebuildClient,
context: GrpcContext,
}
Expand Down Expand Up @@ -80,6 +81,7 @@ impl RpcClient {
self.snapshot.clone()
}
/// Get the v1 snapshot rebuild client.
#[allow(dead_code)]
fn snap_rebuild(&self) -> SnapshotRebuildClient {
self.snapshot_rebuild.clone()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl crate::controller::io_engine::ReplicaListApi for super::RpcClient {
request: "list_replicas (uuid)",
})?;

match rpc_replicas.get_ref().replicas.get(0) {
match rpc_replicas.get_ref().replicas.first() {
Some(replica) if replica.uuid == replica_id.as_str() => {
rpc_replica_to_agent(replica, self.context.node())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ mod test {
let replica_api = api_client.replicas_api();
let replicas = replica_api.get_replicas().await.unwrap();
let replica = replicas.first().unwrap();
let replica_uuid: ReplicaId = replica.uuid.try_into().unwrap();
let replica_uuid: ReplicaId = replica.uuid.into();
let lock = Arc::new(tokio::sync::Mutex::new(()));
let one_s = std::time::Duration::from_secs(1);
let ctx = GrpcContext::new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl IoEngineToAgent for v1::host::Filesystem {
fstype: self.fstype.clone(),
label: self.label.clone(),
uuid: self.uuid.clone(),
mountpoint: self.mountpoints.get(0).cloned().unwrap_or_default(),
mountpoint: self.mountpoints.first().cloned().unwrap_or_default(),
}
}
}
Expand Down Expand Up @@ -743,8 +743,10 @@ impl TryFrom<ExternalType<v1::nexus::RebuildHistoryRecord>> for transport::Rebui
type Error = SvcError;
fn try_from(value: ExternalType<v1::nexus::RebuildHistoryRecord>) -> Result<Self, Self::Error> {
Ok(Self {
#[allow(clippy::unnecessary_fallible_conversions)]
child_uri: transport::ChildUri::try_from(value.0.child_uri)
.map_err(|_| SvcError::InvalidArguments {})?,
#[allow(clippy::unnecessary_fallible_conversions)]
src_uri: transport::ChildUri::try_from(value.0.src_uri)
.map_err(|_| SvcError::InvalidArguments {})?,
state: v1::nexus::RebuildJobState::try_from(value.0.state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ pub(crate) trait ResourceSnapshotting {
request: &Self::Create,
) -> Result<Self::CreateOutput, SvcError>;
/// List snapshots from the `Self` resource.
#[allow(unused)]
async fn list_snaps(
&self,
registry: &Registry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use stor_port::{
replica::ReplicaSpec,
snapshots::volume::VolumeSnapshot,
volume::{AffinityGroupSpec, VolumeContentSource, VolumeSpec},
AsOperationSequencer, OperationMode, OperationSequence, SpecStatus, SpecTransaction,
AsOperationSequencer, OperationMode, SpecStatus, SpecTransaction,
},
transport::{AppNodeId, NexusId, NodeId, PoolId, ReplicaId, SnapshotId, VolumeId},
},
Expand All @@ -48,9 +48,6 @@ enum SpecError {
obj_type: StorableObjectType,
source: serde_json::Error,
},
/// Failed to get entries from the persistent store.
#[snafu(display("Key does not contain UUID"))]
KeyUuid {},
}

/// What to do when creation fails.
Expand Down Expand Up @@ -188,6 +185,7 @@ pub(crate) trait GuardedOperationsHelper:

/// Validates the outcome of a create step.
/// In case of an error, the object is set to deleting.
#[allow(unused)]
async fn validate_create_step<R: Send, O>(
&self,
registry: &Registry,
Expand Down Expand Up @@ -745,21 +743,7 @@ pub(crate) trait SpecOperationsHelper:
}
Ok(())
}
fn operation_lock(&self) -> &OperationSequence {
self.as_ref()
}
fn operation_lock_mut(&mut self) -> &mut OperationSequence {
self.as_mut()
}

/// Check if the state is in sync with the spec
fn state_synced(&self, state: &Self::State) -> bool
where
Self: PartialEq<Self::State>,
{
// todo: do the check explicitly on each specialization rather than using PartialEq
self == state
}
/// Start a create transaction
fn start_create_op(&mut self, request: &Self::Create);
/// Start a destroy transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ where

/// Remove an element from the map.
pub(crate) fn remove(&mut self, key: &I) {
self.map.remove(key);
self.map.swap_remove(key);
}

/// Populate the resource map.
Expand Down Expand Up @@ -144,7 +144,7 @@ where

/// Remove an element from the map.
pub(crate) fn remove(&mut self, key: &I) {
self.map.remove(key);
self.map.swap_remove(key);
}

/// Populate the resource map.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use weighted_scoring::{Criteria, Value, ValueGrading, WeightedScore};
#[async_trait::async_trait(?Send)]
pub(crate) trait ResourcePolicy<Request: ResourceFilter>: Sized {
fn apply(self, to: Request) -> Request;
#[allow(dead_code)]
fn apply_async(self, to: Request) -> Request {
self.apply(to)
}
Expand Down Expand Up @@ -50,6 +51,7 @@ pub(crate) trait ResourceFilter: Sized {
fn policy<P: ResourcePolicy<Self>>(self, policy: P) -> Self {
policy.apply(self)
}
#[allow(dead_code)]
fn policy_async<P: ResourcePolicy<Self>>(self, policy: P) -> Self {
policy.apply_async(self)
}
Expand All @@ -61,9 +63,11 @@ pub(crate) trait ResourceFilter: Sized {
data.list.retain(|v| filter(param, &data.context, v));
self
}
#[allow(dead_code)]
fn filter_iter(self, filter: fn(Self) -> Self) -> Self {
filter(self)
}
#[allow(dead_code)]
async fn filter_iter_async<F, Fut>(self, filter: F) -> Self
where
F: Fn(Self) -> Fut,
Expand All @@ -90,6 +94,7 @@ pub(crate) trait ResourceFilter: Sized {
self
}
fn collect(self) -> Vec<Self::Item>;
#[allow(dead_code)]
fn group_by<K, V, F: Fn(&Self::Request, &Vec<Self::Item>) -> HashMap<K, V>>(
mut self,
group: F,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ impl NexusTargetNode {

/// Get `Self` with a default set of filters for nodes following the criteria (any order):
/// 1. The target node should be online.
/// 2. Give preference to nodes which have lesser number of active nexuses, for
/// proper distribution.
/// 2. Give preference to nodes which have lesser number of active nexuses, for proper
/// distribution.
pub(crate) async fn builder_with_defaults(
request: impl Into<GetSuitableNodes>,
registry: &Registry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ impl AddVolumeNexusReplicas {
/// 1. replicas which are not part of the given nexus already
/// 2. use only replicas which report the status of online by their state
/// 3. use only replicas which are large enough for the volume
///
/// Sorted by:
/// 1. nexus local replicas
/// 2. replicas which have never been marked as faulted by io-engine
Expand Down
1 change: 1 addition & 0 deletions control-plane/agents/src/bin/core/controller/states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ impl ResourceStates {
}

/// Returns an iterator of pool states.
#[allow(unused)]
pub(crate) fn pool_states(&self) -> Values<PoolId, Resource<PoolState>> {
self.pools.values()
}
Expand Down
2 changes: 1 addition & 1 deletion control-plane/agents/src/bin/core/node/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ impl Service {
);
});
node_specs.into_iter().for_each(|spec| {
if nodes.get(spec.id()).is_none() {
if nodes.contains_key(spec.id()) {
nodes.insert(
spec.id().clone(),
Node::new(spec.id().clone(), Some(spec), None),
Expand Down
4 changes: 4 additions & 0 deletions control-plane/agents/src/bin/core/node/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ impl NodeWrapper {
self.node_state().grpc_endpoint.to_string()
}
/// Get all pools
#[allow(unused)]
pub(crate) fn pools(&self) -> Vec<PoolState> {
self.resources()
.pool_states()
Expand Down Expand Up @@ -1037,6 +1038,7 @@ pub(crate) trait ClientOps {
#[async_trait]
pub(crate) trait InternalOps {
/// Get the inner lock, typically used to sync mutating gRPC operations.
#[allow(dead_code)]
async fn grpc_lock(&self) -> Arc<tokio::sync::Mutex<()>>;
/// Update the node's nexus state information.
async fn update_nexus_states(&self, ctx: &mut GrpcClient) -> Result<(), SvcError>;
Expand All @@ -1053,6 +1055,7 @@ pub(crate) trait InternalOps {
/// Update a node's replica state information.
async fn update_replica_state(&self, state: Either<Replica, ReplicaId>);
/// Update the node's snapshot state information.
#[allow(dead_code)]
async fn update_snapshot_states(&self, ctx: &mut GrpcClient) -> Result<(), SvcError>;
/// Update a node's snapshot state information.
async fn update_snapshot_state(&self, state: Either<ReplicaSnapshot, SnapshotId>);
Expand All @@ -1067,6 +1070,7 @@ pub(crate) trait InternalOps {
/// resources, such as pools, replicas and nexuses.
#[async_trait]
pub(crate) trait GetterOps {
#[allow(unused)]
async fn pools(&self) -> Vec<PoolState>;
async fn pool_wrappers(&self) -> Vec<PoolWrapper>;
async fn pool(&self, pool_id: &PoolId) -> Option<PoolState>;
Expand Down
6 changes: 3 additions & 3 deletions control-plane/agents/src/bin/core/tests/deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ fn test_deserialization_v1_to_v2() {
name: "456122b1-7e19-4148-a890-579ca785a119".to_string(),
node: "mayastor-node4".into(),
children: vec![
NexusChild::Replica(ReplicaUri::new(&ReplicaId::try_from("82779efa-a0c7-4652-a37b-83eefd894714").unwrap(), &ChildUri::try_from("bdev:///82779efa-a0c7-4652-a37b-83eefd894714?uuid=82779efa-a0c7-4652-a37b-83eefd894714").unwrap())),
NexusChild::Replica(ReplicaUri::new(&ReplicaId::try_from("2d98fa96-ac12-40be-acdc-e3559c0b1530").unwrap(), &ChildUri::try_from("nvmf://136.144.51.237:8420/nqn.2019-05.com.org:2d98fa96-ac12-40be-acdc-e3559c0b1530?uuid=2d98fa96-ac12-40be-acdc-e3559c0b1530").unwrap())),
NexusChild::Replica(ReplicaUri::new(&ReplicaId::try_from("620ff519-419a-48d6-97a8-c1ba3260d87e").unwrap(), &ChildUri::try_from("nvmf://136.144.51.239:8420/nqn.2019-05.com.org:620ff519-419a-48d6-97a8-c1ba3260d87e?uuid=620ff519-419a-48d6-97a8-c1ba3260d87e").unwrap()))
NexusChild::Replica(ReplicaUri::new(&ReplicaId::try_from("82779efa-a0c7-4652-a37b-83eefd894714").unwrap(), &ChildUri::from("bdev:///82779efa-a0c7-4652-a37b-83eefd894714?uuid=82779efa-a0c7-4652-a37b-83eefd894714"))),
NexusChild::Replica(ReplicaUri::new(&ReplicaId::try_from("2d98fa96-ac12-40be-acdc-e3559c0b1530").unwrap(), &ChildUri::from("nvmf://136.144.51.237:8420/nqn.2019-05.com.org:2d98fa96-ac12-40be-acdc-e3559c0b1530?uuid=2d98fa96-ac12-40be-acdc-e3559c0b1530"))),
NexusChild::Replica(ReplicaUri::new(&ReplicaId::try_from("620ff519-419a-48d6-97a8-c1ba3260d87e").unwrap(), &ChildUri::from("nvmf://136.144.51.239:8420/nqn.2019-05.com.org:620ff519-419a-48d6-97a8-c1ba3260d87e?uuid=620ff519-419a-48d6-97a8-c1ba3260d87e")))
],
size: 2147483648,
spec_status: NexusSpecStatus::Created(NexusStatus::Online),
Expand Down
2 changes: 1 addition & 1 deletion control-plane/agents/src/bin/core/tests/nexus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ async fn nexus() {
/// The tests below revolve around transactions and are dependent on the core agent's command line
/// arguments for timeouts.
/// This is required because as of now, we don't have a good mocking strategy

///
/// default timeout options for every rpc request
fn grpc_timeout_opts() -> TimeoutOptions {
TimeoutOptions::default()
Expand Down
2 changes: 1 addition & 1 deletion control-plane/agents/src/bin/core/tests/pool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ async fn pool() {
/// The tests below revolve around transactions and are dependent on the core agent's command line
/// arguments for timeouts.
/// This is required because as of now, we don't have a good mocking strategy

///
/// default timeout options for every rpc request
fn grpc_timeout_opts() -> TimeoutOptions {
TimeoutOptions::default()
Expand Down
Loading

0 comments on commit 62aafa9

Please sign in to comment.