lsm

Struct Client

source
pub struct Client { /* private fields */ }
Expand description

Represent the connection to plugin.

Implementations§

source§

impl Client

source

pub fn new( uri: &str, password: Option<&str>, timeout: Option<u32>, ) -> Result<Client, LsmError>

Create a connection to plugin. Please refer to libstoragemgmt user guide for how to choose the URI and password.

The timeout argument is in milliseconds.

source

pub fn systems(&mut self) -> Result<Vec<System>, LsmError>

Gets a list of systems on this connection.

source

pub fn volumes(&mut self) -> Result<Vec<Volume>, LsmError>

Gets a list of volumes on this connection.

source

pub fn pools(&mut self) -> Result<Vec<Pool>, LsmError>

Gets a list of pools on this connection.

source

pub fn disks(&mut self) -> Result<Vec<Disk>, LsmError>

Gets a list of disks on this connection.

source

pub fn fs(&mut self) -> Result<Vec<FileSystem>, LsmError>

Gets a list of file systems on this connection.

source

pub fn nfs_exports(&mut self) -> Result<Vec<NfsExport>, LsmError>

Gets a list of NFS exports on this connection.

source

pub fn access_groups(&mut self) -> Result<Vec<AccessGroup>, LsmError>

Gets a list of access group on this connection.

source

pub fn target_ports(&mut self) -> Result<Vec<TargetPort>, LsmError>

Gets a list of target ports on this connection.

source

pub fn batteries(&mut self) -> Result<Vec<Battery>, LsmError>

Gets a list of batteries on this connection.

source

pub fn volume_create( &mut self, pool: &Pool, name: &str, size_bytes: u64, thinp: &VolumeCreateArgThinP, ) -> Result<Volume, LsmError>

Create new volume.

  • pool – The pool where new volume should allocated from.
  • name – The name of new volume. It might be altered or ignored.
  • size_bytes – Size in bytes of new volume. You may use function size_human_2_size_bytes() to convert string like ‘1.1 GiB’ to integer size bytes.
  • thinp – Whether to create thin provisioning volume. Check VolumeCreateArgThinP
source

pub fn volume_delete(&mut self, vol: &Volume) -> Result<(), LsmError>

Delete a volume

§Errors
source

pub fn time_out_set(&mut self, ms: u32) -> Result<(), LsmError>

Set connection timeout value in milliseconds.

source

pub fn time_out_get(&mut self) -> Result<u32, LsmError>

Get connection timeout value.

source

pub fn capabilities(&mut self, sys: &System) -> Result<Capabilities, LsmError>

Get system’s capabilities.

Capability is used to indicate whether certain functionality is supported by specified storage system. Please check desired function for required capability. To verify capability is supported, use Capabilities::is_supported(). If the functionality is not listed in the enumerated Capability type then that functionality is mandatory and required to exist.

source

pub fn plugin_info(&mut self) -> Result<PluginInfo, LsmError>

Get plugin information.

source

pub fn sys_read_cache_pct_set( &mut self, sys: &System, read_pct: u32, ) -> Result<(), LsmError>

Changes the read cache percentage for the specified system.

§Errors
source

pub fn iscsi_chap_auth_set( &mut self, init_id: &str, in_user: Option<&str>, in_pass: Option<&str>, out_user: Option<&str>, out_pass: Option<&str>, ) -> Result<(), LsmError>

Set(override) iSCSI CHAP authentication.

  • init_id – Initiator ID.
  • in_user – The inbound authentication username. The inbound authentication means the iSCSI initiator authenticates the iSCSI target using CHAP.
  • in_pass – The inbound authentication password.
  • out_user – The outbound authentication username. The outbound authentication means the iSCSI target authenticates the iSCSI initiator using CHAP.
  • out_pass – The outbound authentication password.
source

pub fn volume_resize( &mut self, vol: &Volume, new_size_bytes: u64, ) -> Result<Volume, LsmError>

Resize a volume.

Please check whether pool allows volume resize via Pool.unsupported_actions.

source

pub fn volume_replicate( &mut self, pool: Option<Pool>, rep_type: VolumeReplicateType, src_vol: &Volume, name: &str, ) -> Result<Volume, LsmError>

Replicate a volume.

  • pool – The pool where new replication target volume should be allocated from. For None, will use the same pool of source volume.
  • rep_type – Replication type.
  • src_vol – Replication source volume.
  • name – Name for replication target volume. Might be altered or ignored.
source

pub fn volume_rep_range_blk_size( &mut self, sys: &System, ) -> Result<u32, LsmError>

