Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

ZPool.datasets() doesn't list all available datasets #79

Open
mskarbek opened this issue Nov 17, 2018 · 2 comments
Open

ZPool.datasets() doesn't list all available datasets #79

mskarbek opened this issue Nov 17, 2018 · 2 comments

Comments

@mskarbek
Copy link

mskarbek commented Nov 17, 2018

Quite possibly I don't understand something, I have just begun my Rust adventure ;) and right away started playing with libraries that are touching filesystems but this seems to be straightforward yet does not work as I imagine it should.

Simple code:

extern crate libzfs;

use libzfs::{Libzfs};

fn main() {
    let mut libzfs = Libzfs::new();
    let pools = libzfs.get_imported_pools().unwrap();
    for pool in pools {
        let datasets = pool.datasets().unwrap();
        for dataset in datasets {
            println!("{:?}", dataset.name());
        }
    }
}

Result:

"d1226526151549b6a14a18c6217f17bf/home"
"d1226526151549b6a14a18c6217f17bf/var"

Expected:

"d1226526151549b6a14a18c6217f17bf"
"d1226526151549b6a14a18c6217f17bf/home"
"d1226526151549b6a14a18c6217f17bf/home/core"
"d1226526151549b6a14a18c6217f17bf/var"
"d1226526151549b6a14a18c6217f17bf/var/lib"
"d1226526151549b6a14a18c6217f17bf/var/lib/containers"
"d1226526151549b6a14a18c6217f17bf/var/lib/containers/83abdad1a6e9eae57f0ce0eb803b21bc9f246196e52716f1ea96ec70a6fe7b9e"
"d1226526151549b6a14a18c6217f17bf/var/lib/docker"

Used:

  • zfs: zfs-0.7.11-1.fc28.x86_64
  • libzfs: 0.6.13

Interestingly I am able to access not listed datasets by calling dataset_by_name() for example libzfs.dataset_by_name("d1226526151549b6a14a18c6217f17bf/home/core").unwrap() works fine and returns correct data.

@jgrund jgrund added the bug label Nov 19, 2018
@jgrund
Copy link
Member

jgrund commented Nov 20, 2018

Hi @mskarbek,

This is a case we haven't needed yet (nested datasets) so we haven't implemented this.

We'd be happy to a take a PR that implements this functionality if you'd like to add it.

@mskarbek
Copy link
Author

OK, I'll try but as I said I just began playing with Rust. ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants