pub async fn import<'a>(name: &'a str, disk: &'a str) -> Result<Pool> {
        let base_bdev = match Bdev::lookup_by_name(disk) {
            Some(bdev) => bdev,
            None => {
                return Err(Error::UnknownBdev {
                    name: String::from(disk),
                })
            }
        };

        let (sender, receiver) = oneshot::channel::<i32>();

        debug!("Trying to import pool {}", name);

        unsafe {
            vbdev_lvs_examine(
                base_bdev.as_ptr(),
                Some(pool_done_cb),
                cb_arg(sender),
            );
        }
        let lvs_errno = receiver.await.expect("Cancellation is not supported");
        if lvs_errno == 0 {
            // could be that a pool with a different name was imported
            match Pool::lookup(&name) {
                Some(pool) => {
                    info!("The pool {} has been imported", name);
                    Ok(pool)
                }
                None => Err(Error::DeviceAlreadyUsed {
                    name: String::from(disk),
                }),
            }
        } else {
            Err(Error::FailedImport {
                name: String::from(name),
                errno: lvs_errno,
            })
        }
    }
/// Import the pool from a disk
Import the pool from a disk
Import the pool from a disk
pub async fn import<'a>(name: &'a str, disk: &'a str) -> Result<Pool> {
        let base_bdev = match Bdev::lookup_by_name(disk) {
            Some(bdev) => bdev,
            None => {
                return Err(Error::UnknownBdev {
                    name: String::from(disk),
                })
            }
        };
        let (sender, receiver) = oneshot::channel::<i32>();
        debug!("Trying to import pool {}", name);
        unsafe {
            vbdev_lvs_examine(
                base_bdev.as_ptr(),
                Some(pool_done_cb),
                cb_arg(sender),
            );
        }
        let lvs_errno = receiver.await.expect("Cancellation is not supported");
        if lvs_errno == 0 {
            // could be that a pool with a different name was imported
            match Pool::lookup(&name) {
                Some(pool) => {
                    info!("The pool {} has been imported", name);
                    Ok(pool)
                }
                None => Err(Error::DeviceAlreadyUsed {
                    name: String::from(disk),
                }),
            }
        } else {
            Err(Error::FailedImport {
                name: String::from(name),
                errno: lvs_errno,
            })
        }
    }
pub async fn import < ' a > ( name : & ' a str , disk : & ' a str ) -> Result < Pool > { let base_bdev = match Bdev :: lookup_by_name ( disk ) { Some ( bdev ) => bdev , None => { return Err ( Error :: UnknownBdev { name : String :: from ( disk ) , } ) } } ; let ( sender , receiver ) = oneshot :: channel :: < i32 > ( ) ; debug ! ( " " name ) ; unsafe { vbdev_lvs_examine ( base_bdev . as_ptr ( ) , Some ( pool_done_cb ) , cb_arg ( sender ) , ) ; } let lvs_errno = receiver . await . expect ( " " ) ; if lvs_errno == 0 { // could be that a pool with a different name was imported match Pool :: lookup ( & name ) { Some ( pool ) => { info ! ( " " name ) ; Ok ( pool ) } None => Err ( Error :: DeviceAlreadyUsed { name : String :: from ( disk ) , } ) , } } else { Err ( Error :: FailedImport { name : String :: from ( name ) , errno : lvs_errno , } ) } }
Import the pool from a disk
Import the pool from a disk
name
&'a str
disk
&'a str
name
&'a str
disk
&'a str