Skip to content

Commit

Permalink
feat: Inception of ZFS module (#83)
Browse files Browse the repository at this point in the history
* Tweak logging and change deps
  • Loading branch information
andoriyu authored Aug 18, 2019
1 parent 24cea30 commit ce626a0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
9 changes: 3 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,12 @@ quick-error = "1.2"
regex = "1.1"
slog = "2"
slog-stdlog = "4"
nvpair = "0.3.0"
zfs-core-sys= "0.1.0"
snafu = "0.4.4"

[dev-dependencies]
cavity = "1.1"
rand = "0.7"
slog-term = "2"
tempdir = "0.3"

[target]
[target."cfg(freebsd)"]
[target."cfg(freebsd)".dependencies]
libnv-sys = "0.1"
libzfs_core-sys = "0.1"
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- script: |
sudo add-apt-repository ppa:jonathonf/zfs-0.7
sudo apt-get update
sudo apt-get install zfs-dkms
sudo apt-get install zfs-dkms zfsutils-linux libnvpair1linux libzfslinux-dev
displayName: Install ZFS on Linux
- script: |
dd if=/dev/zero of=loop0 bs=1M count=96
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ use pest;
// library modules
pub mod parsers;
pub mod zpool;

const VERSION: &'static str = env!("CARGO_PKG_VERSION");
9 changes: 9 additions & 0 deletions src/zfs/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use snafu::{ResultExt, Snafu};

#[derive(Debug, Snafu)]
pub enum Error {
#[snafu(display("Failed to initialize libzfs_core. Error: {}", errno))]
ZFSInitializationFailed{ errno: std::os::raw::c_int },
}

type Result<T, E = Error> = std::result<T,E>;
2 changes: 1 addition & 1 deletion src/zpool/open3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ lazy_static! {
};
}
fn setup_logger<L: Into<Logger>>(logger: L) -> Logger {
logger.into().new(o!("module" => "zpool", "impl" => "open3", "version" => "0.1.0"))
logger.into().new(o!("zetta_module" => "zpool", "zetta_version" => crate::VERSION))
}

/// Open3 implementation of [`ZpoolEngine`](../trait.ZpoolEngine.html). You can use
Expand Down

0 comments on commit ce626a0

Please sign in to comment.