tape inventory: code cleanup media pool look-up

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2023-01-16 11:04:07 +01:00
parent 6905bd3735
commit 7792507a12

View File

@ -249,14 +249,11 @@ impl Inventory {
/// ///
/// Returns (pool, is_empty) /// Returns (pool, is_empty)
pub fn lookup_media_pool(&self, uuid: &Uuid) -> Option<(&str, bool)> { pub fn lookup_media_pool(&self, uuid: &Uuid) -> Option<(&str, bool)> {
match self.map.get(uuid) { let pool = self.map.get(uuid)?;
None => None, pool.id
Some(entry) => entry .media_set_label
.id .as_ref()
.media_set_label .map(|media_set| (media_set.pool.as_str(), media_set.unassigned()))
.as_ref()
.map(|set| (set.pool.as_str(), set.unassigned())),
}
} }
/// List all media assigned to the pool /// List all media assigned to the pool