From 60a011d72108fabaa477ab9ffb3914087d04f363 Mon Sep 17 00:00:00 2001 From: Tiago Castro Date: Mon, 29 Jan 2024 16:36:24 +0000 Subject: [PATCH 1/2] fix(core/ha): re-share the nexus on republish Signed-off-by: Tiago Castro --- .../agents/src/bin/core/nexus/operations.rs | 16 +++++++++++----- .../stor-port/src/types/v0/store/nexus.rs | 16 +++++++++++++--- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/control-plane/agents/src/bin/core/nexus/operations.rs b/control-plane/agents/src/bin/core/nexus/operations.rs index 0b6dd01c4..c2c6bb37d 100644 --- a/control-plane/agents/src/bin/core/nexus/operations.rs +++ b/control-plane/agents/src/bin/core/nexus/operations.rs @@ -501,11 +501,8 @@ impl OperationGuardArc { 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!( @@ -521,6 +518,15 @@ impl OperationGuardArc { 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.. + if nexus_state.share != nexus.share { + node.share_nexus(&ShareNexus::from(&nexus)).await?; + self.info_span(|| tracing::info!("Nexus protocol changed successfully")); } + + Ok(()) } } diff --git a/control-plane/stor-port/src/types/v0/store/nexus.rs b/control-plane/stor-port/src/types/v0/store/nexus.rs index 89a25c70e..663ff1a1b 100644 --- a/control-plane/stor-port/src/types/v0/store/nexus.rs +++ b/control-plane/stor-port/src/types/v0/store/nexus.rs @@ -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)] @@ -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 { @@ -202,7 +212,7 @@ impl From for models::NexusSpec { src.share, src.size, src.spec_status, - openapi::apis::Uuid::try_from(src.uuid).unwrap(), + src.uuid, ) } } From 47b30d624b3ffd33de3df96f19fb4ae742fb1b22 Mon Sep 17 00:00:00 2001 From: Tiago Castro Date: Tue, 30 Jan 2024 13:53:59 +0000 Subject: [PATCH 2/2] fix(pool/import): add pool import timeout Default to current 20s timeout which is shared for all pool ops. Signed-off-by: Tiago Castro --- control-plane/agents/src/bin/core/nexus/operations.rs | 2 +- control-plane/grpc/src/context.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/control-plane/agents/src/bin/core/nexus/operations.rs b/control-plane/agents/src/bin/core/nexus/operations.rs index c2c6bb37d..1bf092daf 100644 --- a/control-plane/agents/src/bin/core/nexus/operations.rs +++ b/control-plane/agents/src/bin/core/nexus/operations.rs @@ -521,7 +521,7 @@ impl OperationGuardArc { }?; self.info_span(|| tracing::info!("Nexus successfully recreated")); - // todo: would be good if nexus create also supported publish.. + // 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")); diff --git a/control-plane/grpc/src/context.rs b/control-plane/grpc/src/context.rs index b1049b0f3..66057dbd7 100644 --- a/control-plane/grpc/src/context.rs +++ b/control-plane/grpc/src/context.rs @@ -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(),