-
-
Save cholcombe973/8ea370c8ca37a50be17e8a900057cf0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate ceph; | |
extern crate ceph_rbd; | |
extern crate rayon; | |
use rayon::prelude::*; | |
fn main() { | |
let conn = ceph::ceph::connect_to_ceph("admin", "/etc/ceph/ceph.conf").unwrap(); | |
let ioctx = conn.get_rados_ioctx("glance").unwrap(); | |
// Tell rayon how many threads to use | |
rayon::ThreadPoolBuilder::new() | |
.num_threads(10) | |
.build_global() | |
.unwrap(); | |
let r = ceph_rbd::rbd::Rbd; | |
let res = r.list(&ioctx).unwrap(); | |
res.into_par_iter().for_each(|device| { | |
let conn = ceph::ceph::connect_to_ceph("admin", "/etc/ceph/ceph.conf").unwrap(); | |
let ioctx = conn.get_rados_ioctx("glance").unwrap(); | |
let img = ceph_rbd::rbd::RbdImage::open(&ioctx, &device, "").unwrap(); | |
let s = img.stat().unwrap(); | |
println!("s: {:?}", s); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment