diff options
author | Toby Vincent <tobyv13@gmail.com> | 2022-05-11 20:39:27 -0500 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2022-05-11 20:39:27 -0500 |
commit | bd0793b71f557049f252e0256297e0407c065bad (patch) | |
tree | 1b2439ac32935950aff6415a65bf2a42fa04fe2f /zone_zfs/src | |
parent | 5a76a67cb28f7e6026bfacfd2d62269dc6fe1890 (diff) |
feat: create default get_last_id impl in Volumes trait
Diffstat (limited to 'zone_zfs/src')
-rw-r--r-- | zone_zfs/src/zfs.rs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/zone_zfs/src/zfs.rs b/zone_zfs/src/zfs.rs index 98258a1..eabc2f8 100644 --- a/zone_zfs/src/zfs.rs +++ b/zone_zfs/src/zfs.rs @@ -25,16 +25,6 @@ impl ZFS { .map_err(Error::from) .map(|config| Self { config }) } - - fn get_last_id(&self, template: &str, owner: &str) -> Result<u32> { - self.list_volumes()? - .into_iter() - .filter(|c| c.template == *template && c.owner == *owner) - .max_by_key(|c| c.id) - .map(|c| c.id) - .ok_or(FileSystemError::NotFound) - .map_err(Error::from) - } } impl Volumes for ZFS { @@ -69,7 +59,10 @@ impl Volumes for ZFS { } fn get_volume(&self, container: &Container) -> Result<PathBuf> { - let fs = self.config.pool_name.join(PathBuf::from(container.to_owned())); + let fs = self + .config + .pool_name + .join(PathBuf::from(container.to_owned())); let output = Command::new("zfs") .arg("get") |