Rust binding of LibStorageMgmt

LibStorageMgmt provides a set of API for programmatically manage their storage hardware in a vendor neutral way supporting these actions:

To use LibStorageMgmt rust binding, you need:

Example code using simulator plugin

rust extern crate lsm; use lsm::{Client, LsmError}; fn main() { let mut c: Client = match Client::new("sim://", None, None) { Ok(i) => i, Err(e) => { match e { // Error handling goes here LsmError::DaemonNotRunning(_) => panic!("Please start the libstoragemgmt daemon"), _ => panic!(e) }; }, }; let syss = match c.systems() { Ok(i) => i, Err(e) => panic!(e) // Please use error handling as above. }; for s in syss { let cap = match c.capabilities(&s) { Ok(i) => i, Err(e) => panic!(e) // Please use error handling as above. }; if cap.is_supported(lsm::Capability::Volumes) { let vols = match c.volumes() { Ok(i) => i, Err(e) => panic!(e) // Please use error handling as above. }; for vol in vols { println!("Got volume: {} {}", vol.name, vol.id); } } } }