Skip to content

Commit

Permalink
chore(bors): merge pull request #728
Browse files Browse the repository at this point in the history
728: fix(core/ha): re-share the nexus on republish r=tiagolobocastro a=tiagolobocastro



Co-authored-by: Tiago Castro <tiagolobocastro@gmail.com>
  • Loading branch information
mayastor-bors and tiagolobocastro committed Jan 30, 2024
2 parents 81f812f + 47b30d6 commit ec86e35
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
16 changes: 11 additions & 5 deletions control-plane/agents/src/bin/core/nexus/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,11 +501,8 @@ impl OperationGuardArc<NexusSpec> {
return Err(SvcError::NoOnlineReplicas { id: nexus.name });
}

match node.create_nexus(&CreateNexus::from(&nexus)).await {
Ok(nexus_state) if nexus_state.io_online() => {
nexus.info_span(|| tracing::info!("Nexus successfully recreated"));
Ok(())
}
let nexus_state = match node.create_nexus(&CreateNexus::from(&nexus)).await {
Ok(nexus_state) if nexus_state.io_online() => Ok(nexus_state),
Ok(nexus_state) => {
nexus.warn_span(|| {
tracing::warn!(
Expand All @@ -521,6 +518,15 @@ impl OperationGuardArc<NexusSpec> {
nexus.error_span(|| tracing::error!(error=%error, "Failed to recreate the nexus"));
Err(error)
}
}?;

self.info_span(|| tracing::info!("Nexus successfully recreated"));
// todo: would be good if nexus create also supported publish/share..
if nexus_state.share != nexus.share {
node.share_nexus(&ShareNexus::from(&nexus)).await?;
self.info_span(|| tracing::info!("Nexus protocol changed successfully"));
}

Ok(())
}
}
1 change: 1 addition & 0 deletions control-plane/grpc/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pub fn timeout_grpc(op_id: MessageId, timeout_opts: TimeoutOptions) -> Duration
MessageIdVs::DestroyReplicaSnapshot => min_timeouts.replica_snapshot(),

MessageIdVs::CreatePool => min_timeouts.pool(),
MessageIdVs::ImportPool => min_timeouts.pool(),
MessageIdVs::DestroyPool => min_timeouts.pool(),

MessageIdVs::ReplacePathInfo => min_timeouts.nvme_reconnect(),
Expand Down
16 changes: 13 additions & 3 deletions control-plane/stor-port/src/types/v0/store/nexus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ use crate::types::v0::{
transport::{
self, ChildState, ChildStateReason, ChildUri, CreateNexus, DestroyNexus, HostNqn, NexusId,
NexusNvmfConfig, NexusOwners, NexusShareProtocol, NexusStatus, NodeId, Protocol, ReplicaId,
VolumeId,
ShareNexus, VolumeId,
},
};
use pstor::ApiVersion;
use serde::{Deserialize, Serialize};
use std::convert::TryFrom;

/// Nexus information.
#[derive(Serialize, Deserialize, Debug, PartialEq)]
Expand Down Expand Up @@ -182,6 +181,17 @@ impl From<&NexusSpec> for CreateNexus {
)
}
}
impl From<&NexusSpec> for ShareNexus {
fn from(from: &NexusSpec) -> Self {
Self {
node: from.node.clone(),
uuid: from.uuid.clone(),
key: None,
protocol: from.share.try_into().unwrap_or_default(),
allowed_hosts: from.allowed_hosts.clone(),
}
}
}

impl AsOperationSequencer for NexusSpec {
fn as_ref(&self) -> &OperationSequence {
Expand All @@ -202,7 +212,7 @@ impl From<NexusSpec> for models::NexusSpec {
src.share,
src.size,
src.spec_status,
openapi::apis::Uuid::try_from(src.uuid).unwrap(),
src.uuid,
)
}
}
Expand Down

0 comments on commit ec86e35

Please sign in to comment.