From e0f9ca80747e5e0db75c069dd41179442e30778c Mon Sep 17 00:00:00 2001 From: John Baublitz Date: Thu, 9 Nov 2023 13:58:26 -0500 Subject: [PATCH 1/4] Fix alignment problems Currently, data allocations from the cap device are data block aligned. Metadata allocations, however, are not. This can lead to data allocations after a metadata allocation to become unaligned as well. This has performance implications. This commit addresses this in a backwards compatiable way by using our previous metadata size calculation but rounds the total desired metadata device size up to the nearest data block size multiple. This has a few very desirable properties: 1. The metadata allocations will always be aligned to the data block size boundary. 2. The metadata allocations may appear a bit larger, but the overall growth of the step function tracks the linear growth of the original metadata space calculation function. 3. While this commit does not resolve alignment issues for pools that have already bumped into this problem, this code should theoretically cause future allocations on affected pools to be in alignment, minimizing performance impact for future allocations on affected pools. --- src/engine/strat_engine/cmd.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/engine/strat_engine/cmd.rs b/src/engine/strat_engine/cmd.rs index 6702155ebc..764548fb09 100644 --- a/src/engine/strat_engine/cmd.rs +++ b/src/engine/strat_engine/cmd.rs @@ -440,6 +440,8 @@ pub fn clevis_luks_regen(dev_path: &Path, keyslot: c_uint) -> StratisResult<()> /// Determine the number of sectors required to house the specified parameters for /// the thin pool that determine metadata size. +/// +/// Precondition: block_size is a power of 2. pub fn thin_metadata_size( block_size: Sectors, pool_size: Sectors, @@ -468,16 +470,22 @@ pub fn thin_metadata_size( })? .read_to_string(&mut output)?; if is_ok { - Ok(min( - THIN_META_MULT_FACTOR + let round = block_size - Sectors(1); + let determined_size = Sectors( + *(THIN_META_MULT_FACTOR * Sectors( output .trim() .parse::() .map_err(|e| StratisError::Msg(e.to_string()))?, - ), - MAX_META_SIZE.sectors(), - )) + ) + + round) + & !*round, + ); + assert!(determined_size % block_size == Sectors(0)); + let max = Sectors(*MAX_META_SIZE.sectors() & !*round); + assert!(max % block_size == Sectors(0)); + Ok(min(determined_size, max)) } else { Err(StratisError::Msg(format!( "thin_metadata_size failed: {output}" From 45201d72ad9829325fb169e6d1c3922f35eddf79 Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 13 Nov 2023 10:51:17 -0500 Subject: [PATCH 2/4] Remove manual_trigger key from packit test config With this change, tests should trigger automatically after build. They can still be re-triggered using the manual option at any time. Signed-off-by: mulhern --- .packit.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.packit.yaml b/.packit.yaml index 6252e8be58..8bae253d67 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -34,6 +34,5 @@ jobs: - job: tests trigger: pull_request - manual_trigger: true targets: - fedora-rawhide From 43118ac920c1cdd36cd33001d8b8c7205e091da2 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 13 Nov 2023 10:58:40 +0100 Subject: [PATCH 3/4] Run cockpit storage tests in PRs This provides additional API/regression validation for stratisd PRs. See https://cockpit-project.org/blog/tmt-cross-project-testing.html Fixes https://issues.redhat.com/browse/COCKPIT-1070 Signed-off-by: Martin Pitt --- .packit.yaml | 19 +++++++++++++++++++ plans/all.fmf | 5 +++++ plans/cockpit.fmf | 20 ++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 plans/cockpit.fmf diff --git a/.packit.yaml b/.packit.yaml index 8bae253d67..bb3d31e1c4 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -33,6 +33,25 @@ jobs: - fedora-rawhide - job: tests + identifier: local trigger: pull_request targets: - fedora-rawhide + + # run Cockpit storage tests, see plans/ with `cockpit == yes` + - job: tests + identifier: cockpit + trigger: pull_request + notifications: + failure_comment: + message: "Cockpit tests failed for commit {commit_sha}. @martinpitt, @jelly, @mvollmer please check." + targets: + - fedora-development + tf_extra_params: + environments: + - artifacts: + - type: repository-file + id: https://copr.fedorainfracloud.org/coprs/g/cockpit/main-builds/repo/fedora-$releasever/group_cockpit-main-builds-fedora-$releasever.repo + tmt: + context: + plan: "cockpit" diff --git a/plans/all.fmf b/plans/all.fmf index 607d0442b0..ca4c929ad5 100644 --- a/plans/all.fmf +++ b/plans/all.fmf @@ -1,4 +1,9 @@ summary: top level management + +adjust: + when: plan == cockpit + enabled: false + prepare: - name: Install packages how: install diff --git a/plans/cockpit.fmf b/plans/cockpit.fmf new file mode 100644 index 0000000000..c35edd5f17 --- /dev/null +++ b/plans/cockpit.fmf @@ -0,0 +1,20 @@ +# reverse dependency test for https://github.com/cockpit-project/cockpit +# packit should automatically notify the cockpit maintainers on failures. +# For questions, please contact @martinpitt, @jelly, @mvollmer + +enabled: false +adjust: + when: plan == cockpit + enabled: true + +discover: + how: fmf + url: https://github.com/cockpit-project/cockpit + ref: main +execute: + how: tmt + +/optional: + summary: Run tests for optional packages (including storage) + discover+: + test: /test/browser/optional From f04dfefbd70875ea5ba47625778d33a061478461 Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 13 Nov 2023 11:51:09 -0500 Subject: [PATCH 4/4] version 3.6.2 Signed-off-by: mulhern --- CHANGES.txt | 11 +++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 12efd33ecc..59f5e2d964 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,14 @@ +stratisd 3.6.2 +============== +Recommended Rust toolchain version: 1.73.0 +Recommended development platform for Python development: Fedora 38 + +- Cherry-picked commits: + * Run cockpit storage tests in PRs + * Remove manual_trigger key from packit test config + * Fix alignment of metadata device to data block size + + stratisd 3.6.1 ============== Recommended Rust toolchain version: 1.73.0 diff --git a/Cargo.lock b/Cargo.lock index 7fbf8fc968..d3554b3ce1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1269,7 +1269,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stratisd" -version = "3.6.1" +version = "3.6.2" dependencies = [ "assert_cmd", "assert_matches", diff --git a/Cargo.toml b/Cargo.toml index 3a5e2606bf..8bf774527d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "stratisd" -version = "3.6.1" +version = "3.6.2" authors = ["Stratis Developers "] edition = "2021" rust-version = "1.71.1" # LOWEST SUPPORTED RUST TOOLCHAIN