Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
05a4410
Prototype of Version with zbus
jbaublitz Oct 16, 2025
9491a39
Prototype of udev event handling and pool addition to the D-Bus
jbaublitz Oct 28, 2025
3ad82a2
Prototype of signal handling with zbus
jbaublitz Oct 30, 2025
b71d6e8
Prototype of adding filesystems
jbaublitz Oct 30, 2025
53840d5
Add ManagerR0 interface
jbaublitz Nov 6, 2025
7c18eb4
Add ManagerR1 interface
jbaublitz Nov 14, 2025
e4ab215
Add ManagerR2 interface
jbaublitz Nov 18, 2025
0c6e93a
Add ManagerR3 interface
jbaublitz Nov 20, 2025
1c3e248
Add ManagerR4 interface
jbaublitz Nov 20, 2025
340feac
Add ManagerR5 interface
jbaublitz Nov 20, 2025
1abf35e
Add ManagerR6 interface
jbaublitz Nov 20, 2025
aa0cef6
Add ManagerR7 interface
jbaublitz Nov 20, 2025
d389a52
Add ManagerR8 interface
jbaublitz Nov 20, 2025
ea7d46f
Add ManagerR9 interface
jbaublitz Nov 21, 2025
68fad68
Refactor error handling in signal dispatch to not return early
jbaublitz Nov 26, 2025
cfdae97
Refactor error handling in Manager registration
jbaublitz Nov 26, 2025
028cee5
Add PoolR0 interface
jbaublitz Nov 21, 2025
e71343e
Add PoolR1 interface
jbaublitz Dec 16, 2025
306839b
Add PoolR2 interface
jbaublitz Dec 16, 2025
e91842e
Add PoolR3 interface
jbaublitz Dec 16, 2025
2ffc2b9
Add PoolR4 interface
jbaublitz Dec 16, 2025
69700e6
Add PoolR5 interface
jbaublitz Dec 17, 2025
c4f3355
Add PoolR6 interface
jbaublitz Dec 17, 2025
bc42f2a
Add PoolR7 interface
jbaublitz Dec 18, 2025
4d4a06a
Add PoolR8 interface
jbaublitz Dec 18, 2025
11e5c42
Add PoolR9 interface
jbaublitz Dec 18, 2025
e65db56
Fix no alloc space signal code
jbaublitz Dec 18, 2025
9280f20
Fix snake case naming in Manager interfaces
jbaublitz Dec 18, 2025
9342b74
Add forgotten MetadataVersion property
jbaublitz Dec 18, 2025
3215952
Fix deadlock in destroy_pool method
jbaublitz Dec 18, 2025
9aa402e
Fix deadlock in stop_pool method
jbaublitz Dec 18, 2025
f1ec946
Fixes for stopped_pool and locked_pool property and start pool method
jbaublitz Dec 19, 2025
265d24c
Avoid double free in zbus migration
jbaublitz Jan 5, 2026
60f3bf9
Fix deadlocks in start and stop pool implementations
jbaublitz Jan 5, 2026
6be402a
Fix return values that crash D-Bus socket
jbaublitz Jan 6, 2026
6afe9f5
Implementation of blockdev interfaces
mulkieran Dec 11, 2025
26379b8
Implementation of filesystem interfaces
mulkieran Dec 11, 2025
d2bedf2
Implement Report interfaces
mulkieran Dec 17, 2025
575efc6
Add blockdev registration to pool registration
mulkieran Dec 11, 2025
69c731e
Register Report interfaces
mulkieran Dec 17, 2025
01f418c
Implement EngineStateReport method on Manager
mulkieran Dec 18, 2025
d134c06
Add blockdev object paths when devices added to pool
mulkieran Dec 22, 2025
85d9d88
Unregister blockdevs at the appropriate times
mulkieran Jan 6, 2026
1ba7ede
destroy_filesystems: return String types for filesystem UUIDs
mulkieran Jan 7, 2026
88d48e1
set_name: return String types for filesystem UUIDs
mulkieran Jan 7, 2026
213a199
set_name: return String types for pool UUIDs
mulkieran Jan 7, 2026
a675985
Send signal for updated origins on filesystem deletion
jbaublitz Jan 7, 2026
aecfb34
Add signal handling for SetName on filesystem interfaces
jbaublitz Jan 7, 2026
16cda1e
Add signal handling for blockdev physical size change on blockdev int…
jbaublitz Jan 7, 2026
d029a5f
Add signal handling for background filesystem property change signals
jbaublitz Jan 7, 2026
1fa1715
Remove legacy D-Bus API
jbaublitz Jan 7, 2026
2958c82
Add detail to UUID/object path table collision error messages
mulkieran Jan 8, 2026
1f792ee
Unregister filesystem object paths at the appropriate times
mulkieran Jan 8, 2026
4ee982e
Convert size strings to Bytes for D-Bus
mulkieran Jan 8, 2026
e3e117a
Add check to reject creating more than one filesystem at a time
jbaublitz Jan 8, 2026
ad1783c
Remove filesystem object paths when error during teardown
mulkieran Jan 9, 2026
1e9be53
Fix hang on filesystem signal emit
mulkieran Jan 10, 2026
123ca04
Make Manager insertion of a duplicate UUID a warning instead of an error
jbaublitz Jan 13, 2026
630695f
Add infrastructure for all_read_available and all_write_availlable
jbaublitz Jun 10, 2025
cf7c82d
Add Engine interface for read_all_available and write_all_available
jbaublitz Jun 30, 2025
1ebba8a
Change timer checks to acquire only available pools for write locks
jbaublitz Aug 20, 2025
79d4e56
Add encryption support in V2 crypt handle
jbaublitz Jul 16, 2024
b346c1c
Add Engine interface for encrypting pool
jbaublitz Jul 16, 2024
21434d9
Add D-Bus interface for encrypting pool
jbaublitz Jul 16, 2024
8ff6bbe
Unit test for online encryption
jbaublitz Jan 20, 2025
e7eb509
Add reencryption support in both crypt handles
jbaublitz Sep 17, 2024
6f5d792
Add Engine interface for reencrypting pool
jbaublitz Sep 17, 2024
25e0c9e
Add D-Bus interface for reencrypting pool
jbaublitz Sep 17, 2024
3585c1d
Unit test for online reencryption
jbaublitz Feb 4, 2025
a4106a4
Add decryption support in V2 crypt handle
jbaublitz Jan 22, 2025
4a1efe9
Add Engine interface for decrypting pool
jbaublitz Jan 30, 2025
96fab86
Add D-Bus interface for decrypting pool
jbaublitz Feb 3, 2025
5794c7d
Unit test for online decryption
jbaublitz Feb 12, 2025
ad3d892
Perform rollback for setup operations in reencryption
jbaublitz Feb 24, 2025
da74e72
Add last reencrypted timestamp to engine
jbaublitz Apr 29, 2025
cb3c1e9
Update timestamp on successful decryption and reencryption operations
jbaublitz May 1, 2025
aa6bdfa
Add reencryption timestamp API to engine
jbaublitz May 1, 2025
857d2d9
Add property to indicate when the pool was last reencrypted
jbaublitz May 6, 2025
4b12305
Add change signal for last encrypted timestamp
jbaublitz May 6, 2025
832fd85
Refactor reencryption to use a read lock during operation
jbaublitz Jul 28, 2025
a75f266
Add upgrade and downgrade to lock and use in reencryption
jbaublitz Aug 7, 2025
b5f6dd1
Refactor encryption to use a read lock during operation
jbaublitz Aug 7, 2025
7e92c65
Refactor decryption to use a read lock during operation
jbaublitz Aug 15, 2025
5583180
Add prechecks for all key description-related operations
jbaublitz Jan 20, 2026
b40697c
Allow parallel encryption, reencryption and decryption operations
jbaublitz Jan 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
629 changes: 540 additions & 89 deletions Cargo.lock

