[][src]Crate lsm

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

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);
            }
        }
    }

Structs

AccessGroup

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.

BlockRange

Represent a block range used Client::volume_replicate_range().

Capabilities

Represent capabilities supported by specific system.

Client

Represent the connection to plugin.

Disk
FileSystem
FileSystemSnapShot
NfsAccess

Represent NFS access control information.

NfsExport
PluginInfo

Represent a plugin information

Pool
PoolMemberInfo

Represent pool membership information.

System

Represent a storage system. Examples:

TargetPort

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).

VolumeCacheInfo

Represent volume cache informtion.

VolumeRaidInfo

Represent volume RAID information.

Enums

BatteryType
CachePolicy

Represent a volume cache policy.

Capability

Represent a capability supported by specific system.

DiskLinkType

Represent disk data link type.

DiskType

Represent disk type.

InitiatorType
LsmError
PoolMember

Represent a Pool member.

PortType
RaidType

Represent a RAID type.

SystemMode
VolumeCreateArgThinP

For argument thinp of Client::volume_create()

VolumeReplicateType

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.