pub struct Client { /* private fields */ }
Expand description
Represent the connection to plugin.
Implementations§
source§impl Client
impl Client
sourcepub fn new(
uri: &str,
password: Option<&str>,
timeout: Option<u32>,
) -> Result<Client, LsmError>
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.
sourcepub fn systems(&mut self) -> Result<Vec<System>, LsmError>
pub fn systems(&mut self) -> Result<Vec<System>, LsmError>
Gets a list of systems on this connection.
sourcepub fn volumes(&mut self) -> Result<Vec<Volume>, LsmError>
pub fn volumes(&mut self) -> Result<Vec<Volume>, LsmError>
Gets a list of volumes on this connection.
sourcepub fn pools(&mut self) -> Result<Vec<Pool>, LsmError>
pub fn pools(&mut self) -> Result<Vec<Pool>, LsmError>
Gets a list of pools on this connection.
sourcepub fn disks(&mut self) -> Result<Vec<Disk>, LsmError>
pub fn disks(&mut self) -> Result<Vec<Disk>, LsmError>
Gets a list of disks on this connection.
sourcepub fn fs(&mut self) -> Result<Vec<FileSystem>, LsmError>
pub fn fs(&mut self) -> Result<Vec<FileSystem>, LsmError>
Gets a list of file systems on this connection.
sourcepub fn nfs_exports(&mut self) -> Result<Vec<NfsExport>, LsmError>
pub fn nfs_exports(&mut self) -> Result<Vec<NfsExport>, LsmError>
Gets a list of NFS exports on this connection.
sourcepub fn access_groups(&mut self) -> Result<Vec<AccessGroup>, LsmError>
pub fn access_groups(&mut self) -> Result<Vec<AccessGroup>, LsmError>
Gets a list of access group on this connection.
sourcepub fn target_ports(&mut self) -> Result<Vec<TargetPort>, LsmError>
pub fn target_ports(&mut self) -> Result<Vec<TargetPort>, LsmError>
Gets a list of target ports on this connection.
sourcepub fn batteries(&mut self) -> Result<Vec<Battery>, LsmError>
pub fn batteries(&mut self) -> Result<Vec<Battery>, LsmError>
Gets a list of batteries on this connection.
sourcepub fn volume_create(
&mut self,
pool: &Pool,
name: &str,
size_bytes: u64,
thinp: &VolumeCreateArgThinP,
) -> Result<Volume, LsmError>
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 functionsize_human_2_size_bytes()
to convert string like ‘1.1 GiB’ to integer size bytes.thinp
– Whether to create thin provisioning volume. Check VolumeCreateArgThinP
sourcepub fn volume_delete(&mut self, vol: &Volume) -> Result<(), LsmError>
pub fn volume_delete(&mut self, vol: &Volume) -> Result<(), LsmError>
Delete a volume
§Errors
LsmError::VolHasChildDep
volume has child dependency. e.g. specified volume is a replication source. Please useClient::vol_child_dep_rm()
to eliminate child dependency.
sourcepub fn time_out_set(&mut self, ms: u32) -> Result<(), LsmError>
pub fn time_out_set(&mut self, ms: u32) -> Result<(), LsmError>
Set connection timeout value in milliseconds.
sourcepub fn time_out_get(&mut self) -> Result<u32, LsmError>
pub fn time_out_get(&mut self) -> Result<u32, LsmError>
Get connection timeout value.
sourcepub fn capabilities(&mut self, sys: &System) -> Result<Capabilities, LsmError>
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.
sourcepub fn plugin_info(&mut self) -> Result<PluginInfo, LsmError>
pub fn plugin_info(&mut self) -> Result<PluginInfo, LsmError>
Get plugin information.
sourcepub fn sys_read_cache_pct_set(
&mut self,
sys: &System,
read_pct: u32,
) -> Result<(), LsmError>
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
LsmError::InvalidArgument
:read_pct
is larger than 100.
sourcepub 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>
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.
sourcepub fn volume_resize(
&mut self,
vol: &Volume,
new_size_bytes: u64,
) -> Result<Volume, LsmError>
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
.
sourcepub fn volume_replicate(
&mut self,
pool: Option<Pool>,
rep_type: VolumeReplicateType,
src_vol: &Volume,
name: &str,
) -> Result<Volume, LsmError>
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. ForNone
, 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.
sourcepub fn volume_rep_range_blk_size(
&mut self,
sys: &System,
) -> Result<u32, LsmError>
pub fn volume_rep_range_blk_size( &mut self, sys: &System, ) -> Result<u32, LsmError>
Block size for the Client::volume_replicate_range()
.
sourcepub fn volume_replicate_range(
&mut self,
rep_type: VolumeReplicateType,
src_vol: &Volume,
dst_vol: &Volume,
ranges: &[BlockRange],
) -> Result<(), LsmError>
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.
sourcepub fn volume_enable(&mut self, vol: &Volume) -> Result<(), LsmError>
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()
sourcepub fn volume_disable(&mut self, vol: &Volume) -> Result<(), LsmError>
pub fn volume_disable(&mut self, vol: &Volume) -> Result<(), LsmError>
Disable the read and write access to the specified volume.
sourcepub fn volume_mask(
&mut self,
vol: &Volume,
ag: &AccessGroup,
) -> Result<(), LsmError>
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
LsmError::EmptyAccessGroup
: Cannot mask volume to empty access group.
sourcepub fn volume_unmask(
&mut self,
vol: &Volume,
ag: &AccessGroup,
) -> Result<(), LsmError>
pub fn volume_unmask( &mut self, vol: &Volume, ag: &AccessGroup, ) -> Result<(), LsmError>
Revokes access to a volume for the specified group
sourcepub fn access_group_create(
&mut self,
name: &str,
init_id: &str,
init_type: InitiatorType,
sys: &System,
) -> Result<AccessGroup, LsmError>
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
LsmError::ExistsInitiator
: Specified initiator is used by other access group.
sourcepub fn access_group_delete(&mut self, ag: &AccessGroup) -> Result<(), LsmError>
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
LsmError::IsMasked
: Access group has volume masked to.
sourcepub fn access_group_init_add(
&mut self,
ag: &AccessGroup,
init_id: &str,
init_type: InitiatorType,
) -> Result<AccessGroup, LsmError>
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
LsmError::ExistsInitiator
: Specified initiator is used by other access group.
sourcepub fn access_group_init_del(
&mut self,
ag: &AccessGroup,
init_id: &str,
init_type: InitiatorType,
) -> Result<AccessGroup, LsmError>
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
LsmError::LastInitInAccessGroup
: Specified initiator is the last initiator of access group. UseClient::access_group_delete()
instead.
sourcepub fn vols_masked_to_ag(
&mut self,
ag: &AccessGroup,
) -> Result<Vec<Volume>, LsmError>
pub fn vols_masked_to_ag( &mut self, ag: &AccessGroup, ) -> Result<Vec<Volume>, LsmError>
Query volumes that the specified access group has access to.
sourcepub fn ags_granted_to_vol(
&mut self,
vol: &Volume,
) -> Result<Vec<AccessGroup>, LsmError>
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.
sourcepub fn vol_has_child_dep(&mut self, vol: &Volume) -> Result<bool, LsmError>
pub fn vol_has_child_dep(&mut self, vol: &Volume) -> Result<bool, LsmError>
Check whether volume has child dependencies.
sourcepub fn vol_child_dep_rm(&mut self, vol: &Volume) -> Result<(), LsmError>
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.
sourcepub fn fs_create(
&mut self,
pool: &Pool,
name: &str,
size_bytes: u64,
) -> Result<FileSystem, LsmError>
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 functionsize_human_2_size_bytes()
to convert string like ‘1.1 GiB’ to integer size bytes.
sourcepub fn fs_resize(
&mut self,
fs: &FileSystem,
new_size_bytes: u64,
) -> Result<FileSystem, LsmError>
pub fn fs_resize( &mut self, fs: &FileSystem, new_size_bytes: u64, ) -> Result<FileSystem, LsmError>
Resize of file system.
sourcepub fn fs_delete(&mut self, fs: &FileSystem) -> Result<(), LsmError>
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()
.
sourcepub fn fs_clone(
&mut self,
src_fs: &FileSystem,
dst_fs_name: &str,
snapshot: Option<&FileSystemSnapShot>,
) -> Result<FileSystem, LsmError>
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.
sourcepub fn fs_file_clone(
&mut self,
fs: &FileSystem,
src_file_name: &str,
dst_file_name: &str,
snapshot: Option<&FileSystemSnapShot>,
) -> Result<(), LsmError>
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.
sourcepub fn fs_snapshots(
&mut self,
fs: &FileSystem,
) -> Result<Vec<FileSystemSnapShot>, LsmError>
pub fn fs_snapshots( &mut self, fs: &FileSystem, ) -> Result<Vec<FileSystemSnapShot>, LsmError>
Get a list of snapshots of specified file system.
sourcepub fn fs_snapshot_create(
&mut self,
fs: &FileSystem,
name: &str,
) -> Result<FileSystemSnapShot, LsmError>
pub fn fs_snapshot_create( &mut self, fs: &FileSystem, name: &str, ) -> Result<FileSystemSnapShot, LsmError>
Create a file system snapshot.
sourcepub fn fs_snapshot_delete(
&mut self,
fs: &FileSystem,
snapshot: &FileSystemSnapShot,
) -> Result<(), LsmError>
pub fn fs_snapshot_delete( &mut self, fs: &FileSystem, snapshot: &FileSystemSnapShot, ) -> Result<(), LsmError>
Delete a file system snapshot.
sourcepub fn fs_snapshot_restore(
&mut self,
fs: &FileSystem,
snapshot: &FileSystemSnapShot,
all_file: bool,
files: Option<&[&str]>,
restore_files: Option<&[&str]>,
) -> Result<(), LsmError>
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_file
–true
for restore all files.false
for restore specified files only.files
– Only restored specified files. Ignored ifall_file
istrue
.restore_files
– If notNone
, rename restored files to defined file paths and names
sourcepub fn fs_has_child_dep(
&mut self,
fs: &FileSystem,
files: Option<Vec<&str>>,
) -> Result<bool, LsmError>
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.
sourcepub fn fs_child_dep_rm(
&mut self,
fs: &FileSystem,
files: Option<Vec<&str>>,
) -> Result<(), LsmError>
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.
sourcepub fn nfs_exp_auth_type_list(&mut self) -> Result<Vec<String>, LsmError>
pub fn nfs_exp_auth_type_list(&mut self) -> Result<Vec<String>, LsmError>
Get supported NFS client authentication types.
sourcepub fn fs_export(
&mut self,
fs: &FileSystem,
export_path: Option<&str>,
access: &NfsAccess<'_>,
auth_type: Option<&str>,
options: Option<&str>,
) -> Result<NfsExport, LsmError>
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. IfNone
, will let storage system to generate one.access
– NFS access details.auth_type
– NFS client authentication type. Get fromClient::nfs_exp_auth_type_list()
.options
– Extra NFS options.
sourcepub fn fs_unexport(&mut self, exp: &NfsExport) -> Result<(), LsmError>
pub fn fs_unexport(&mut self, exp: &NfsExport) -> Result<(), LsmError>
Unexport specified NFS exports.
sourcepub fn vol_raid_info(
&mut self,
vol: &Volume,
) -> Result<VolumeRaidInfo, LsmError>
pub fn vol_raid_info( &mut self, vol: &Volume, ) -> Result<VolumeRaidInfo, LsmError>
Get volume RAID information.
sourcepub fn pool_member_info(
&mut self,
pool: &Pool,
) -> Result<PoolMemberInfo, LsmError>
pub fn pool_member_info( &mut self, pool: &Pool, ) -> Result<PoolMemberInfo, LsmError>
Get pool member information.
sourcepub fn vol_raid_create_cap_get(
&mut self,
sys: &System,
) -> Result<(Vec<RaidType>, Vec<u32>), LsmError>
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.
sourcepub fn vol_raid_create(
&mut self,
name: &str,
raid_type: RaidType,
disks: &[Disk],
strip_size: Option<u32>,
) -> Result<Volume, LsmError>
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.
sourcepub fn vol_ident_led_on(&mut self, vol: &Volume) -> Result<(), LsmError>
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.
sourcepub fn vol_ident_led_off(&mut self, vol: &Volume) -> Result<(), LsmError>
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.
sourcepub fn vol_cache_info(
&mut self,
vol: &Volume,
) -> Result<VolumeCacheInfo, LsmError>
pub fn vol_cache_info( &mut self, vol: &Volume, ) -> Result<VolumeCacheInfo, LsmError>
Get cache information on specified volume.
sourcepub fn vol_phy_disk_cache_set(
&mut self,
vol: &Volume,
pdc: CachePolicy,
) -> Result<(), LsmError>
pub fn vol_phy_disk_cache_set( &mut self, vol: &Volume, pdc: CachePolicy, ) -> Result<(), LsmError>
Set volume physical disk cache policy.
sourcepub fn vol_write_cache_set(
&mut self,
vol: &Volume,
wcp: CachePolicy,
) -> Result<(), LsmError>
pub fn vol_write_cache_set( &mut self, vol: &Volume, wcp: CachePolicy, ) -> Result<(), LsmError>
Set volume write cache policy.
sourcepub fn vol_read_cache_set(
&mut self,
vol: &Volume,
rcp: CachePolicy,
) -> Result<(), LsmError>
pub fn vol_read_cache_set( &mut self, vol: &Volume, rcp: CachePolicy, ) -> Result<(), LsmError>
Set volume read cache policy.