Skip to content

Commit

Permalink
Reinstate change for filtering out invalid object paths instead of fa…
Browse files Browse the repository at this point in the history
…iling per discussion in #1634
  • Loading branch information
jbaublitz committed Sep 30, 2019
1 parent 440ac97 commit 9d3fb00
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/dbus_api/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,15 @@ fn destroy_filesystems(m: &MethodInfo<MTFn<TData>, TData>) -> MethodResult {
let mut engine = dbus_context.engine.borrow_mut();
let (pool_name, pool) = get_mut_pool!(engine; pool_uuid; default_return; return_message);

let mut filesystem_map: HashMap<FilesystemUuid, dbus::Path<'static>> = HashMap::new();
for op in filesystems {
if let Some(filesystem_path) = m.tree.get(&op) {
let filesystem_uuid = get_data!(filesystem_path; default_return; return_message).uuid;
filesystem_map.insert(filesystem_uuid, op);
}
}
let filesystem_map: HashMap<FilesystemUuid, dbus::Path<'static>> = filesystems
.filter_map(|path| {
m.tree.get(&path).and_then(|op| {
op.get_data()
.as_ref()
.map(|d| (d.uuid, op.get_name().clone()))
})
})
.collect();

let result = pool.destroy_filesystems(
&pool_name,
Expand Down

0 comments on commit 9d3fb00

Please sign in to comment.