source

pub fn volume_replicate_range( &mut self, rep_type: VolumeReplicateType, src_vol: &Volume, dst_vol: &Volume, ranges: &[BlockRange], ) -> Result<(), LsmError>

Replicates a portion of a volume to a volume.

  • rep_type – Replication type.
  • src_vol – Replication source volume.
  • dst_vol – Replication target volume.
  • ranges – Replication block ranges.
source

pub fn volume_enable(&mut self, vol: &Volume) -> Result<(), LsmError>

Set a Volume to online.

Enable the specified volume when that volume is disabled by administrator or via Client::volume_disable()

source

pub fn volume_disable(&mut self, vol: &Volume) -> Result<(), LsmError>

Disable the read and write access to the specified volume.

source

pub fn volume_mask( &mut self, vol: &Volume, ag: &AccessGroup, ) -> Result<(), LsmError>

Grant access to a volume for the specified group, also known as LUN masking or mapping.

§Errors
source

pub fn volume_unmask( &mut self, vol: &Volume, ag: &AccessGroup, ) -> Result<(), LsmError>

Revokes access to a volume for the specified group

source

pub fn access_group_create( &mut self, name: &str, init_id: &str, init_type: InitiatorType, sys: &System, ) -> Result<AccessGroup, LsmError>

Create a access group.

Creates a new access group with one initiator in it. You may expand the access group by adding more initiators via Client::access_group_init_add()

§Errors
source

pub fn access_group_delete(&mut self, ag: &AccessGroup) -> Result<(), LsmError>

Delete an access group. Only access group with no volume masked can be deleted.

§Errors
source

pub fn access_group_init_add( &mut self, ag: &AccessGroup, init_id: &str, init_type: InitiatorType, ) -> Result<AccessGroup, LsmError>

Add an initiator to the access group.

§Errors
source

pub fn access_group_init_del( &mut self, ag: &AccessGroup, init_id: &str, init_type: InitiatorType, ) -> Result<AccessGroup, LsmError>

Delete an initiator from an access group.

§Errors
source

pub fn vols_masked_to_ag( &mut self, ag: &AccessGroup, ) -> Result<Vec<Volume>, LsmError>

Query volumes that the specified access group has access to.

source

pub fn ags_granted_to_vol( &mut self, vol: &Volume, ) -> Result<Vec<AccessGroup>, LsmError>

Retrieves the access groups that have access to the specified volume.

source

pub fn vol_has_child_dep(&mut self, vol: &Volume) -> Result<bool, LsmError>

Check whether volume has child dependencies.

source

pub fn vol_child_dep_rm(&mut self, vol: &Volume) -> Result<(), LsmError>

Delete all child dependencies of the specified volume.

Instruct storage system to remove all child dependencies of the specified volume by duplicating the required storage before breaking replication relationship. This function might take a long time(days or even weeks), you might want to invoke it in a thread.

source

pub fn fs_create( &mut self, pool: &Pool, name: &str, size_bytes: u64, ) -> Result<FileSystem, LsmError>

Create a new file system.

  • pool – The pool where new file system should allocated from.
  • name – The name of new file system. It might be altered or ignored.
  • size_bytes – Size in bytes of new file system. You may use function size_human_2_size_bytes() to convert string like ‘1.1 GiB’ to integer size bytes.
source

pub fn fs_resize( &mut self, fs: &FileSystem, new_size_bytes: u64, ) -> Result<FileSystem, LsmError>

Resize of file system.

source

pub fn fs_delete(&mut self, fs: &FileSystem) -> Result<(), LsmError>

Delete a file system.

When file system has snapshot attached, all its snapshot will be deleted also. When file system is exported, all its exports will be deleted also. If specified file system is has child dependency, it cannot be deleted, please use Client::fs_has_child_dep() and Client::fs_child_dep_rm().

source

pub fn fs_clone( &mut self, src_fs: &FileSystem, dst_fs_name: &str, snapshot: Option<&FileSystemSnapShot>, ) -> Result<FileSystem, LsmError>

Clones an existing file system

Create a point in time read writeable space efficient copy of specified file system, also know as read writeable snapshot. The new file system will reside in the same pool of specified file system.

Optionally, new file system could be based on a snapshot specified by snapshot argument.

source

pub fn fs_file_clone( &mut self, fs: &FileSystem, src_file_name: &str, dst_file_name: &str, snapshot: Option<&FileSystemSnapShot>, ) -> Result<(), LsmError>

Clones a file on a file system.

