diff --git a/control-plane/agents/src/bin/core/nexus/operations.rs b/control-plane/agents/src/bin/core/nexus/operations.rs index 0b6dd01c4..1bf092daf 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/share.. + 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/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(), 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, ) } } diff --git a/tests/bdd/features/capacity/thin/volume/test_mixed.py b/tests/bdd/features/capacity/thin/volume/test_mixed.py index 05bbce2b8..2300a7c26 100644 --- a/tests/bdd/features/capacity/thin/volume/test_mixed.py +++ b/tests/bdd/features/capacity/thin/volume/test_mixed.py @@ -126,11 +126,14 @@ def data_is_being_written_to_the_thin_volume_which_exceeds_the_free_space_on_the thin_replica = list(volume.state.replica_topology.values())[0] pool = ApiClient.pools_api().get_pool(thin_replica.pool) - pool_size_mb = int((pool.state.capacity - pool.state.used) / 1024 / 1024) + pool_avail_size_mb = int((pool.state.capacity - pool.state.used) / 1024 / 1024) + assert ( + volume.spec.size > pool_avail_size_mb + ), "Volume data cannot fit in the pool free space" uri = urlparse(volume.state.target["deviceUri"]) - fio = Fio(name="job", rw="write", uri=uri, size=f"{pool_size_mb}M") + fio = Fio(name="job", rw="write", uri=uri, size=f"{pool_avail_size_mb+1}M") pytest.thin_fio = fio.open()