Expand description
§LibStorageMgmt
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 disks via SES(SCSI Enclosure Service), NPEM, VMD (utilizes ledmon library)
To use LibStorageMgmt rust binding, you need:
-
Start the libstoragemgmt daemon(
lsmd) -
Choose a URI after reading
LibStorageMgmtuser guide -
Make a connection to plugin via
lsm::Client. -
Check required
lsm::Capabilitiesfor supported functionality. -
Invoke required method of
lsm::Client.
§Example code using simulator plugin
extern crate lsm;
use lsm::{Client, LsmError};
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);
}
}
}
Modules§
Structs§
- Access
Group - Access group is also known as host group on some storage system, it defines a group of initiators sharing the same access to the volume.
- Battery
- Represent a battery.
- Block
Range - Represent a block range used
Client::volume_replicate_range(). - Capabilities
- Represent capabilities supported by specific system.
- Client
- Represent the connection to plugin.
- Disk
- File
System - File
System Snap Shot - NfsAccess
- Represent NFS access control information.
- NfsExport
- Plugin
Info - Represent a plugin information
- Pool
- Pool
Member Info - Represent pool membership information.
- System
- Represent a storage system. Examples:
- Target
Port - Represent a target port which is the front-end port of storage system which storage user/client connect to and get storage service from.
- Volume
- Represent a storage volume. Also known as LUN(Logical Unit Number) or Storage Volume or Virtual Disk. The host OS treats it as block devices (one volume can be exposed as many disks when multipath I/O is enabled).
- Volume
Cache Info - Represent volume cache information.
- Volume
Raid Info - Represent volume RAID information.
Enums§
- Battery
Type - Cache
Policy - Represent a volume cache policy.
- Capability
- Represent a capability supported by specific system.
- Disk
Link Type - Represent disk data link type.
- Disk
Type - Represent disk type.
- Initiator
Type - LsmError
- Pool
Member - Represent a Pool member.
- Port
Type - Raid
Type - Represent a RAID type.
- System
Mode - Volume
Create ArgThinP - For argument
thinpofClient::volume_create() - Volume
Replicate Type - Represent a volume replication type.
Functions§
- available_
plugins - Query all available plugins from libStorageMgmt daemon (lsmd).
- size_
bytes_ 2_ size_ human - size_
human_ 2_ size_ bytes - Convert human readable size string into integer size in bytes.