Skip to content

Commit

Permalink
Pass value to D-Bus methods for origin changes
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Sep 9, 2024
1 parent 5d945ed commit 50de40f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/dbus_api/pool/pool_3_7/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub fn destroy_filesystems(m: &MethodInfo<'_, MTSync<TData>, TData>) -> MethodRe
})
.unwrap_or(false)
}) {
dbus_context.push_filesystem_origin_change(sn_op.get_name());
dbus_context.push_filesystem_origin_change(sn_op.get_name(), None);
}

changed_uuids
Expand Down
9 changes: 4 additions & 5 deletions src/dbus_api/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,15 @@ impl DbusTreeHandler {
}
}

fn handle_fs_origin_change(&self, item: Path<'static>) {
let origin_prop = fs_origin_to_prop(None);
fn handle_fs_origin_change(&self, item: Path<'static>, new_origin: Option<FilesystemUuid>) {
if self
.property_changed_invalidated_signal(
&item,
prop_hashmap! {
consts::FILESYSTEM_INTERFACE_NAME_3_7 => {
vec![],
consts::FILESYSTEM_ORIGIN_PROP.to_string() =>
box_variant!(origin_prop.clone())
box_variant!(fs_origin_to_prop(new_origin))
}
},
)
Expand Down Expand Up @@ -1236,8 +1235,8 @@ impl DbusTreeHandler {
self.handle_fs_name_change(item, new_name);
Ok(true)
}
DbusAction::FsOriginChange(item) => {
self.handle_fs_origin_change(item);
DbusAction::FsOriginChange(item, new_origin) => {
self.handle_fs_origin_change(item, new_origin);
Ok(true)
}
DbusAction::PoolNameChange(item, new_name) => {
Expand Down
13 changes: 10 additions & 3 deletions src/dbus_api/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub enum DbusAction {
StoppedPoolsChange(StoppedPoolsInfo),
BlockdevUserInfoChange(Path<'static>, Option<String>),
BlockdevTotalPhysicalSizeChange(Path<'static>, Sectors),
FsOriginChange(Path<'static>),
FsOriginChange(Path<'static>, Option<FilesystemUuid>),
FsSizeLimitChange(Path<'static>, Option<Sectors>),
FsMergeScheduledChange(Path<'static>, bool),
FsBackgroundChange(
Expand Down Expand Up @@ -491,8 +491,15 @@ impl DbusContext {
}

/// Send changed signal for changed filesystem origin property.
pub fn push_filesystem_origin_change(&self, path: &Path<'static>) {
if let Err(e) = self.sender.send(DbusAction::FsOriginChange(path.clone())) {
pub fn push_filesystem_origin_change(
&self,
path: &Path<'static>,
origin: Option<FilesystemUuid>,
) {
if let Err(e) = self
.sender
.send(DbusAction::FsOriginChange(path.clone(), origin))
{
warn!(
"Filesystem origin change event could not be sent to the processing thread; no signal will be sent out for the filesystem origin state change: {}",
e,
Expand Down

0 comments on commit 50de40f

Please sign in to comment.