Large diffs are not rendered by default.

17 changes: 7 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ version = "1.2.3"
optional = true

[dependencies.chrono]
version = "0.4.20"
version = "0.4.31"
optional = true
default-features = false
features = ["clock", "std"]
Expand All @@ -101,14 +101,6 @@ optional = true
version = "0.34.4"
optional = true

[dependencies.dbus]
version = "0.9.0"
optional = true

[dependencies.dbus-tree]
version = "0.9.2"
optional = true

[dependencies.either]
version = "1.6.1"
optional = true
Expand Down Expand Up @@ -235,6 +227,11 @@ version = "1.0.0"
optional = true
features = ["serde", "v4"]

[dependencies.zbus]
version = "5.12.0"
optional = true
features = ["tokio"]

[build-dependencies]
pkg-config = "0.3.31"

Expand Down Expand Up @@ -288,7 +285,7 @@ engine = [
"dep:uuid"
]
default = ["dbus_enabled", "engine"]
dbus_enabled = ["dep:dbus", "dep:dbus-tree"]
dbus_enabled = ["dep:zbus"]
extras = ["dep:pretty-hex"]
min = ["dep:termios"]
systemd_compat = ["dep:bindgen"]
Expand Down
53 changes: 53 additions & 0 deletions src/dbus/blockdev/blockdev_3_0/methods.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

