diff --git a/.packit.yaml b/.packit.yaml index 6252e8be58..bb3d31e1c4 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -33,7 +33,25 @@ jobs: - fedora-rawhide - job: tests + identifier: local trigger: pull_request - manual_trigger: true 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/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 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 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}"