Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
47 changes: 25 additions & 22 deletions 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
Expand Up @@ -230,7 +230,7 @@ optional = true
features = ["serde", "v4"]

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

Expand Down
6 changes: 3 additions & 3 deletions src/dbus/blockdev/blockdev_3_3/props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use std::sync::Arc;

use tokio::sync::RwLock;
use zbus::{Connection, Error};
use zbus::{fdo::Error, Connection};

use crate::{
dbus::{
Expand All @@ -32,15 +32,15 @@ pub async fn set_user_info_prop(
let (pool_name, _, pool) = guard.as_mut_tuple();
if pool
.get_blockdev(dev_uuid)
.ok_or_else(|| Error::Failure(format!("Blockdev with UUID {dev_uuid} not found")))?
.ok_or_else(|| Error::Failed(format!("Blockdev with UUID {dev_uuid} not found")))?
.1
.user_info()
== user_info
{
Ok(false)
} else {
pool.set_blockdev_user_info(&pool_name, dev_uuid, user_info)
.map_err(|e| Error::Failure(e.to_string()))?;
.map_err(|e| Error::Failed(e.to_string()))?;
Ok(true)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/dbus/blockdev/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ pub async fn set_blockdev_prop<'a, 'b, V, F, Fut, S, SFut>(
) -> Result<(), zbus::Error>
where
F: FnOnce(SomeLockWriteGuard<PoolUuid, dyn Pool>, DevUuid, V) -> Fut,
Fut: Future<Output = Result<bool, zbus::Error>>,
Fut: Future<Output = Result<bool, Error>>,
S: FnOnce(&'a Arc<Connection>, &'b Lockable<Arc<RwLock<Manager>>>, DevUuid) -> SFut,
SFut: Future<Output = ()>,
{
let guard = engine
.get_mut_pool(PoolIdentifier::Uuid(uuid))
.await
.ok_or_else(|| zbus::Error::Failure(format!("No pool associated with UUID {uuid}")))?;
.ok_or_else(|| Error::Failed(format!("No pool associated with UUID {uuid}")))?;

let changed = f(guard, bd_uuid, value).await?;
// Guard is dropped here, lock is released
Expand Down
2 changes: 1 addition & 1 deletion src/dbus/filesystem/filesystem_3_6/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl FilesystemR6 {
}

#[zbus(property)]
async fn set_size_limit(&self, value: (bool, String)) -> Result<(), zbus::Error> {
async fn set_size_limit(&self, value: (bool, String)) -> Result<(), Error> {
set_filesystem_prop(
&self.engine,
&self.connection,
Expand Down
6 changes: 3 additions & 3 deletions src/dbus/filesystem/filesystem_3_6/props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::sync::Arc;

use devicemapper::Bytes;
use tokio::sync::RwLock;
use zbus::{Connection, Error};
use zbus::{fdo::Error, Connection};

use crate::{
dbus::{
Expand Down Expand Up @@ -34,15 +34,15 @@ pub async fn set_size_limit_prop(
let size_limit_str = tuple_to_option(size_limit_tuple);
let size_limit = match size_limit_str {
Some(lim) => Some(Bytes(lim.parse::<u128>().map_err(|e| {
Error::Failure(format!("Failed to parse {lim} as unsigned integer: {e}"))
Error::Failed(format!("Failed to parse {lim} as unsigned integer: {e}"))
})?)),
None => None,
};
let (_, _, pool) = guard.as_mut_tuple();
match pool.set_fs_size_limit(fs_uuid, size_limit) {
Ok(PropChangeAction::NewValue(_v)) => Ok(true),
Ok(PropChangeAction::Identity) => Ok(false),
Err(e) => Err(Error::Failure(e.to_string())),
Err(e) => Err(Error::Failed(e.to_string())),
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/dbus/filesystem/filesystem_3_7/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl FilesystemR7 {
}

#[zbus(property)]
async fn set_merge_scheduled(&self, value: bool) -> Result<(), zbus::Error> {
async fn set_merge_scheduled(&self, value: bool) -> Result<(), Error> {
set_filesystem_prop(
&self.engine,
&self.connection,
Expand Down Expand Up @@ -174,7 +174,7 @@ impl FilesystemR7 {
}

#[zbus(property)]
async fn set_size_limit(&self, value: (bool, String)) -> Result<(), zbus::Error> {
async fn set_size_limit(&self, value: (bool, String)) -> Result<(), Error> {
set_filesystem_prop(
&self.engine,
&self.connection,
Expand Down
4 changes: 2 additions & 2 deletions src/dbus/filesystem/filesystem_3_7/props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use std::sync::Arc;

use tokio::sync::RwLock;
use zbus::{Connection, Error};
use zbus::{fdo::Error, Connection};

use crate::{
dbus::{
Expand Down Expand Up @@ -36,7 +36,7 @@ pub async fn set_merge_scheduled_prop(
match pool.set_fs_merge_scheduled(fs_uuid, scheduled) {
Ok(PropChangeAction::NewValue(_v)) => Ok(true),
Ok(PropChangeAction::Identity) => Ok(false),
Err(e) => Err(Error::Failure(e.to_string())),
Err(e) => Err(Error::Failed(e.to_string())),
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/dbus/filesystem/filesystem_3_8/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl FilesystemR8 {
}

#[zbus(property)]
async fn set_merge_scheduled(&self, value: bool) -> Result<(), zbus::Error> {
async fn set_merge_scheduled(&self, value: bool) -> Result<(), Error> {
set_filesystem_prop(
&self.engine,
&self.connection,
Expand Down Expand Up @@ -171,7 +171,7 @@ impl FilesystemR8 {
}

#[zbus(property)]
async fn set_size_limit(&self, value: (bool, String)) -> Result<(), zbus::Error> {
async fn set_size_limit(&self, value: (bool, String)) -> Result<(), Error> {
set_filesystem_prop(
&self.engine,
&self.connection,
Expand Down
4 changes: 2 additions & 2 deletions src/dbus/filesystem/filesystem_3_9/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl FilesystemR9 {
}

#[zbus(property)]
async fn set_merge_scheduled(&self, value: bool) -> Result<(), zbus::Error> {
async fn set_merge_scheduled(&self, value: bool) -> Result<(), Error> {
set_filesystem_prop(
&self.engine,
&self.connection,
Expand Down Expand Up @@ -171,7 +171,7 @@ impl FilesystemR9 {
}

#[zbus(property)]
async fn set_size_limit(&self, value: (bool, String)) -> Result<(), zbus::Error> {
async fn set_size_limit(&self, value: (bool, String)) -> Result<(), Error> {
set_filesystem_prop(
&self.engine,
&self.connection,
Expand Down
6 changes: 3 additions & 3 deletions src/dbus/filesystem/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ pub async fn set_filesystem_prop<'a, 'b, V, F, Fut, S, SFut>(
value: V,
f: F,
send_signal: S,
) -> Result<(), zbus::Error>
) -> Result<(), Error>
where
F: FnOnce(SomeLockWriteGuard<PoolUuid, dyn Pool>, FilesystemUuid, V) -> Fut,
Fut: Future<Output = Result<bool, zbus::Error>>,
Fut: Future<Output = Result<bool, Error>>,
S: FnOnce(&'a Arc<Connection>, &'b Lockable<Arc<RwLock<Manager>>>, FilesystemUuid) -> SFut,
SFut: Future<Output = ()>,
{
let guard = engine
.get_mut_pool(PoolIdentifier::Uuid(uuid))
.await
.ok_or_else(|| zbus::Error::Failure(format!("No pool associated with UUID {uuid}")))?;
.ok_or_else(|| Error::Failed(format!("No pool associated with UUID {uuid}")))?;

let changed = f(guard, fs_uuid, value).await?;
// Guard is dropped here, lock is released
Expand Down
4 changes: 2 additions & 2 deletions src/dbus/pool/pool_3_1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ impl PoolR1 {
}

#[zbus(property)]
async fn set_fs_limit(&self, fs_limit: u64) -> Result<(), zbus::Error> {
async fn set_fs_limit(&self, fs_limit: u64) -> Result<(), Error> {
set_pool_prop(
&self.engine,
&self.connection,
Expand All @@ -334,7 +334,7 @@ impl PoolR1 {
}

#[zbus(property)]
async fn set_overprovisioning(&self, overprov: bool) -> Result<(), zbus::Error> {
async fn set_overprovisioning(&self, overprov: bool) -> Result<(), Error> {
set_pool_prop(
&self.engine,
&self.connection,
Expand Down
6 changes: 3 additions & 3 deletions src/dbus/pool/pool_3_1/props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use std::sync::Arc;

use tokio::sync::RwLock;
use zbus::{Connection, Error};
use zbus::{fdo::Error, Connection};

use crate::{
dbus::{
Expand All @@ -27,7 +27,7 @@ pub async fn set_fs_limit_prop(
let (name, _, p) = guard.as_mut_tuple();
p.set_fs_limit(&name, uuid, fs_limit)
.map(|_| true)
.map_err(|e| Error::Failure(e.to_string()))
.map_err(|e| Error::Failed(e.to_string()))
}

pub async fn send_fs_limit_signal_on_change(
Expand Down Expand Up @@ -55,7 +55,7 @@ pub async fn set_enable_overprovisioning_prop(
let (name, _, p) = guard.as_mut_tuple();
p.set_overprov_mode(&name, enable_overprov)
.map(|_| true)
.map_err(|e| Error::Failure(e.to_string()))
.map_err(|e| Error::Failed(e.to_string()))
}

pub async fn send_enable_overprovisioning_signal_on_change(
Expand Down
4 changes: 2 additions & 2 deletions src/dbus/pool/pool_3_2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ impl PoolR2 {
}

#[zbus(property)]
async fn set_fs_limit(&self, fs_limit: u64) -> Result<(), zbus::Error> {
async fn set_fs_limit(&self, fs_limit: u64) -> Result<(), Error> {
set_pool_prop(
&self.engine,
&self.connection,
Expand All @@ -331,7 +331,7 @@ impl PoolR2 {
}

#[zbus(property)]
async fn set_overprovisioning(&self, overprov: bool) -> Result<(), zbus::Error> {
async fn set_overprovisioning(&self, overprov: bool) -> Result<(), Error> {
set_pool_prop(
&self.engine,
&self.connection,
Expand Down
4 changes: 2 additions & 2 deletions src/dbus/pool/pool_3_3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ impl PoolR3 {
}

#[zbus(property)]
async fn set_fs_limit(&self, fs_limit: u64) -> Result<(), zbus::Error> {
async fn set_fs_limit(&self, fs_limit: u64) -> Result<(), Error> {
set_pool_prop(
&self.engine,
&self.connection,
Expand All @@ -347,7 +347,7 @@ impl PoolR3 {
}

#[zbus(property)]
async fn set_overprovisioning(&self, overprov: bool) -> Result<(), zbus::Error> {
async fn set_overprovisioning(&self, overprov: bool) -> Result<(), Error> {
set_pool_prop(
&self.engine,
&self.connection,
Expand Down
Loading
Loading