use std::sync::Arc;

use crate::{
dbus::{consts::OK_STRING, types::DbusErrorEnum, util::tuple_to_option},
engine::{DevUuid, Engine, PoolIdentifier, PoolUuid, RenameAction},
stratis::StratisError,
};

pub async fn set_user_info_method(
engine: &Arc<dyn Engine>,
uuid: PoolUuid,
bd_uuid: DevUuid,
new_id_spec: (bool, &str),
) -> ((bool, DevUuid), u16, String) {
let default_return = (false, DevUuid::nil());

match engine
.get_mut_pool(PoolIdentifier::Uuid(uuid))
.await
.ok_or_else(|| StratisError::Msg(format!("No pool associated with uuid {uuid}")))
{
Err(err) => (default_return, DbusErrorEnum::ERROR as u16, err.to_string()),
Ok(mut guard) => {
let (pool_name, _, pool) = guard.as_mut_tuple();
match handle_action!(pool.set_blockdev_user_info(
&pool_name,
bd_uuid,
tuple_to_option(new_id_spec)
)) {
Ok(RenameAction::NoSource) => (
default_return,
DbusErrorEnum::ERROR as u16,
format!("pool doesn't know about block device {bd_uuid}"),
),
Ok(RenameAction::Renamed(_)) => (
(true, bd_uuid),
DbusErrorEnum::OK as u16,
OK_STRING.to_string(),
),
Ok(RenameAction::Identity) => (
default_return,
DbusErrorEnum::OK as u16,
OK_STRING.to_string(),
),
Err(err) => (default_return, DbusErrorEnum::ERROR as u16, err.to_string()),
}
}
}
}
149 changes: 149 additions & 0 deletions src/dbus/blockdev/blockdev_3_0/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

use std::sync::Arc;

use tokio::sync::RwLock;
use zbus::{
fdo::Error,
interface,
zvariant::{ObjectPath, OwnedObjectPath},
Connection,
};

use crate::{
dbus::{blockdev::shared::blockdev_prop, manager::Manager},
engine::{DevUuid, Engine, Lockable, PoolUuid},
stratis::StratisResult,
};

mod methods;
mod props;

pub use methods::set_user_info_method;
pub use props::{
devnode_prop, hardware_info_prop, init_time_prop, physical_path_prop, pool_prop, tier_prop,
total_physical_size_prop, user_info_prop,
};

pub struct BlockdevR0 {
engine: Arc<dyn Engine>,
manager: Lockable<Arc<RwLock<Manager>>>,
parent_uuid: PoolUuid,
uuid: DevUuid,
}

impl BlockdevR0 {
fn new(
engine: Arc<dyn Engine>,
manager: Lockable<Arc<RwLock<Manager>>>,
parent_uuid: PoolUuid,
uuid: DevUuid,
) -> Self {
BlockdevR0 {
engine,
manager,
parent_uuid,
uuid,
}
}

pub async fn register(
engine: Arc<dyn Engine>,
connection: &Arc<Connection>,
manager: &Lockable<Arc<RwLock<Manager>>>,
path: ObjectPath<'_>,
parent_uuid: PoolUuid,
uuid: DevUuid,
) -> StratisResult<()> {
let blockdev = Self::new(engine, manager.clone(), parent_uuid, uuid);

connection.object_server().at(path, blockdev).await?;
Ok(())
}

pub async fn unregister(
connection: &Arc<Connection>,
path: ObjectPath<'_>,
) -> StratisResult<()> {
connection
.object_server()
.remove::<BlockdevR0, _>(path)
.await?;
Ok(())
}
}

