From 046149c4d95e1d878f06919653bce3772e9c3cbc Mon Sep 17 00:00:00 2001 From: Abhinandan Purkait Date: Wed, 23 Aug 2023 11:07:58 +0000 Subject: [PATCH 1/4] refactor: snapshot listing based on query Signed-off-by: Abhinandan Purkait --- .../core/controller/io_engine/v1/translation.rs | 10 ++++++++-- rpc/api | 2 +- rpc/src/lib.rs | 15 +++++++-------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/control-plane/agents/src/bin/core/controller/io_engine/v1/translation.rs b/control-plane/agents/src/bin/core/controller/io_engine/v1/translation.rs index 886dda823..2ce50743c 100644 --- a/control-plane/agents/src/bin/core/controller/io_engine/v1/translation.rs +++ b/control-plane/agents/src/bin/core/controller/io_engine/v1/translation.rs @@ -574,11 +574,17 @@ impl AgentToIoEngine for transport::ListReplicaSnapshots { transport::ListReplicaSnapshots::ReplicaSnapshots(id) => (Some(id), None), transport::ListReplicaSnapshots::Snapshot(id) => (None, Some(id)), }; + + // All snapshots except the discarded ones. + let non_discarded_snaps = v1::snapshot::list_snapshots_request::Query { + invalid: None, + discarded: Some(false), + }; + v1::snapshot::ListSnapshotsRequest { source_uuid: source.map(ToString::to_string), snapshot_uuid: snapshot.map(ToString::to_string), - snapshot_query_type: - v1::snapshot::SnapshotQueryType::AllSnapshotsExceptDiscardedSnapshots as i32, + query: Some(non_discarded_snaps), } } } diff --git a/rpc/api b/rpc/api index a17cf942f..396a0756c 160000 --- a/rpc/api +++ b/rpc/api @@ -1 +1 @@ -Subproject commit a17cf942fe8efa13a4f018d3cd333308a2ad3405 +Subproject commit 396a0756cb4062eb32226ab37ebbfb9cf257bb98 diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index ed35b27f8..0363083ce 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -18,7 +18,6 @@ pub mod io_engine { use crate::v1::pb::{ CreateReplicaSnapshotResponse, ListSnapshotsResponse, NexusCreateSnapshotResponse, - SnapshotQueryType, }; /// AutoGenerated Io Engine Client V0. pub use mayastor_client::MayastorClient as IoEngineClientV0; @@ -386,7 +385,7 @@ pub mod io_engine { .list_snapshot(super::v1::pb::ListSnapshotsRequest { source_uuid: source_uuid.map(|uuid| uuid.to_string()), snapshot_uuid: snapshot_uuid.map(|uuid| uuid.to_string()), - snapshot_query_type: SnapshotQueryType::AllSnapshots as i32, + query: None, }) .await? .into_inner()) @@ -638,12 +637,12 @@ pub mod v1 { pub mod snapshot { pub use super::pb::{ - destroy_snapshot_request, snapshot_rpc_client, CreateReplicaSnapshotRequest, - CreateReplicaSnapshotResponse, CreateSnapshotCloneRequest, DestroySnapshotRequest, - ListSnapshotCloneRequest, ListSnapshotCloneResponse, ListSnapshotsRequest, - ListSnapshotsResponse, Nexus, NexusCreateSnapshotReplicaDescriptor, - NexusCreateSnapshotReplicaStatus, NexusCreateSnapshotRequest, - NexusCreateSnapshotResponse, SnapshotInfo, SnapshotQueryType, + destroy_snapshot_request, list_snapshots_request, snapshot_rpc_client, + CreateReplicaSnapshotRequest, CreateReplicaSnapshotResponse, + CreateSnapshotCloneRequest, DestroySnapshotRequest, ListSnapshotCloneRequest, + ListSnapshotCloneResponse, ListSnapshotsRequest, ListSnapshotsResponse, Nexus, + NexusCreateSnapshotReplicaDescriptor, NexusCreateSnapshotReplicaStatus, + NexusCreateSnapshotRequest, NexusCreateSnapshotResponse, SnapshotInfo, }; } From efa6dde2d1ba338a35a3309ffbf0b0111706e921 Mon Sep 17 00:00:00 2001 From: Abhinandan Purkait Date: Thu, 24 Aug 2023 08:28:01 +0000 Subject: [PATCH 2/4] refactor: replica listing based on query Signed-off-by: Abhinandan Purkait --- .../src/bin/core/controller/io_engine/v1/replica.rs | 11 ++++++++--- rpc/api | 2 +- rpc/src/lib.rs | 6 +++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/control-plane/agents/src/bin/core/controller/io_engine/v1/replica.rs b/control-plane/agents/src/bin/core/controller/io_engine/v1/replica.rs index 3334301ca..2d9f3d31e 100644 --- a/control-plane/agents/src/bin/core/controller/io_engine/v1/replica.rs +++ b/control-plane/agents/src/bin/core/controller/io_engine/v1/replica.rs @@ -2,7 +2,7 @@ use super::translation::{rpc_replica_to_agent, AgentToIoEngine}; use crate::controller::io_engine::translation::TryIoEngineToAgent; use agents::errors::{GrpcRequest as GrpcRequestError, SvcError}; use rpc::v1::{ - replica::{ListReplicaOptions, ReplicaType}, + replica::{list_replica_options, ListReplicaOptions}, snapshot::{destroy_snapshot_request, DestroySnapshotRequest}, }; use stor_port::{ @@ -19,6 +19,11 @@ use snafu::ResultExt; #[async_trait::async_trait] impl crate::controller::io_engine::ReplicaListApi for super::RpcClient { async fn list_replicas(&self) -> Result, SvcError> { + let replicas_except_snapshots_query = list_replica_options::Query { + replica: true, + snapshot: false, + clone: true, + }; let rpc_replicas = self .replica() .list_replicas(ListReplicaOptions { @@ -26,7 +31,7 @@ impl crate::controller::io_engine::ReplicaListApi for super::RpcClient { poolname: None, uuid: None, pooluuid: None, - replicatype: ReplicaType::AllReplicasExceptSnapshots as i32, + query: Some(replicas_except_snapshots_query), }) .await .context(GrpcRequestError { @@ -58,7 +63,7 @@ impl crate::controller::io_engine::ReplicaListApi for super::RpcClient { poolname: None, uuid: Some(replica_id.to_string()), pooluuid: None, - replicatype: ReplicaType::AllReplicas as i32, + query: None, }) .await .context(GrpcRequestError { diff --git a/rpc/api b/rpc/api index 396a0756c..0bbc1fe2f 160000 --- a/rpc/api +++ b/rpc/api @@ -1 +1 @@ -Subproject commit 396a0756cb4062eb32226ab37ebbfb9cf257bb98 +Subproject commit 0bbc1fe2f185859b821777e8279c50df1ca6bf78 diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 0363083ce..5f29f5398 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -614,9 +614,9 @@ pub mod v1 { /// V1 Replica autogenerated grpc code. pub mod replica { pub use super::pb::{ - destroy_replica_request, replica_rpc_client, CreateReplicaRequest, - DestroyReplicaRequest, ListReplicaOptions, ListReplicasResponse, Replica, - ReplicaSpaceUsage, ReplicaType, ShareReplicaRequest, UnshareReplicaRequest, + destroy_replica_request, list_replica_options, replica_rpc_client, + CreateReplicaRequest, DestroyReplicaRequest, ListReplicaOptions, ListReplicasResponse, + Replica, ReplicaSpaceUsage, ShareReplicaRequest, UnshareReplicaRequest, }; } From ac15c1363985c2ad3df46a5963c19b3deb8abef2 Mon Sep 17 00:00:00 2001 From: Tiago Castro Date: Thu, 24 Aug 2023 18:13:51 +0100 Subject: [PATCH 3/4] ci: disable NVMe CRD Signed-off-by: Tiago Castro --- deployer/src/infra/io_engine.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/deployer/src/infra/io_engine.rs b/deployer/src/infra/io_engine.rs index ff7a69669..fd6ddb564 100644 --- a/deployer/src/infra/io_engine.rs +++ b/deployer/src/infra/io_engine.rs @@ -42,6 +42,7 @@ impl ComponentAction for IoEngine { .with_env("MAYASTOR_NVMF_HOSTID", Uuid::new_v4().to_string().as_str()) .with_env("NEXUS_NVMF_RESV_ENABLE", "1") .with_env("NEXUS_NVMF_ANA_ENABLE", "1") + .with_env("NVMF_TGT_CRDT", "0") .with_bind("/tmp", "/host/tmp") .with_bind("/var/run/dpdk", "/var/run/dpdk"); From b765869beb737d772666a17de685579752c95315 Mon Sep 17 00:00:00 2001 From: Tiago Castro Date: Tue, 22 Aug 2023 12:20:41 +0100 Subject: [PATCH 4/4] test: remove io-engine restart wa Dataplane has fixed several issues where usage cache was not getting discarded, yielded incorrect allocate sizes for lvols so we can now remove the WA's. Signed-off-by: Tiago Castro --- tests/bdd/features/snapshot/restore/test_delete.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/bdd/features/snapshot/restore/test_delete.py b/tests/bdd/features/snapshot/restore/test_delete.py index c252a2fcd..73bb9060a 100644 --- a/tests/bdd/features/snapshot/restore/test_delete.py +++ b/tests/bdd/features/snapshot/restore/test_delete.py @@ -140,9 +140,6 @@ def the_pool_space_usage_should_be_zero(): def the_pool_space_usage_should_reflect_the_original_volume(original_volume): """the pool space usage should reflect the original volume.""" pool = ApiClient.pools_api().get_pool(POOL) - # Bug, dataplane caches allocated, requires a restart until fixed - Docker.restart_container(NODE) - wait_node_online(NODE) volume = Volume.update(original_volume, cached=False) assert pool.state.used == volume.state.usage.allocated @@ -264,8 +261,6 @@ def the_restored_volume_1_snapshot_1_allocation_size_should_be_12mib( restored_1_snapshot_1, ): """the restored volume 1 snapshot 1 allocation size should be 12MiB.""" - Docker.restart_container(NODE) - wait_node_online(NODE) Cluster.wait_cache_update() snapshot = Snapshot.update(restored_1_snapshot_1) assert snapshot.state.allocated_size == 12 * 1024 * 1024 @@ -438,9 +433,6 @@ def the_pool_space_usage_should_reflect_the_snapshot_2_restored_volume_2_and_del restored_1_snapshot_2, ): """the pool space usage should reflect the snapshot 2, restored volume 2, and deleted snapshot and deleted restored volume 1 (16MiB).""" - # Bug, dataplane caches allocated, requires a restart until fixed - Docker.restart_container(NODE) - wait_node_online(NODE) Cluster.wait_cache_update() pool = ApiClient.pools_api().get_pool(POOL)