Crates.io | libstoragemgmt-rust |
lib.rs | libstoragemgmt-rust |
version | 0.0.1 |
source | src |
created_at | 2018-01-12 12:53:54.480568 |
updated_at | 2018-01-12 12:53:54.480568 |
description | Rust binding of LibStorageMgmt |
homepage | |
repository | https://github.com/libstorage/libstoragemgmt-rust |
max_upload_size | |
id | 46520 |
size | 147,579 |
LibStorageMgmt
provides a set of API for programmatically manage their
storage hardware in a vendor neutral way supporting these actions:
List storage pools, volumes, access groups, or file systems.
Create and delete volumes, access groups, file systems, or NFS exports.
Grant and remove access to volumes, access groups, or initiators.
Replicate volumes with snapshots, clones, and copies.
Create and delete access groups and edit members of a group.
List Linux local SCSI/ATA/NVMe disks.
Control IDENT/FAULT LED of local disk via SES(SCSI Enclosure Service).
To use LibStorageMgmt
rust binding, you need:
Start the libstoragemgmt daemon(lsmd
)
Choose a URI after reading LibStorageMgmt
user guide
Make a connection to plugin via lsm::Client
.
Check required capacity
is supported.
Invoke required method of lsm::Client
.
Follow the crate document
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);
}
}
}
}