�
-�P`c@s�ddlZddlZddlmZmZmZmZmZmZm Z m
Z
mZmZm
Z
mZmZmZmZddlmZddlmZddlmZddlmZddlZd�Zd�Zd �Z d
efd��YZ!dS(i����N(tVolumet NfsExporttCapabilitiestPooltSystemtBatterytDisktAccessGroupt
FileSystemt
FsSnapshott uri_parsetLsmErrortErrorNumbertINetworkAttachedStoraget
TargetPort(treturn_requires(tUDS_PATH(t TransPort(tIDatacCs|d=|S(s�
Used to remove the self key from the dict d. Self is included when calling
the function locals() in a class method.
tself((td((s//usr/lib/python2.7/site-packages/lsm/_client.pyt _del_self"scCs/|r+||kr+ttjd|��ndS(NsUnsupported search_key: '%s'(RRtUNSUPPORTED_SEARCH_KEY(t
search_keytsupported_keys((s//usr/lib/python2.7/site-packages/lsm/_client.pyt_check_search_key+s cCsttjd��dS(Ns`The libStorageMgmt daemon is not running (process name lsmd), try 'service libstoragemgmt start'(RRtDAEMON_NOT_RUNNING(((s//usr/lib/python2.7/site-packages/lsm/_client.pyt_raise_no_daemon3s tClientcBs�eZdZdIZdJZdKZdLZdd�Zdd�Ze d��Z
e d��ZdMddd �Z
edM�ed
��ZedM�ed��Ze eejdg�ded
���ZedM�ed��Zee�ed��Zeeee�ed��ZedM�ed��Zee�ed��Zeejdejd�ed��Zeeg�dMdMed��Zeeg�ed��Z edM�ed��Z!edM�ed��Z"ee#g�dMdMed��Z$eejde#�ed��Z%eejde#�ed��Z&eejde#�ed��Z'ee�ed��Z(eejd�ed��Z)eejd�ed��Z*edM�ed��Z+edM�ed ��Z,ee-g�dMdMed!��Z.edM�ed"��Z/edM�ed#��Z0ee1g�dMdMed$��Z2ee1�ed%��Z3edM�ed&��Z4ee1�ed'��Z5ee1�ed(��Z6ee#g�ed)��Z7ee1g�ed*��Z8ee9�ed+��Z:eejd�ed,��Z;ee<g�dMdMed-��Z=eejd�ed.��Z>eejde<�ed/��Z?eejde<�ed0��Z@eejde<�dMed1��ZAeejd�dMed2��ZBeeCg�ed3��ZDeejdeC�ed4��ZEeejd�ed5��ZFeejd�eGed6��ZHee9�ed7��ZIeejd�ed8��ZJeejdg�ed9��ZKeeLg�dMdMed:��ZMeeL�eLjNeLjNdMdMed;��ZOedM�ed<��ZPeeQg�dMdMed=��ZReeeeeeg�ed>��ZSeeeejdgg�ed?��ZTeegegg�ed@��ZUee#�edA��ZVedM�edB��ZWedM�edC��ZXeeYg�dMdMedD��ZZeeeeeeg�edE��Z[edM�edF��Z\edM�edG��Z]edM�edH��Z^RS(NiiiicCstd��dS(NsDo not call directly!(tRuntimeError(Rturitplain_text_passwordt
timeout_mstflags((s//usr/lib/python2.7/site-packages/lsm/_client.pytplugin_registerQscCs |jjdtt���dS(s3
Instruct the plug-in to get ready
R"N(t_tptrpcRtlocals(RRtpasswordttimeoutR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyt__start[scCs�tj�}tjj|�r�x~tj|�D]j\}}}xX|D]P}tjj||�}y!tj|�}|j �t
SWqDtk
r�qDXqDWq.WntS(N(
Rt_plugin_uds_pathtostpathtexiststwalktjoint
_TransPortt
get_sockettclosetTrueRtFalse(tuds_pathtroottsub_folderstfilestfilenametudsts((s//usr/lib/python2.7/site-packages/lsm/_client.pyt_check_daemon_existses
cCs)t}dtjkr%tjd}n|S(NtLSM_UDS_PATH(t _UDS_PATHR*tenviron(trc((s//usr/lib/python2.7/site-packages/lsm/_client.pyR)ysi0uc Cs||_||_||_tj�|_t|dg�}|d}d|krp|jd�\}}|}ntj j
|j|�|_tj j|j�r�t
t
j|j��|_n/tj�r�ttjd|j��nt�|j||||�dS(Ntschemet+sPlug-in %s not found!(t_urit _passwordt_timeoutRR)t _uds_pathR
tsplitR*R+R.tplugin_pathR,R/R0R#R;RRtPLUGIN_NOT_EXISTRt_Client__start( RRRR R!tuR@tplugtproto((s//usr/lib/python2.7/site-packages/lsm/_client.pyt__init__�s"
cCs|j|�dS(s$
Synonym for close.
N(R1(RR!((s//usr/lib/python2.7/site-packages/lsm/_client.pytplugin_unregister�scCs6|jjdtt���|jj�d|_dS(sB
Does an orderly plugin_unregister of the plug-in
RNN(R#R$RR%R1tNone(RR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR1�s
t:cCs�g}tj�st�ntj�}x�tj|�D]�\}}}x}|D]u}tjj||�}ttj |��} | j
dtd|��\}
}|jd|
||f�| j
�qNWq8W|S(s�
Retrieves all the available plug-ins
Return list of strings of available plug-ins with the
"desc<sep>version"
tplugin_infoR!s%s%s%s(RR;RR)R*R-R+R.R/R0R$tdicttappendR1(t field_sepR!R?R4R5R6R7R8R9ttptitv((s//usr/lib/python2.7/site-packages/lsm/_client.pytavailable_plugins�s
!cCs|jjdtt���S(sr
Sets any time-outs for the plug-in (ms)
Return None on success, else LsmError exception
ttime_out_set(R#R$RR%(RtmsR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyRY�scCs|jjdtt���S(sd
Retrieves the current time-out
Return time-out in ms, else raise LsmError
ttime_out_get(R#R$RR%(RR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR[�scCs|jjdtt���S(s�
Returns the stats of the given job.
Returns a tuple ( status (enumeration), percent_complete,
completed item).
else LsmError exception.
t
job_status(R#R$RR%(Rtjob_idR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR\�s cCs|jjdtt���S(ss
Frees resources for a given job number.
Returns None on success, else raises an LsmError
tjob_free(R#R$RR%(RR]R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR^scCs|jjdtt���S(sv
Fetches the capabilities of the array
Returns a capability object, see data,py for details.
tcapabilities(R#R$RR%(RtsystemR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR_scCs|jjdtt���S(s>
Returns a description and version of plug-in
RQ(R#R$RR%(RR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyRQ"scCs,t|tj�|jjdtt���S(s�
Returns an array of pool objects. Pools are used in both block and
file system interfaces, thus the reason they are in the base class.
tpools(RRtSUPPORTED_SEARCH_KEYSR#R$RR%(RRtsearch_valueR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyRa/scCs|jjdtt���S(s�
Returns an array of system objects. System information is used to
distinguish resources from on storage array to another when the plug=in
supports the ability to have more than one array managed by it
tsystems(R#R$RR%(RR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyRd<scCs�tjddkr@t|ttf�sdttjd��qdn$t|t�sdttjd��n|dks||dkr�ttjd��n|jj dt
t���S(s�
lsm.Client.system_read_cache_pct_update(self, system, read_pct,
flags=lsm.Client.FLAG_RSVD)
Version:
1.3
Usage:
This method updates the read cache percentage on a system if
supported
Parameters:
system(lsm.System)
an lsm.System object.
read_pct(int)
the desired read cache percentage.
flags (int)
Optional. Reserved for future use.
Should be set as lsm.Client.FLAG_RSVD.
Returns:
returns None on success, else raises LsmError on errors.
SpecialExceptions:
iis&Invalid read_pct, should be an integerids,Invalid read_pct, should be in range 0 - 100tsystem_read_cache_pct_update(tsystversion_infot
isinstancetinttlongRRtINVALID_ARGUMENTR#R$RR%(RR`tread_pctR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyReKs cCs5tj|tjdt�|jjdtt���S(sg
Register a user/password for the specified initiator for CHAP
authentication.
traise_exceptiontiscsi_chap_auth(Rtinitiator_id_verifytINIT_TYPE_ISCSI_IQNR2R#R$RR%(Rtinit_idtin_usertin_passwordtout_usertout_passwordR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyRn}s cCs,t|tj�|jjdtt���S(s4
Returns an array of volume objects
tvolumes(RRRbR#R$RR%(RRRcR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyRv�scCs|jjdtt���S(s�
Creates a volume, given a pool, volume name, size and provisioning
returns a tuple (job_id, new volume)
Note: Tuple return values are mutually exclusive, when one
is None the other must be valid.
t
volume_create(R#R$RR%(Rtpooltvolume_namet
size_bytestprovisioningR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyRw�s
cCs|jjdtt���S(s�
Re-sizes a volume.
Returns a tuple (job_id, re-sized_volume)
Note: Tuple return values are mutually exclusive, when one
is None the other must be valid.
t
volume_resize(R#R$RR%(Rtvolumetnew_size_bytesR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR|�s cCs|jjdtt���S(s�
Replicates a volume from the specified pool.
Returns a tuple (job_id, replicated volume)
Note: Tuple return values are mutually exclusive, when one
is None the other must be valid.
tvolume_replicate(R#R$RR%(RRxtrep_typet
volume_srctnameR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�s
cCs|jjdtt���S(sB
Returns the size of a replicated block in bytes.
t!volume_replicate_range_block_size(R#R$RR%(RR`R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCs|jjdtt���S(s-
Replicates a portion of a volume to itself or another volume. The src,
dest and number of blocks values change with vendor, call
volume_replicate_range_block_size to get block unit size.
Returns Job id or None when completed, else raises LsmError on errors.
tvolume_replicate_range(R#R$RR%(RR�R�tvolume_desttrangesR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��s
cCs|jjdtt���S(sQ
Deletes a volume.
Returns None on success, else job id
t
volume_delete(R#R$RR%(RR}R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCs|jjdtt���S(sx
Makes a volume available to the host
returns None on success, else raises LsmError on errors.
t
volume_enable(R#R$RR%(RR}R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�
scCs|jjdtt���S(sz
Makes a volume unavailable to the host
returns None on success, else raises LsmError on errors.
tvolume_disable(R#R$RR%(RR}R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�scCs,t|tj�|jjdtt���S(s2
Returns an array of disk objects
tdisks(RRRbR#R$RR%(RRRcR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�*scCs|jjdtt���S(s<
Allows an access group to access a volume.
tvolume_mask(R#R$RR%(Rtaccess_groupR}R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�8scCs|jjdtt���S(sA
Revokes access for an access group for a volume
t
volume_unmask(R#R$RR%(RR�R}R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�EscCs,t|tj�|jjdtt���S(s1
Returns a list of access groups
t
access_groups(RRRbR#R$RR%(RRRcR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�RscCs>tj||dt�d\}}|jjdtt���S(ss
Creates an access group and add the specified initiator id,
init_type and desired access.
Rmitaccess_group_create(RRoR2R#R$RR%(RR�Rqt init_typeR`R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�cscCs|jjdtt���S(s)
Deletes an access group
taccess_group_delete(R#R$RR%(RR�R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�sscCs>tj||dt�d\}}|jjdtt���S(s6
Adds an initiator to an access group
Rmitaccess_group_initiator_add(RRoR2R#R$RR%(RR�RqR�R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCs8tj|ddt�d}|jjdtt���S(s;
Deletes an initiator from an access group
Rmitaccess_group_initiator_deleteN(RRoROR2R#R$RR%(RR�RqR�R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��s
cCs|jjdtt���S(sN
Returns the list of volumes that access group has access to.
t"volumes_accessible_by_access_group(R#R$RR%(RR�R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCs|jjdtt���S(se
Returns the list of access groups that have access to the specified
volume.
taccess_groups_granted_to_volume(R#R$RR%(RR}R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCs|jjdtt���S(s�
Returns True if this volume has other volumes which are dependant on
it. Implies that this volume cannot be deleted or possibly modified
because it would affect its children.
tvolume_child_dependency(R#R$RR%(RR}R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCs|jjdtt���S(s�
If this volume has child dependency, this method call will fully
replicate the blocks removing the relationship between them. This
should return None (success) if volume_child_dependency would return
False.
Note: This operation could take a very long time depending on the size
of the volume and the number of child dependencies.
Returns None if complete else job id, raises LsmError on errors.
tvolume_child_dependency_rm(R#R$RR%(RR}R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��s
cCs,t|tj�|jjdtt���S(sC
Returns a list of file systems on the controller.
tfs(RRRbR#R$RR%(RRRcR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCs|jjdtt���S(s�
WARNING: Destructive
Deletes a file system and everything it contains
Returns None on success, else job id
t fs_delete(R#R$RR%(RR�R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCs|jjdtt���S(s�
Re-size a file system
Returns a tuple (job_id, re-sized file system)
Note: Tuple return values are mutually exclusive, when one
is None the other must be valid.
t fs_resize(R#R$RR%(RR�R~R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�s cCs|jjdtt���S(s
Creates a file system given a pool, name and size.
Note: size is limited to 2**64 bytes
Returns a tuple (job_id, file system)
Note: Tuple return values are mutually exclusive, when one
is None the other must be valid.
t fs_create(R#R$RR%(RRxR�RzR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�s
cCs|jjdtt���S(s#
Creates a thin, point in time read/writable copy of src to dest.
Optionally uses snapshot as backing of src_fs
Returns a tuple (job_id, file system)
Note: Tuple return values are mutually exclusive, when one
is None the other must be valid.
tfs_clone(R#R$RR%(Rtsrc_fstdest_fs_nametsnapshotR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�&s
cCs|jjdtt���S(s�
Creates a thinly provisioned clone of src to dest.
Note: Source and Destination are required to be on same filesystem and
all directories in destination path need to exist.
Returns None on success, else job id
t
fs_file_clone(R#R$RR%(RR�t
src_file_nametdest_file_nameR�R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�;s
cCs|jjdtt���S(sO
Returns a list of snapshot names for the supplied file system
tfs_snapshots(R#R$RR%(RR�R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�LscCs|jjdtt���S(s|
Snapshot is a point in time read-only copy
Create a snapshot on the chosen file system.
Returns a tuple (job_id, snapshot)
Notes:
- Snapshot name may not match what was passed in
(depends on array implementation)
- Tuple return values are mutually exclusive, when one
is None the other must be valid.
tfs_snapshot_create(R#R$RR%(RR�t
snapshot_nameR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�YscCs|jjdtt���S(s�
Frees the re-sources for the given snapshot on the supplied filesystem.
Returns None on success else job id, LsmError exception on error
tfs_snapshot_delete(R#R$RR%(RR�R�R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�oscCs|jjdtt���S(s6
WARNING: Destructive!
Reverts a file-system or just the specified files from the snapshot.
If a list of files is supplied but the array cannot restore just them
then the operation will fail with an LsmError raised. If files == None
and all_files = True then all files on the file-system are restored.
Restore_file if None none must be the same length as files with each
index in each list referring to the associated file.
Returns None on success, else job id, LsmError exception on error
tfs_snapshot_restore(R#R$RR%(RR�R�R7t
restore_filest all_filesR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCs|jjdtt���S(s&
Returns True if the specified filesystem or specified file on this
file system has child dependencies. This implies that this filesystem
or specified file on this file system cannot be deleted or possibly
modified because it would affect its children.
tfs_child_dependency(R#R$RR%(RR�R7R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCs|jjdtt���S(s�
If this filesystem or specified file on this filesystem has child
dependency this method will fully replicate the blocks removing the
relationship between them. This should return None(success) if
fs_child_dependency would return False.
Note: This operation could take a very long time depending on the size
of the filesystem and the number of child dependencies.
Returns None if completed, else job id. Raises LsmError on errors.
tfs_child_dependency_rm(R#R$RR%(RR�R7R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��s
cCs|jjdtt���S(sH
What types of NFS client authentication are supported.
texport_auth(R#R$RR%(RR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCs,t|tj�|jjdtt���S(sL
Get a list of all exported file systems on the controller.
texports(RRRbR#R$RR%(RRRcR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCsQt|�t|�t|�r5ttjd��n|jjdtt���S(sD
Exports a filesystem as specified in the arguments
s(Host cannot both in rw_list and ro_list.t export_fs(tsetRRRkR#R$RR%(Rtfs_idtexport_patht root_listtrw_listtro_listtanon_uidtanon_gidt auth_typetoptionsR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��s cCs|jjdtt���S(s.
Removes the specified export
t
export_remove(R#R$RR%(RtexportR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCs,t|tj�|jjdtt���S(s0
Returns a list of target ports
ttarget_ports(RRRbR#R$RR%(RRRcR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCs|jjdtt���S(sQuery the RAID information of certain volume.
New in version 1.2.
Query the RAID type, strip size, extents count, minimum I/O size,
optimal I/O size of given volume.
This method requires this capability:
lsm.Capabilities.VOLUME_RAID_INFO
Args:
volume (Volume object): Volume to query
flags (int): Reserved for future use. Should be set as
lsm.Client.FLAG_RSVD
Returns:
[raid_type, strip_size, disk_count, min_io_size, opt_io_size]
raid_type (int): RAID Type of requested volume.
Could be one of these values:
Volume.RAID_TYPE_RAID0
Stripe
Volume.RAID_TYPE_RAID1
Two disks Mirror
Volume.RAID_TYPE_RAID3
Byte-level striping with dedicated parity
Volume.RAID_TYPE_RAID4
Block-level striping with dedicated parity
Volume.RAID_TYPE_RAID5
Block-level striping with distributed parity
Volume.RAID_TYPE_RAID6
Block-level striping with two distributed parities,
aka, RAID-DP
Volume.RAID_TYPE_RAID10
Stripe of mirrors
Volume.RAID_TYPE_RAID15
Parity of mirrors
Volume.RAID_TYPE_RAID16
Dual parity of mirrors
Volume.RAID_TYPE_RAID50
Stripe of parities
Volume.RAID_TYPE_RAID60
Stripe of dual parities
Volume.RAID_TYPE_RAID51
Mirror of parities
Volume.RAID_TYPE_RAID61
Mirror of dual parities
Volume.RAID_TYPE_JBOD
Just bunch of disks, no parity, no striping.
Volume.RAID_TYPE_UNKNOWN
The plugin failed to detect the volume's RAID type.
Volume.RAID_TYPE_MIXED
This volume contains multiple RAID settings.
Volume.RAID_TYPE_OTHER
Vendor specific RAID type
strip_size(int): The size of strip on each disk or other storage
extent.
For RAID1/JBOD, it should be set as sector size.
If plugin failed to detect strip size, it should be set
as Volume.STRIP_SIZE_UNKNOWN(0).
disk_count(int): The count of disks used for assembling the RAID
group(s) where this volume allocated from.
For any RAID system using the slice of disk, this value
indicate how many disk slices are used for the RAID.
For example, on LVM RAID, the 'disk_count' here indicate the
count of PVs used for certain volume.
Another example, on EMC VMAX, the 'disk_count' here indicate
how many hyper volumes are used for this volume.
For any RAID system using remote LUN for data storing, each
remote LUN should be count as a disk.
If the plugin failed to detect disk_count, it should be set
as Volume.DISK_COUNT_UNKNOWN(0).
min_io_size(int): The minimum I/O size, device preferred I/O
size for random I/O. Any I/O size not equal to a multiple
of this value may get significant speed penalty.
Normally it refers to strip size of each disk(extent).
If plugin failed to detect min_io_size, it should try these
values in the sequence of:
logical sector size -> physical sector size ->
Volume.MIN_IO_SIZE_UNKNOWN(0).
opt_io_size(int): The optimal I/O size, device preferred I/O
size for sequential I/O. Normally it refers to RAID group
stripe size.
If plugin failed to detect opt_io_size, it should be set
to Volume.OPT_IO_SIZE_UNKNOWN(0).
Raises:
LsmError:
ErrorNumber.NO_SUPPORT
No support.
tvolume_raid_info(R#R$RR%(RR}R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�s[cCs|jjdtt���S(s?
lsm.Client.pool_member_info(self, pool, flags=lsm.Client.FLAG_RSVD)
Version:
1.2
Usage:
Query the membership information of certain pool:
RAID type, member type and member ids.
Currently, LibStorageMgmt supports two types of pool:
* Sub-pool -- Pool.MEMBER_TYPE_POOL
Pool space is allocated from parent pool.
Example:
* NetApp ONTAP volume
* Disk RAID pool -- Pool.MEMBER_TYPE_DISK
Pool is a RAID group assembled by disks.
Example:
* LSI MegaRAID disk group
* EMC VNX pool
* NetApp ONTAP aggregate
Parameters:
pool (lsm.Pool object)
Pool to query
flags (int)
Optional. Reserved for future use.
Should be set as lsm.Client.FLAG_RSVD.
Returns:
[raid_type, member_type, member_ids]
raid_type (int)
RAID Type of requested pool.
Could be one of these values:
Volume.RAID_TYPE_RAID0
Stripe
Volume.RAID_TYPE_RAID1
Two disks Mirror
Volume.RAID_TYPE_RAID3
Byte-level striping with dedicated parity
Volume.RAID_TYPE_RAID4
Block-level striping with dedicated parity
Volume.RAID_TYPE_RAID5
Block-level striping with distributed parity
Volume.RAID_TYPE_RAID6
Block-level striping with two distributed parities,
aka, RAID-DP
Volume.RAID_TYPE_RAID10
Stripe of mirrors
Volume.RAID_TYPE_RAID15
Parity of mirrors
Volume.RAID_TYPE_RAID16
Dual parity of mirrors
Volume.RAID_TYPE_RAID50
Stripe of parities Volume.RAID_TYPE_RAID60
Stripe of dual parities
Volume.RAID_TYPE_RAID51
Mirror of parities
Volume.RAID_TYPE_RAID61
Mirror of dual parities
Volume.RAID_TYPE_JBOD
Just bunch of disks, no parity, no striping.
Volume.RAID_TYPE_UNKNOWN
The plugin failed to detect the volume's RAID type.
Volume.RAID_TYPE_MIXED
This pool contains multiple RAID settings.
Volume.RAID_TYPE_OTHER
Vendor specific RAID type
member_type (int)
Could be one of these values:
Pool.MEMBER_TYPE_POOL
Current pool(also known as sub-pool) is allocated from
other pool(parent pool). The 'raid_type' will set to
RAID_TYPE_OTHER unless certain RAID system support RAID
using space of parent pools.
Pool.MEMBER_TYPE_DISK
Pool is created from RAID group using whole disks.
Pool.MEMBER_TYPE_OTHER
Vendor specific RAID member type.
Pool.MEMBER_TYPE_UNKNOWN
Plugin failed to detect the RAID member type.
member_ids (list of strings)
When 'member_type' is Pool.MEMBER_TYPE_POOL,
the 'member_ids' will contain a list of parent Pool IDs.
When 'member_type' is Pool.MEMBER_TYPE_DISK,
the 'member_ids' will contain a list of disk IDs.
When 'member_type' is Pool.MEMBER_TYPE_OTHER or
Pool.MEMBER_TYPE_UNKNOWN, the member_ids should be an empty
list.
SpecialExceptions:
LsmError
ErrorNumber.NO_SUPPORT
ErrorNumber.NOT_FOUND_POOL
Capability:
lsm.Capabilities.POOL_MEMBER_INFO
tpool_member_info(R#R$RR%(RRxR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�ns`cCs|jjdtt���S(s�
lsm.Client.volume_raid_create_cap_get(
self, system, flags=lsm.Client.FLAG_RSVD)
Version:
1.2
Usage:
This method is dedicated to local hardware RAID cards.
Query out all supported RAID types and strip sizes which could
be used by lsm.Client.volume_raid_create() method.
Parameters:
system (lsm.System)
Instance of lsm.System
flags (int)
Optional. Reserved for future use.
Should be set as lsm.Client.FLAG_RSVD.
Returns:
[raid_types, strip_sizes]
raid_types ([int])
List of integer, possible values are:
Volume.RAID_TYPE_RAID0
Volume.RAID_TYPE_RAID1
Volume.RAID_TYPE_RAID5
Volume.RAID_TYPE_RAID6
Volume.RAID_TYPE_RAID10
Volume.RAID_TYPE_RAID50
Volume.RAID_TYPE_RAID60
strip_sizes ([int])
List of integer. Stripe size in bytes.
SpecialExceptions:
LsmError
lsm.ErrorNumber.NO_SUPPORT
Method not supported.
Sample:
lsm_client = lsm.Client('sim://')
lsm_sys = lsm_client.systems()[0]
disks = lsm_client.disks(
search_key='system_id', search_value=lsm_sys.id)
free_disks = [d for d in disks if d.status == Disk.STATUS_FREE]
supported_raid_types, supported_strip_sizes = lsm_client.volume_raid_create_cap_get(lsm_sys)
new_vol = lsm_client.volume_raid_create(
'test_volume_raid_create', supported_raid_types[0],
free_disks, supported_strip_sizes[0])
Capability:
lsm.Capabilities.VOLUME_CREATE_RAID
This method is mandatory when volume_raid_create() is
supported.
tvolume_raid_create_cap_get(R#R$RR%(RR`R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��s5c
Cs�t|�dkr'ttjd��n|tjkr]t|�dkr]ttjd��n|tjkr�t|�dkr�ttjd��n|tjkr�t|�dkr�ttjd��n|tjkrt|�ds�t|�dkrttjd ��qn|tj kr[t|�dsCt|�d
kr[ttjd��q[n|tj
kr�t|�ds�t|�dkr�ttjd
��q�n|jjdt
t���S(s
lsm.Client.volume_raid_create(self, name, raid_type, disks,
strip_size, flags=lsm.Client.FLAG_RSVD)
Version:
1.2
Usage:
This method is dedicated to local hardware RAID cards.
Create a disk RAID pool and allocate entire storage space to
new volume using requested volume name.
When dealing with RAID10, 50 or 60, the first half part of
'disks' will be located in one bottom layer RAID group.
The new volume and new pool will created within the same system
of provided disks.
This method does not allow duplicate call, when duplicate call
was issued, LsmError with ErrorNumber.DISK_NOT_FREE will be raise.
User should check disk.status for Disk.STATUS_FREE before
invoking this method.
Parameters:
name (string)
The name for new volume.
The requested volume name might be ignored due to restriction
of hardware RAID vendors.
The pool name will be automatically chosen by plugin.
raid_type (int)
The RAID type for the RAID group, possible values are:
Volume.RAID_TYPE_RAID0
Volume.RAID_TYPE_RAID1
Volume.RAID_TYPE_RAID5
Volume.RAID_TYPE_RAID6
Volume.RAID_TYPE_RAID10
Volume.RAID_TYPE_RAID15
Volume.RAID_TYPE_RAID16
Volume.RAID_TYPE_RAID50
Please check volume_raid_create_cap_get() returns to get
supported all raid types of current hardware RAID card.
disks ([lsm.Disks,])
A list of lsm.Disk objects. Free disks used for new RAID group.
strip_size (int)
The size in bytes of strip.
When setting strip_size to Volume.VCR_STRIP_SIZE_DEFAULT, it
allow hardware RAID cards to choose their default value.
Please use volume_raid_create_cap_get() method to get all
supported strip size of current hardware RAID card.
The Volume.VCR_STRIP_SIZE_DEFAULT is always supported when
lsm.Capabilities.VOLUME_CREATE_RAID is supported.
flags (int)
Optional. Reserved for future use.
Should be set as lsm.Client.FLAG_RSVD.
Returns:
lsm.Volume
The lsm.Volume object for newly created volume.
SpecialExceptions:
LsmError
lsm.ErrorNumber.NO_SUPPORT
Method not supported or RAID type not supported.
lsm.ErrorNumber.DISK_NOT_FREE
Disk is not in Disk.STATUS_FREE status.
lsm.ErrorNumber.NOT_FOUND_DISK
Disk not found
lsm.ErrorNumber.INVALID_ARGUMENT
1. Invalid input argument data.
2. Disks are not from the same system.
3. Disks are not from the same enclosure.
4. Invalid strip_size.
5. Disk count are meet the minimum requirement:
RAID1: len(disks) == 2
RAID5: len(disks) >= 3
RAID6: len(disks) >= 4
RAID10: len(disks) % 2 == 0 and len(disks) >= 4
RAID50: len(disks) % 2 == 0 and len(disks) >= 6
RAID60: len(disks) % 2 == 0 and len(disks) >= 8
lsm.ErrorNumber.NAME_CONFLICT
Requested name is already be used by other volume.
Sample:
lsm_client = lsm.Client('sim://')
disks = lsm_client.disks()
free_disks = [d for d in disks if d.status == Disk.STATUS_FREE]
new_vol = lsm_client.volume_raid_create(
'raid0_vol1', Volume.RAID_TYPE_RAID0, free_disks)
Capability:
lsm.Capabilities.VOLUME_CREATE_RAID
Indicate current system support volume_raid_create() method.
At least one RAID type should be supported.
The strip_size == Volume.VCR_STRIP_SIZE_DEFAULT is supported.
is.Illegal input disks argument: no disk includedis7Illegal input disks argument: RAID 1 only allow 2 disksis<Illegal input disks argument: RAID 5 require 3 or more disksis<Illegal input disks argument: RAID 6 require 4 or more diskssRIllegal input disks argument: RAID 10 require even disks count and 4 or more disksisRIllegal input disks argument: RAID 50 require even disks count and 6 or more disksisRIllegal input disks argument: RAID 60 require even disks count and 8 or more diskstvolume_raid_create(tlenRRRkRtRAID_TYPE_RAID1tRAID_TYPE_RAID5tRAID_TYPE_RAID6tRAID_TYPE_RAID10tRAID_TYPE_RAID50tRAID_TYPE_RAID60R#R$RR%(RR�t raid_typeR�t
strip_sizeR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�s@Y!!!"""cCs|jjdtt���S(sF
lsm.Client.volume_ident_led_on(self, volume,
flags=lsm.Client.FLAG_RSVD)
Version:
1.3
Usage:
This method enables the IDENT LED on a volume if supported
Parameters:
volume (lsm.Volume)
An lsm.Volume object.
flags (int)
Optional. Reserved for future use.
Should be set as lsm.Client.FLAG_RSVD.
Returns:
returns None on success, else raises LsmError on errors.
SpecialExceptions:
tvolume_ident_led_on(R#R$RR%(RR}R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCs|jjdtt���S(sK
lsm.Client.volume_ident_led_off(self, volume,
flags=lsm.Client.FLAG_RSVD)
Version:
1.3
Usage:
This method disables the IDENT LED on a volume if supported
Parameters:
volume (lsm.Volume)
An lsm.Volume object.
flags (int)
Optional. Reserved for future use.
Should be set as lsm.Client.FLAG_RSVD.
Returns:
returns None on success, else raises LsmError on errors.
SpecialExceptions:
tvolume_ident_led_off(R#R$RR%(RR}R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��scCs,t|tj�|jjdtt���S(s~
lsm.Client.batteries(self, search_key=None, search_value=None,
flags=lsm.Client.FLAG_RSVD)
Version:
1.3
Usage:
Query batteries. When present, super capacitors will also be
included.
Parameters:
search_key (string, optional)
The key name for the search. Valid search keys are stored in
lsm.Battery.SUPPORTED_SEARCH_KEYS
search_value (string, optional)
The value of search_key to match.
flags (int, optional):
Reserved for future use. Should be set as lsm.Client.FLAG_RSVD
Returns:
[lsm.Battery]
lsm.Battery (object)
lsm.Battery.id (string)
Unique ID for this cache hardware.
lsm.Battery.name (string)
Human friendly name, might include physical location, model
name and etc.
lsm.Battery.type (int)
The hardware type of cache. Could be one of these values:
lsm.Battery.TYPE_CHEMICAL
Chemical battery.
lsm.Battery.TYPE_CAPACITOR
Supper capacitor.
lsm.Battery.TYPE_OTHER
Vendor specific battery type.
lsm.Battery.TYPE_UNKNOWN
Unknown type.
lsm.Battery.status (int, bitmap)
Could be any combination of these values:
lsm.Battery.STATUS_OK
Battery is fully charged, health and not in use
currently.
lsm.Battery.STATUS_DISCHARGING
Battery is in use.
lsm.Battery.STATUS_CHARGING
Battery is charging.
lsm.Battery.STATUS_LEARNING
Battery is calibrating itself by discharging
battery and recharging again.
lsm.Battery.STATUS_DEGRADED
Battery is in degraded mode, need attention.
For example, battery is near end of life.
lsm.Battery.STATUS_ERROR
Battery is having hardware error or end of life.
lsm.Battery.STATUS_OTHER
Vendor specific status.
lsm.Battery.STATUS_UNKNOWN
Unknown.
lsm.Battery.system_id (string)
The id of system which current battery belong to.
SpecialExceptions:
LsmError
ErrorNumber.NO_SUPPORT
Capability:
lsm.Capabilities.BATTERIES
t batteries(RRRbR#R$RR%(RRRcR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��sBcCs|jjdtt���S(s�
lsm.Client.volume_cache_info(self, volume,
flags=lsm.Client.FLAG_RSVD)
Version:
1.3
Usage:
Query RAM cache setting and status of specified volume on read
and write I/O.
Parameters:
volume (Lsm.Volume)
The lsm.Volume instance.
flags (int, optional):
Reserved for future use. Should be set as lsm.Client.FLAG_RSVD
Returns:
[int, int, int, int, int]
write_cache_policy (int)
The write cache policy. Valid values are:
* lsm.Volume.WRITE_CACHE_POLICY_WRITE_BACK
The storage system will use write back mode if cache
hardware found.
* lsm.Volume.WRITE_CACHE_POLICY_AUTO
The controller will use write back mode when
battery/capacitor is in good health, otherwise,
write through mode.
* lsm.Volume.WRITE_CACHE_POLICY_WRITE_THROUGH
The storage system will use write through mode.
* lsm.Volume.WRITE_CACHE_POLICY_UNKNOWN
Plugin failed to detect this setting.
write_cache_status (int)
The status of write cache. Valid values are:
* lsm.Volume.WRITE_CACHE_STATUS_WRITE_THROUGH
* lsm.Volume.WRITE_CACHE_STATUS_WRITE_BACK
* lsm.Volume.WRITE_CACHE_STATUS_UNKNOWN
read_cache_policy (int)
The policy for read cache. Valid values are:
* lsm.Volume.READ_CACHE_POLICY_ENABLED
Read cache is enabled, when reading I/O on previous
unchanged written I/O or read I/O in cache will be
returned to I/O initiator immediately without checking
backing store(normally disk).
* lsm.Volume.READ_CACHE_POLICY_DISABLED
Read cache is disabled.
* lsm.Volume.READ_CACHE_POLICY_UNKNOWN
Plugin failed to detect the read cache policy.
read_cache_status (int)
The status of read cache. Valid values are:
* lsm.Volume.READ_CACHE_STATUS_ENABLED
* lsm.Volume.READ_CACHE_STATUS_DISABLED
* lsm.Volume.READ_CACHE_STATUS_UNKNOWN
physical_disk_cache (int)
Whether physical disk's cache is enabled or not.
Please be advised, HDD's physical disk ram cache might be not
protected by storage system's battery or capacitor on sudden
power loss, you could lose data if a power failure occurs
during a write process.
For SSD's physical disk cache, please check with the vendor of
your hardware RAID card and SSD disk.
Valid values are:
* lsm.Volume.PHYSICAL_DISK_CACHE_ENABLED
Physical disk cache enabled.
* lsm.Volume.PHYSICAL_DISK_CACHE_DISABLED
Physical disk cache disabled.
* lsm.Volume.PHYSICAL_DISK_CACHE_USE_DISK_SETTING
Physical disk cache is determined by the disk vendor
via physical disks' SCSI caching mode page(0x08 page).
It is strongly suggested to change this value to
lsm.Volume.PHYSICAL_DISK_CACHE_ENABLED or
lsm.Volume.PHYSICAL_DISK_CACHE_DISABLED
* lsm.Volume.PHYSICAL_DISK_CACHE_UNKNOWN
Plugin failed to detect the physical disk status.
SpecialExceptions:
LsmError
ErrorNumber.NO_SUPPORT
ErrorNumber.NOT_FOUND_VOLUME
Capability:
lsm.Capabilities.VOLUME_CACHE_INFO
tvolume_cache_info(R#R$RR%(RR}R!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�sRcCsO|tjkr3|tjkr3ttjd��n|jjdtt ���S(s�
lsm.Client.volume_physical_disk_cache_update(self, volume, pdc,
flags=lsm.Client.FLAG_RSVD)
Version:
1.3
Usage:
Change the setting of RAM physical disk cache of specified volume.
On some product(like HPE SmartArray), this action will be effective
at system level which means that even you are requesting a change
on a specified volume, this change will apply to all other volumes
on the same controller(system).
Parameters:
volume (Lsm.Volume)
The lsm.Volume instance.
pdc (int)
lsm.Volume.PHYSICAL_DISK_CACHE_ENABLED
Enable physical disk cache.
lsm.Volume.PHYSICAL_DISK_CACHE_DISABLED
Disable physical disk cache
flags (int, optional):
Reserved for future use. Should be set as lsm.Client.FLAG_RSVD
Returns:
N/A
SpecialExceptions:
LsmError
ErrorNumber.NO_SUPPORT
You might also get NO_SUPPORT error when trying
to change SSD physical disk cache on MegaRAID.
ErrorNumber.NOT_FOUND_VOLUME
Capability:
lsm.Capabilities.VOLUME_PHYSICAL_DISK_CACHE_SET
Allow changing physical disk cache.
lsm.Capabilities.VOLUME_PHYSICAL_DISK_CACHE_SET_SYSTEM_LEVEL
Indicate that this action will change system settings which
are effective on all volumes in this storage system.
For example, on HPE SmartArray, the physical disk cache
setting is a controller level setting.
s`Argument pdc should be Volume.PHYSICAL_DISK_CACHE_ENABLED or Volume.PHYSICAL_DISK_CACHE_DISABLEDt!volume_physical_disk_cache_update(
RtPHYSICAL_DISK_CACHE_ENABLEDtPHYSICAL_DISK_CACHE_DISABLEDRRRkR#R$RR%(RR}tpdcR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR�hs) cCs^|tjkrB|tjkrB|tjkrBttjd��n|jjdt t
���S(s�
lsm.Client.volume_write_cache_policy_update(self, volume, wcp,
flags=lsm.Client.FLAG_RSVD)
Version:
1.3
Usage:
Change the RAM write cache policy on specified volume.
If lsm.Capabilities.VOLUME_WRITE_CACHE_POLICY_SET_IMPACT_READ
is supported(e.g. HPE SmartArray), the changes on write cache
policy might also impact read cache policy.
If lsm.Capabilities.VOLUME_WRITE_CACHE_POLICY_SET_WB_IMPACT_OTHER
is supported(e.g. HPE SmartArray), changing write cache policy
to write back mode might impact other volumes in the same system.
Parameters:
volume (Lsm.Volume)
The lsm.Volume instance.
wcp (int)
Could be one of these value:
* lsm.Volume.WRITE_CACHE_POLICY_WRITE_BACK
Change to write back mode.
* lsm.Volume.WRITE_CACHE_POLICY_AUTO
Change to auto mode: use write back mode when
battery/capacitor is healthy, otherwise use write
through.
* lsm.Volume.WRITE_CACHE_POLICY_WRITE_THROUGH
Change to write through mode.
flags (int, optional):
Reserved for future use. Should be set as lsm.Client.FLAG_RSVD
Returns:
N/A
SpecialExceptions:
LsmError
ErrorNumber.NO_SUPPORT
ErrorNumber.NOT_FOUND_VOLUME
Capability:
lsm.Capabilities.VOLUME_WRITE_CACHE_POLICY_SET_WRITE_BACK
Allow changing to always mode.
lsm.Capabilities.VOLUME_WRITE_CACHE_POLICY_SET_AUTO
Allow changing to auto mode.
lsm.Capabilities.VOLUME_WRITE_CACHE_POLICY_SET_WRITE_THROUGH
Allow changing to disable mode.
lsm.Capabilities.VOLUME_WRITE_CACHE_POLICY_SET_IMPACT_READ
Indicate this action might impact read cache policy.
lsm.Capabilities.VOLUME_WRITE_CACHE_POLICY_SET_WB_IMPACT_OTHER
Indicate that changing to write back mode might impact other
volumes. For example, on HPE SmartArray, changing to write back
mode will change all other volumes with auto write cache policy
to write back mode.
s�Argument wcp should be Volume.WRITE_CACHE_POLICY_WRITE_BACK or Volume.WRITE_CACHE_POLICY_AUTO or Volume.WRITE_CACHE_POLICY_WRITE_THROUGHt volume_write_cache_policy_update(RtWRITE_CACHE_POLICY_WRITE_BACKtWRITE_CACHE_POLICY_AUTOt WRITE_CACHE_POLICY_WRITE_THROUGHRRRkR#R$RR%(RR}twcpR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��s4 cCsO|tjkr3|tjkr3ttjd��n|jjdtt ���S(s
lsm.Client.volume_read_cache_policy_update(self, volume, rcp,
flags=lsm.Client.FLAG_RSVD)
Version:
1.3
Usage:
Change the RAM read cache policy of specified volume.
If lsm.Capabilities.VOLUME_READ_CACHE_POLICY_SET_IMPACT_WRITE
is supported(like HPE SmartArray), the change on write cache policy
might also impact read cache policy.
Parameters:
volume (Lsm.Volume)
The lsm.Volume instance.
rcp (int)
Could be one of these value:
* lsm.Volume.READ_CACHE_POLICY_ENABLED
Enable read cache.
* lsm.Volume.READ_CACHE_POLICY_DISABLED
Disable read cache.
flags (int, optional):
Reserved for future use. Should be set as lsm.Client.FLAG_RSVD
Returns:
N/A
SpecialExceptions:
LsmError
ErrorNumber.NO_SUPPORT
ErrorNumber.NOT_FOUND_VOLUME
Capability:
lsm.Capabilities.VOLUME_READ_CACHE_POLICY_SET
Allow enabling or disabling read cache policy.
lsm.Capabilities.VOLUME_READ_CACHE_POLICY_SET_IMPACT_WRITE
Indicate that changing read cache policy might impact write
cache policy. For example, on HPE SmartArray, disabling read
cache will also change write cache policy to write through.
s\Argument rcp should be Volume.READ_CACHE_POLICY_ENABLED or Volume.READ_CACHE_POLICY_DISABLEDtvolume_read_cache_policy_update(
RtREAD_CACHE_POLICY_ENABLEDtREAD_CACHE_POLICY_DISABLEDRRRkR#R$RR%(RR}trcpR!((s//usr/lib/python2.7/site-packages/lsm/_client.pyR��s& iiiiN(_t__name__t
__module__t FLAG_RSVDt#FLAG_VOLUME_CREATE_USE_SYSTEM_CACHEt%FLAG_VOLUME_CREATE_USE_IO_PASSTHROUGHt'FLAG_VOLUME_CREATE_DISABLE_SYSTEM_CACHEt)FLAG_VOLUME_CREATE_DISABLE_IO_PASSTHROUGHR"RItstaticmethodR;R)RORMt_return_requiresRNR1tsixtstring_typesRXRYRiR[t_IDataR\R^RR_RQRRaRRdReRnRRvRwR|RR�R�R�R�R�RR�R�R�RR�R�R�R�R�R�R�tboolR�R�RR�R�R�R�R�R�R R�R�R�R3R�R�R�R�RR�tANON_UID_GID_NAR�R�RR�R�R�R�R�R�R�RR�R�R�R�R�(((s//usr/lib/python2.7/site-packages/lsm/_client.pyR@s
1
ag> � DS 2 > ("R*RftlsmRRRRRRRRRR R
RRR
Rtlsm._commonRR�RR=tlsm._transportRR/t lsm._dataRR�R�RRRR(((s//usr/lib/python2.7/site-packages/lsm/_client.pyt<module>sd
|