Optionally, file contents could be based on a snapshot specified by snapshot argument.

source

pub fn fs_snapshots( &mut self, fs: &FileSystem, ) -> Result<Vec<FileSystemSnapShot>, LsmError>

Get a list of snapshots of specified file system.

source

pub fn fs_snapshot_create( &mut self, fs: &FileSystem, name: &str, ) -> Result<FileSystemSnapShot, LsmError>

Create a file system snapshot.

source

pub fn fs_snapshot_delete( &mut self, fs: &FileSystem, snapshot: &FileSystemSnapShot, ) -> Result<(), LsmError>

Delete a file system snapshot.

source

pub fn fs_snapshot_restore( &mut self, fs: &FileSystem, snapshot: &FileSystemSnapShot, all_file: bool, files: Option<&[&str]>, restore_files: Option<&[&str]>, ) -> Result<(), LsmError>

Restore a file system based on specified snapshot.

  • fs – File system to restore.
  • snapshot – Snapshot to use.
  • all_filetrue for restore all files. false for restore specified files only.
  • files – Only restored specified files. Ignored if all_file is true.
  • restore_files – If not None, rename restored files to defined file paths and names
source

pub fn fs_has_child_dep( &mut self, fs: &FileSystem, files: Option<Vec<&str>>, ) -> Result<bool, LsmError>

Checks whether file system has a child dependency.

source

pub fn fs_child_dep_rm( &mut self, fs: &FileSystem, files: Option<Vec<&str>>, ) -> Result<(), LsmError>

Delete all child dependencies of the specified file system.

Instruct storage system to remove all child dependencies of the specified file system by duplicating the required storage before breaking replication relationship. This function might take a long time(days or even weeks), you might want to invoke it in a thread.

source

pub fn nfs_exp_auth_type_list(&mut self) -> Result<Vec<String>, LsmError>

Get supported NFS client authentication types.

source

pub fn fs_export( &mut self, fs: &FileSystem, export_path: Option<&str>, access: &NfsAccess<'_>, auth_type: Option<&str>, options: Option<&str>, ) -> Result<NfsExport, LsmError>

Create or modify an NFS export.

  • fs – File system to export.
  • export_path – Export path. If already exists, will modify exist NFS export. If None, will let storage system to generate one.
  • access – NFS access details.
  • auth_type – NFS client authentication type. Get from Client::nfs_exp_auth_type_list().
  • options – Extra NFS options.
source

pub fn fs_unexport(&mut self, exp: &NfsExport) -> Result<(), LsmError>

Unexport specified NFS exports.

source

pub fn vol_raid_info( &mut self, vol: &Volume, ) -> Result<VolumeRaidInfo, LsmError>

Get volume RAID information.

source

pub fn pool_member_info( &mut self, pool: &Pool, ) -> Result<PoolMemberInfo, LsmError>

Get pool member information.

source

pub fn vol_raid_create_cap_get( &mut self, sys: &System, ) -> Result<(Vec<RaidType>, Vec<u32>), LsmError>

Get system capability on creating RAIDed volume. For hardware RAID only.

Returns supported RAID types and strip sizes.

source

pub fn vol_raid_create( &mut self, name: &str, raid_type: RaidType, disks: &[Disk], strip_size: Option<u32>, ) -> Result<Volume, LsmError>

Create RAIDed volume directly from disks. Only for hardware RAID.

source

pub fn vol_ident_led_on(&mut self, vol: &Volume) -> Result<(), LsmError>

Turn on the identification LED for the specified volume.

All its member disks’ identification LED will be turned on.

source

pub fn vol_ident_led_off(&mut self, vol: &Volume) -> Result<(), LsmError>

Turn off the identification LED for the specified volume.

All its member disks’ identification LED will be turned off.

source

pub fn vol_cache_info( &mut self, vol: &Volume, ) -> Result<VolumeCacheInfo, LsmError>

Get cache information on specified volume.

source

pub fn vol_phy_disk_cache_set( &mut self, vol: &Volume, pdc: CachePolicy, ) -> Result<(), LsmError>

Set volume physical disk cache policy.

source

pub fn vol_write_cache_set( &mut self, vol: &Volume, wcp: CachePolicy, ) -> Result<(), LsmError>

Set volume write cache policy.

source

pub fn vol_read_cache_set( &mut self, vol: &Volume, rcp: CachePolicy, ) -> Result<(), LsmError>

Set volume read cache policy.

Auto Trait Implementations§

§

impl Freeze for Client

§

impl RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl UnwindSafe for Client

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.