#[interface(name = "org.storage.stratis3.blockdev.r0", introspection_docs = false)]
impl BlockdevR0 {
#[zbus(out_args("changed", "return_code", "return_string"))]
async fn set_user_info(&self, id: (bool, &str)) -> ((bool, DevUuid), u16, String) {
set_user_info_method(&self.engine, self.parent_uuid, self.uuid, id).await
}

#[zbus(property(emits_changed_signal = "const"))]
async fn devnode(&self) -> Result<String, Error> {
blockdev_prop(&self.engine, self.parent_uuid, self.uuid, devnode_prop).await
}

#[zbus(property(emits_changed_signal = "const"))]
async fn hardware_info(&self) -> Result<(bool, String), Error> {
blockdev_prop(
&self.engine,
self.parent_uuid,
self.uuid,
hardware_info_prop,
)
.await
}

#[zbus(property(emits_changed_signal = "false"))]
async fn user_info(&self) -> Result<(bool, String), Error> {
blockdev_prop(&self.engine, self.parent_uuid, self.uuid, user_info_prop).await
}

#[zbus(property(emits_changed_signal = "const"))]
async fn initialization_time(&self) -> Result<u64, Error> {
blockdev_prop(&self.engine, self.parent_uuid, self.uuid, init_time_prop)
.await
.and_then(|r| r)
}

#[zbus(property(emits_changed_signal = "const"))]
async fn pool(&self) -> Result<OwnedObjectPath, Error> {
pool_prop(self.manager.read().await, self.parent_uuid)
}

#[zbus(property(emits_changed_signal = "const"))]
fn uuid(&self) -> DevUuid {
self.uuid
}

#[zbus(property(emits_changed_signal = "false"))]
async fn tier(&self) -> Result<u16, Error> {
blockdev_prop(&self.engine, self.parent_uuid, self.uuid, tier_prop).await
}

#[zbus(property(emits_changed_signal = "const"))]
async fn physical_path(&self) -> Result<String, Error> {
blockdev_prop(
&self.engine,
self.parent_uuid,
self.uuid,
physical_path_prop,
)
.await
}

#[zbus(property)]
async fn total_physical_size(&self) -> Result<String, Error> {
blockdev_prop(
&self.engine,
self.parent_uuid,
self.uuid,
total_physical_size_prop,
)
.await
}
}
53 changes: 53 additions & 0 deletions src/dbus/blockdev/blockdev_3_0/props.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

use tokio::sync::OwnedRwLockReadGuard;
use zbus::{fdo::Error, zvariant::OwnedObjectPath};

use crate::{
dbus::{util::option_to_tuple, Manager},
engine::{BlockDev, BlockDevTier, DevUuid, PoolUuid, SharedGuard},
};

pub fn devnode_prop(_: BlockDevTier, _: DevUuid, dev: &dyn BlockDev) -> String {
dev.metadata_path().display().to_string()
}

pub fn hardware_info_prop(_: BlockDevTier, _: DevUuid, dev: &dyn BlockDev) -> (bool, String) {
option_to_tuple(dev.hardware_info().map(|s| s.to_owned()), String::new())
}

pub fn init_time_prop(_: BlockDevTier, _: DevUuid, dev: &dyn BlockDev) -> Result<u64, Error> {
u64::try_from(dev.initialization_time().timestamp()).map_err(|e| Error::Failed(e.to_string()))
}

pub fn physical_path_prop(_: BlockDevTier, _: DevUuid, dev: &dyn BlockDev) -> String {
dev.devnode().display().to_string()
}

pub fn pool_prop(
guard: SharedGuard<OwnedRwLockReadGuard<Manager>>,
pool_uuid: PoolUuid,
) -> Result<OwnedObjectPath, Error> {
guard
.pool_get_path(&pool_uuid)
.ok_or_else(|| {
Error::Failed(format!(
"No object path associated with pool UUID {pool_uuid}"
))
})
.cloned()
}

pub fn total_physical_size_prop(_: BlockDevTier, _: DevUuid, dev: &dyn BlockDev) -> String {
(*dev.size().bytes()).to_string()
}

pub fn tier_prop(tier: BlockDevTier, _: DevUuid, _: &dyn BlockDev) -> u16 {
tier as u16
}

pub fn user_info_prop(_: BlockDevTier, _: DevUuid, dev: &dyn BlockDev) -> (bool, String) {
option_to_tuple(dev.user_info().map(|s| s.to_owned()), String::new())
}
Loading
Loading