Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracing and Platform fixes #782

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions control-plane/agents/src/bin/core/nexus/operations_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ use stor_port::types::v0::{
},
};

use tracing::log::error;

impl OperationGuardArc<NexusSpec> {
/// Attach the specified replica to the volume nexus
/// The replica might need to be shared/unshared so it can be opened by the nexus
Expand Down Expand Up @@ -143,9 +141,10 @@ impl OperationGuardArc<NexusSpec> {
replica_state.node.clone(),
);
if let Err(error) = node.set_replica_entity_id(&set_entity_id).await {
error!(
"Failed to set entity_id for the replica {}",
error.to_string()
tracing::error!(
replica.uuid = %replica_state.uuid,
%error,
"Failed to set entity_id",
);
}
}
Expand Down
14 changes: 4 additions & 10 deletions control-plane/agents/src/bin/core/node/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1283,22 +1283,15 @@ impl ReplicaApi for Arc<tokio::sync::RwLock<NodeWrapper>> {

Ok(replica)
}
Err(SvcError::GrpcRequestError { source, .. })
if source.code() == tonic::Code::DataLoss =>
{
Err(SvcError::ReplicaSetPropertyFailed {
attribute: "entity_id".to_string(),
replica: request.uuid.to_string(),
})
}
Err(error) => {
let mut ctx = dataplane.reconnect(GETS_TIMEOUT).await?;
self.update_pool_replica_states(ctx.deref_mut()).await?;

match self.read().await.replicas().into_iter().find(|replica| {
replica.uuid == request.uuid
(replica.uuid == request.uuid
|| replica.name
== ReplicaName::from_opt_uuid(request.name.as_ref(), &request.uuid)
== ReplicaName::from_opt_uuid(request.name.as_ref(), &request.uuid))
&& replica.entity_id == request.entity_id
}) {
Some(replica) => Ok(replica),
None => Err(error),
Expand Down Expand Up @@ -1420,6 +1413,7 @@ impl ReplicaApi for Arc<tokio::sync::RwLock<NodeWrapper>> {
Err(SvcError::ReplicaSetPropertyFailed {
attribute: "entity_id".to_string(),
replica: request.uuid().to_string(),
source,
})
}
Err(error) => Err(error),
Expand Down
8 changes: 6 additions & 2 deletions control-plane/agents/src/common/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,12 @@ pub enum SvcError {
replicas: u8,
id: String,
},
#[snafu(display("Cannot set '{attribute}' on Replica '{replica}'"))]
ReplicaSetPropertyFailed { attribute: String, replica: String },
#[snafu(display("Cannot set '{attribute}' on Replica '{replica}: {source}'"))]
ReplicaSetPropertyFailed {
attribute: String,
replica: String,
source: tonic::Status,
},
}

impl SvcError {
Expand Down
Loading