[][src]Trait libzetta::zpool::ZpoolEngine

pub trait ZpoolEngine {
    fn exists<N: AsRef<str>>(&self, name: N) -> ZpoolResult<bool>;
fn create(&self, request: CreateZpoolRequest) -> ZpoolResult<()>;
fn destroy<N: AsRef<str>>(
        &self,
        name: N,
        mode: DestroyMode
    ) -> ZpoolResult<()>;
fn read_properties<N: AsRef<str>>(
        &self,
        name: N
    ) -> ZpoolResult<ZpoolProperties>;
fn set_property<N: AsRef<str>, P: PropPair>(
        &self,
        name: N,
        key: &str,
        value: &P
    ) -> ZpoolResult<()>;
fn export<N: AsRef<str>>(
        &self,
        name: N,
        mode: ExportMode
    ) -> ZpoolResult<()>;
fn available(&self) -> ZpoolResult<Vec<Zpool>>;
fn available_in_dir(&self, dir: PathBuf) -> ZpoolResult<Vec<Zpool>>;
fn import<N: AsRef<str>>(&self, name: N) -> ZpoolResult<()>;
fn import_from_dir<N: AsRef<str>>(
        &self,
        name: N,
        dir: PathBuf
    ) -> ZpoolResult<()>;
fn status<N: AsRef<str>>(&self, name: N) -> ZpoolResult<Zpool>;
fn all(&self) -> ZpoolResult<Vec<Zpool>>;
fn scrub<N: AsRef<str>>(&self, name: N) -> ZpoolResult<()>;
fn pause_scrub<N: AsRef<str>>(&self, name: N) -> ZpoolResult<()>;
fn stop_scrub<N: AsRef<str>>(&self, name: N) -> ZpoolResult<()>;
fn take_offline<N: AsRef<str>, D: AsRef<OsStr>>(
        &self,
        name: N,
        device: D,
        mode: OfflineMode
    ) -> ZpoolResult<()>;
fn bring_online<N: AsRef<str>, D: AsRef<OsStr>>(
        &self,
        name: N,
        device: D,
        mode: OnlineMode
    ) -> ZpoolResult<()>;
fn attach<N: AsRef<str>, D: AsRef<OsStr>>(
        &self,
        name: N,
        device: D,
        new_device: D
    ) -> ZpoolResult<()>;
fn detach<N: AsRef<str>, D: AsRef<OsStr>>(
        &self,
        name: N,
        device: D
    ) -> ZpoolResult<()>;
fn add_vdev<N: AsRef<str>>(
        &self,
        name: N,
        new_vdev: CreateVdevRequest,
        add_mode: CreateMode
    ) -> ZpoolResult<()>;
fn add_zil<N: AsRef<str>>(
        &self,
        name: N,
        new_zil: CreateVdevRequest,
        add_mode: CreateMode
    ) -> ZpoolResult<()>;
fn add_cache<N: AsRef<str>, D: AsRef<OsStr>>(
        &self,
        name: N,
        new_cache: D,
        add_mode: CreateMode
    ) -> ZpoolResult<()>;
fn add_spare<N: AsRef<str>, D: AsRef<OsStr>>(
        &self,
        name: N,
        new_spare: D,
        add_mode: CreateMode
    ) -> ZpoolResult<()>;
fn replace_disk<N: AsRef<str>, D: AsRef<OsStr>, O: AsRef<OsStr>>(
        &self,
        name: N,
        old_disk: D,
        new_disk: O
    ) -> ZpoolResult<()>;
fn remove<N: AsRef<str>, D: AsRef<OsStr>>(
        &self,
        name: N,
        device: D
    ) -> ZpoolResult<()>; fn update_properties<N: AsRef<str>>(
        &self,
        name: N,
        props: ZpoolPropertiesWrite
    ) -> ZpoolResult<ZpoolProperties> { ... } }

Interface to manage zpools. This documentation implies that you know how to use zpool(8).

Required methods

fn exists<N: AsRef<str>>(&self, name: N) -> ZpoolResult<bool>

Check if pool with given name exists. NOTE: this won't return ZpoolError::PoolNotFound, instead it will return Ok(false).

  • name - Name of the zpool.

fn create(&self, request: CreateZpoolRequest) -> ZpoolResult<()>

Create new zpool.

  • request - A request to create a zpool. Consult documentation for CreateZpoolRequest for more information.

fn destroy<N: AsRef<str>>(&self, name: N, mode: DestroyMode) -> ZpoolResult<()>

Destroy zpool. NOTE: returns Ok(()) if pool doesn't exist.

  • name - Name of the zpool.
  • mode - Strategy to use when destroying the pool.

fn read_properties<N: AsRef<str>>(
    &self,
    name: N
) -> ZpoolResult<ZpoolProperties>

Read properties of the pool. NOTE: doesn't support custom properties.

  • name - Name of the zpool.

fn set_property<N: AsRef<str>, P: PropPair>(
    &self,
    name: N,
    key: &str,
    value: &P
) -> ZpoolResult<()>

Internal function used to set values. Prefer update_properties when possible.

  • name - Name of the zpool.
  • key - Key for the property.
  • value - Any supported value.

fn export<N: AsRef<str>>(&self, name: N, mode: ExportMode) -> ZpoolResult<()>

Exports the given pools from the system.

  • name - Name of the zpool.
  • mode - Strategy to use when destroying the pool.

fn available(&self) -> ZpoolResult<Vec<Zpool>>

List of pools available for import in /dev/ directory.

