Skip to content

Commit

Permalink
Merge pull request #3710 from mulkieran/stratisd-version-3.7.3
Browse files Browse the repository at this point in the history
Stratisd version 3.7.3
  • Loading branch information
mulkieran authored Oct 18, 2024
2 parents e51bf29 + 1c9ee4e commit b9ad1e5
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 4 deletions.
16 changes: 15 additions & 1 deletion .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,21 @@ jobs:
- job: copr_build
trigger: pull_request
targets:
- fedora-all
- fedora-development

- job: copr_build
trigger: pull_request
additional_repos:
- https://dl.fedoraproject.org/pub/fedora/linux/updates/testing/40/Everything/x86_64/
targets:
- fedora-40

- job: copr_build
trigger: pull_request
additional_repos:
- https://dl.fedoraproject.org/pub/fedora/linux/updates/testing/39/Everything/x86_64/
targets:
- fedora-39

- job: tests
identifier: local
Expand Down
11 changes: 11 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
stratisd 3.7.3
==============
Recommended Rust toolchain version: 1.81.0
Recommended development platform for Python development: Fedora 40

* Cherry-picked commits:
* Allow improper ctypes in bindgen-generated bindings
* Build f40 and f39 copr repos with additional repo
* Tidies
* Change matches macro expansion to assert_matches

stratisd 3.7.2
==============
Recommended Rust toolchain version: 1.81.0
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stratisd"
version = "3.7.2"
version = "3.7.3"
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
Expand Down
14 changes: 13 additions & 1 deletion src/engine/strat_engine/backstore/backstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,18 @@ where
level: ActionAvailability::NoRequests,
};
}
if let Err(e) = blockdev.reload_crypt_metadata() {
warn!(
"Failed to reload on-disk metadata for device {}: {}",
blockdev.physical_path().display(),
e,
);
return StratisError::RollbackError {
causal_error: Box::new(causal_error),
rollback_error: Box::new(e),
level: ActionAvailability::NoRequests,
};
}
}

causal_error
Expand Down Expand Up @@ -1332,7 +1344,7 @@ mod tests {
Ok(false)
);

matches!(
assert_matches!(
backstore.bind_clevis(
"tang",
&json!({"url": env::var("TANG_URL").expect("TANG_URL env var required"), "stratis:tang:trust_url": true})
Expand Down
9 changes: 9 additions & 0 deletions src/engine/strat_engine/backstore/blockdev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,15 @@ impl StratBlockDev {
self.blksizes
}

/// Reload the crypt metadata from disk and store in the crypt handle if the device is
/// encrypted.
pub fn reload_crypt_metadata(&mut self) -> StratisResult<()> {
match self.underlying_device.crypt_handle_mut() {
Some(handle) => handle.reload_metadata(),
None => Ok(()),
}
}

/// Bind encrypted device using the given clevis configuration.
pub fn bind_clevis(&mut self, pin: &str, clevis_info: &Value) -> StratisResult<()> {
let crypt_handle = self.underlying_device.crypt_handle_mut().ok_or_else(|| {
Expand Down
11 changes: 11 additions & 0 deletions src/engine/strat_engine/backstore/crypt/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,17 @@ impl CryptHandle {
}
}

/// Reload the required information for Stratis from the LUKS2 metadata.
pub fn reload_metadata(&mut self) -> StratisResult<()> {
match setup_crypt_device(self.luks2_device_path())? {
Some(ref mut device) => {
self.metadata = load_crypt_metadata(device, self.luks2_device_path())?.ok_or_else(|| StratisError::Msg("Found no crypt metadata on this device".to_string()))?;
Ok(())
}
None => Err(StratisError::Msg("Expected device to be an encrypted device but could not acquire handle to crypt device".to_string())),
}
}

/// Get the encryption info for this encrypted device.
pub fn encryption_info(&self) -> &EncryptionInfo {
&self.metadata.encryption_info
Expand Down
1 change: 1 addition & 0 deletions src/systemd/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(improper_ctypes)]
#![allow(clippy::redundant_static_lifetimes)]
#![allow(clippy::unreadable_literal)]
#![allow(clippy::missing_safety_doc)]
Expand Down

0 comments on commit b9ad1e5

Please sign in to comment.