fn available_in_dir(&self, dir: PathBuf) -> ZpoolResult<Vec<Zpool>>

List of pools available in dir.

  • dir - Directory to look for pools. Useful when you are looking for pool that created from files.

fn import<N: AsRef<str>>(&self, name: N) -> ZpoolResult<()>

Import pool from /dev/.

fn import_from_dir<N: AsRef<str>>(
    &self,
    name: N,
    dir: PathBuf
) -> ZpoolResult<()>

Import pool from dir.

  • dir - Directory to look for pools. Useful when you are looking for pool that created from files.

fn status<N: AsRef<str>>(&self, name: N) -> ZpoolResult<Zpool>

Get the detailed status of the given pools.

fn all(&self) -> ZpoolResult<Vec<Zpool>>

Get a status of each active (imported) pool in the system

fn scrub<N: AsRef<str>>(&self, name: N) -> ZpoolResult<()>

Begins a scrub or resumes a paused scrub. The scrub examines all data in the specified pools to verify that it checksums correctly. For replicated (mirror or raidz) devices, ZFS automatically repairs any damage discovered during the scrub.

  • name - Name of the zpool.

fn pause_scrub<N: AsRef<str>>(&self, name: N) -> ZpoolResult<()>

Pause scrubbing. Scrub pause state and progress are periodically synced to disk. If the system is restarted or pool is exported during a paused scrub, even after import, scrub will remain paused until it is resumed. Once resumed the scrub will pick up from the place where it was last checkpointed to disk.

  • name - Name of the zpool.

fn stop_scrub<N: AsRef<str>>(&self, name: N) -> ZpoolResult<()>

Stop scrubbing.

  • name - Name of the zpool.

fn take_offline<N: AsRef<str>, D: AsRef<OsStr>>(
    &self,
    name: N,
    device: D,
    mode: OfflineMode
) -> ZpoolResult<()>

Takes the specified physical device offline. While the device is offline, no attempt is made to read or write to the device.

  • name - Name of the zpool.
  • device - Name of the device or path to sparse file.
  • mode - Strategy to use when taking device offline

fn bring_online<N: AsRef<str>, D: AsRef<OsStr>>(
    &self,
    name: N,
    device: D,
    mode: OnlineMode
) -> ZpoolResult<()>

Brings the specified physical device online.

  • name - Name of the zpool.
  • device - Name of the device or path to sparse file.
  • mode - Strategy to use when taking device online

fn attach<N: AsRef<str>, D: AsRef<OsStr>>(
    &self,
    name: N,
    device: D,
    new_device: D
) -> ZpoolResult<()>

Attaches new_device (disk) to an existing zpool device (VDEV). The existing device cannot be part of a raidz configuration. If device is not currently part of a mirrored configuration, device automatically transforms into a two-way mirror of device and new_device.

  • name - Name of the zpool.
  • device - Name of the device that you want to replace.
  • new_device - Name of the device that you want to use in place of old device.

fn detach<N: AsRef<str>, D: AsRef<OsStr>>(
    &self,
    name: N,
    device: D
) -> ZpoolResult<()>

Detaches device from a mirror. The operation is refused if there are no other valid replicas of the data.

  • name - Name of the zpool
  • device - Name of the device or path to sparse file.

fn add_vdev<N: AsRef<str>>(
    &self,
    name: N,
    new_vdev: CreateVdevRequest,
    add_mode: CreateMode
) -> ZpoolResult<()>

Add a VDEV to existing Zpool.

  • name - Name of the zpool
  • new_vdev - New VDEV
  • add_mode - Disable some safety checks

fn add_zil<N: AsRef<str>>(
    &self,
    name: N,
    new_zil: CreateVdevRequest,
    add_mode: CreateMode
) -> ZpoolResult<()>

Add a ZIL to existing Zpool.

  • name - Name of the zpool
  • new_zil - A VDEV to use as ZIL
  • add_mode - Disable some safety checks

fn add_cache<N: AsRef<str>, D: AsRef<OsStr>>(
    &self,
    name: N,
    new_cache: D,
    add_mode: CreateMode
) -> ZpoolResult<()>

Add a cache to existing Zpool.

  • name - Name of the zpool
  • new_cache - A disk to use as cache
  • add_mode - Disable some safety checks

fn add_spare<N: AsRef<str>, D: AsRef<OsStr>>(
    &self,
    name: N,
    new_spare: D,
    add_mode: CreateMode
) -> ZpoolResult<()>

Add a spare to existing Zpool.

  • name - Name of the zpool
  • new_spare - A disk to use as spare
  • add_mode - Disable some safety checks

fn replace_disk<N: AsRef<str>, D: AsRef<OsStr>, O: AsRef<OsStr>>(
    &self,
    name: N,
    old_disk: D,
    new_disk: O
) -> ZpoolResult<()>

Replace a device with another.

  • old_disk - A disk to be replaced.
  • new_disk - A new disk.

fn remove<N: AsRef<str>, D: AsRef<OsStr>>(
    &self,
    name: N,
    device: D
) -> ZpoolResult<()>

Remove Spare, Cache or log device

  • name - Name of the zpool
  • device - Name of the device or path to sparse file.
Loading content...

Provided methods

fn update_properties<N: AsRef<str>>(
    &self,
    name: N,
    props: ZpoolPropertiesWrite
) -> ZpoolResult<ZpoolProperties>

Update zpool properties.

  • name - Name of the zpool.
  • props - Set of new properties for the pool.
Loading content...

Implementors

impl ZpoolEngine for ZpoolOpen3[src]

Loading content...