a Vd@@sddlZddlZddlZddlmZddlmZmZmZm Z m Z m Z m Z m Z mZmZmZmZmZmZmZddlmZddlmZddlmZddlmZddl Z dd Z!d d Z"d d Z#GdddeZ$dS)N)S_ISSOCK)Volume NfsExport CapabilitiesPoolSystemBatteryDisk AccessGroup FileSystem FsSnapshot uri_parseLsmError ErrorNumberINetworkAttachedStorage TargetPort)return_requires)UDS_PATH) TransPort)IDatacCs |d=|S)z Used to remove the self key from the dict d. Self is included when calling the function locals() in a class method. self)drr1/usr/lib64/python3.9/site-packages/lsm/_client.py _del_selfsrcCs |r||vrttjd|dS)NzUnsupported search_key: '%s')rrZUNSUPPORTED_SEARCH_KEY) search_keyZsupported_keysrrr_check_search_key#s  rcCsttjddS)NzRThe libStorageMgmt daemon is not running (process name lsmd), please start service)rrZDAEMON_NOT_RUNNINGrrrr_raise_no_daemon+src@s2eZdZdZdZdZdZdZdddZddd Z e d d Z e d d Z dddZ edefddZedefddZe eejdgdefddZedefddZeeefddZeeeeefddZedefdd Zeeefd!d"Zeejdejdefd#d$Zeegddefd%d&Zeegefd'd(Z edefd)d*Z!edefd+d,Z"ee#gddefd-d.Z$eejde#efd/d0Z%eejde#efd1d2Z&eejde#efd3d4Z'eeefd5d6Z(eejdefd7d8Z)eejdefd9d:Z*edefd;d<Z+edefd=d>Z,ee-gddefd?d@Z.edefdAdBZ/edefdCdDZ0ee1gddefdEdFZ2ee1efdGdHZ3edefdIdJZ4ee1efdKdLZ5ee1efdMdNZ6ee#gefdOdPZ7ee1gefdQdRZ8ee9efdSdTZ:eejdefdUdVZ;eeeejde<efd[d\Z?eejde<efd]d^Z@eejde<defd_d`ZAeejddefdadbZBeeCgefdcddZDeejdeCefdedfZEeejdefdgdhZFeejddiefdjdkZGee9efdldmZHeejdefdndoZIeejdgefdpdqZJeeKgddefdrdsZLeeKeKjMeKjMddefdtduZNedefdvdwZOeePgddefdxdyZQeeeeeegefdzd{ZReeeejdggefd|d}ZSeegeggefd~dZTee#efddZUedefddZVedefddZWeeXgddefddZYeeeeeegefddZZedefddZ[edefddZ\edefddZ]dS)ClientrcCs tddS)NzDo not call directly!) RuntimeError)ruriplain_text_password timeout_msflagsrrrplugin_registerJszClient.plugin_registercCs|jdttdS)z3 Instruct the plug-in to get ready r(N_tprpcrlocals)rr$passwordtimeoutr'rrrZ__startTszClient.__startc Csxt}tj|rtt|D]R\}}}|D]B}tj||}zt|}| WdSt ylYq,0q,qndS)NTF) r_plugin_uds_pathospathexistswalkjoin _TransPort get_socketcloser)uds_pathroot sub_foldersfilesfilenameudssrrr_check_daemon_exists^s     zClient._check_daemon_existscCst}dtjvrtjd}|S)NZ LSM_UDS_PATH) _UDS_PATHr0environ)rcrrrr/rs  zClient._plugin_uds_pathN0uc Cs ||_||_||_t|_t|dg}|d}d|vrJ|d\}}|}t d} | rz t t t | t jt j|_Wn8ty} z ttjdt| WYd} ~ n d} ~ 00nXtj|j||_tj|jrt t |j|_n$trttjd|jnt|||||dS)Nscheme+ZLSMCLI_DEBUG_FDzLSMCLI_DEBUG_FD: %szPlug-in %s not found!)Z_uriZ _password_timeoutrr/Z _uds_pathr splitr0getenvr5socketZfromfdintZAF_UNIXZ SOCK_STREAMr* ExceptionrrINVALID_ARGUMENTstrr1r4Z plugin_pathr2r6r?ZPLUGIN_NOT_EXISTr_Client__start) rr$r%r&r'urDZplugprotoZdebug_fderrr__init__s<      zClient.__init__cCs||dS)z$ Synonym for close. N)r7rr'rrrplugin_unregisterszClient.plugin_unregistercCs(|jdtt|jd|_dS)zB Does an orderly plugin_unregister of the plug-in rTN)r*r+rr,r7rSrrrr7s z Client.close:c Csg}tstt}t|D]x\}}}|D]h}tj||}t|j } t | sZq2t t |} | dt|d\} } |d| || f| q2q$|S)z Retrieves all the available plug-ins Return list of strings of available plug-ins with the "descversion" plugin_info)r'z%s%s%s)rr?rr/r0r3r1r4statst_moderr5r6r+dictappendr7) Z field_sepr'rBr8r9r:r;r<r=modetpivrrravailable_pluginss   zClient.available_pluginscCs|jdttS)zr Sets any time-outs for the plug-in (ms) Return None on success, else LsmError exception time_out_setr))rmsr'rrrr`szClient.time_out_setcCs|jdttS)zd Retrieves the current time-out Return time-out in ms, else raise LsmError time_out_getr)rSrrrrbszClient.time_out_getcCs|jdttS)z Returns the stats of the given job. Returns a tuple ( status (enumeration), percent_complete, completed item). else LsmError exception. job_statusr)rZjob_idr'rrrrcs zClient.job_statuscCs|jdttS)zs Frees resources for a given job number. Returns None on success, else raises an LsmError job_freer)rdrrrreszClient.job_freecCs|jdttS)zv Fetches the capabilities of the array Returns a capability object, see data,py for details. capabilitiesr)rsystemr'rrrrf"szClient.capabilitiescCs|jdttS)z> Returns a description and version of plug-in rVr)rSrrrrV/szClient.plugin_infocCs t|tj|jdttS)z 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. pools)rrSUPPORTED_SEARCH_KEYSr*r+rr,rrZ search_valuer'rrrri<s z Client.poolscCs|jdttS)z 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 systemsr)rSrrrrlIszClient.systemscCsptjddkr*t|ttfs@ttjdnt|ts@ttjd|dksP|dkr\ttjd|j dt t S)a 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: rr z&Invalid read_pct, should be an integerdz,Invalid read_pct, should be in range 0 - 100system_read_cache_pct_update) sys version_info isinstancerJZlongrrrLr*r+rr,)rrhZread_pctr'rrrrnXs  z#Client.system_read_cache_pct_updatecCs&tj|tjdd|jdttS)zg Register a user/password for the specified initiator for CHAP authentication. TZraise_exceptioniscsi_chap_auth)r initiator_id_verifyZINIT_TYPE_ISCSI_IQNr*r+rr,)rinit_idZin_userZ in_passwordZout_userZ out_passwordr'rrrrss zClient.iscsi_chap_authcCs t|tj|jdttS)z4 Returns an array of volume objects volumes)rrrjr*r+rr,rkrrrrvs zClient.volumescCs|jdttS)z 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. volume_creater))rpoolZ volume_name size_bytesZ provisioningr'rrrrwszClient.volume_createcCs|jdttS)z 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. volume_resizer))rvolumenew_size_bytesr'rrrrzs zClient.volume_resizecCs|jdttS)z 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. volume_replicater))rrxrep_type volume_srcnamer'rrrr}szClient.volume_replicatecCs|jdttS)zB Returns the size of a replicated block in bytes. !volume_replicate_range_block_sizer)rgrrrrsz(Client.volume_replicate_range_block_sizecCs|jdttS)a- 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. volume_replicate_ranger))rr~rZ volume_destZrangesr'rrrrszClient.volume_replicate_rangecCs|jdttS)zQ Deletes a volume. Returns None on success, else job id volume_deleter)rr{r'rrrrszClient.volume_deletecCs|jdttS)zx Makes a volume available to the host returns None on success, else raises LsmError on errors. volume_enabler)rrrrr(szClient.volume_enablecCs|jdttS)zz Makes a volume unavailable to the host returns None on success, else raises LsmError on errors. volume_disabler)rrrrr6szClient.volume_disablecCs t|tj|jdttS)z2 Returns an array of disk objects disks)rr rjr*r+rr,rkrrrrHs z Client.diskscCs|jdttS)z< Allows an access group to access a volume. volume_maskr)r access_groupr{r'rrrrVszClient.volume_maskcCs|jdttS)zA Revokes access for an access group for a volume volume_unmaskr)rrrrrcszClient.volume_unmaskcCs t|tj|jdttS)z1 Returns a list of access groups access_groups)rr rjr*r+rr,rkrrrrps zClient.access_groupscCs0tj||dddd\}}|jdttS)zs Creates an access group and add the specified initiator id, init_type and desired access. TrrrNaccess_group_creater rtr*r+rr,)rrru init_typerhr'rrrrs zClient.access_group_createcCs|jdttS)z) Deletes an access group access_group_deleter)rrr'rrrrszClient.access_group_deletecCs0tj||dddd\}}|jdttS)z6 Adds an initiator to an access group TrrrNaccess_group_initiator_addrrrrurr'rrrrs z!Client.access_group_initiator_addcCs(tj|dddd}|jdttS)z; Deletes an initiator from an access group NTrrr access_group_initiator_deleterrrrrrs z$Client.access_group_initiator_deletecCs|jdttS)zN Returns the list of volumes that access group has access to. "volumes_accessible_by_access_groupr)rrrrrsz)Client.volumes_accessible_by_access_groupcCs|jdttS)ze Returns the list of access groups that have access to the specified volume. access_groups_granted_to_volumer)rrrrrsz&Client.access_groups_granted_to_volumecCs|jdttS)z 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. volume_child_dependencyr)rrrrrszClient.volume_child_dependencycCs|jdttS)a 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. volume_child_dependency_rmr)rrrrrs z!Client.volume_child_dependency_rmcCs t|tj|jdttS)zC Returns a list of file systems on the controller. fs)rr rjr*r+rr,rkrrrrs z Client.fscCs|jdttS)z WARNING: Destructive Deletes a file system and everything it contains Returns None on success, else job id fs_deleter)rrr'rrrrszClient.fs_deletecCs|jdttS)z 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. fs_resizer))rrr|r'rrrr,s zClient.fs_resizecCs|jdttS)a  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. fs_creater))rrxrryr'rrrr?s zClient.fs_createcCs|jdttS)a# 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. fs_cloner))rZsrc_fsZ dest_fs_namesnapshotr'rrrrRs zClient.fs_clonecCs|jdttS)z 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 fs_file_cloner))rrZ src_file_nameZdest_file_namerr'rrrrgszClient.fs_file_clonecCs|jdttS)zO Returns a list of snapshot names for the supplied file system fs_snapshotsr)rrrrr|szClient.fs_snapshotscCs|jdttS)a| 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. fs_snapshot_creater))rrZ snapshot_namer'rrrrszClient.fs_snapshot_createcCs|jdttS)z Frees the re-sources for the given snapshot on the supplied filesystem. Returns None on success else job id, LsmError exception on error fs_snapshot_deleter))rrrr'rrrrszClient.fs_snapshot_deleteFcCs|jdttS)a6 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 fs_snapshot_restorer))rrrr;Z restore_filesZ all_filesr'rrrrszClient.fs_snapshot_restorecCs|jdttS)a& 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. fs_child_dependencyr)rrr;r'rrrrszClient.fs_child_dependencycCs|jdttS)a 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. fs_child_dependency_rmr)rrrrrs zClient.fs_child_dependency_rmcCs|jdttS)zH What types of NFS client authentication are supported. export_authr)rSrrrrszClient.export_authcCs t|tj|jdttS)zL Get a list of all exported file systems on the controller. exports)rrrjr*r+rr,rkrrrrs zClient.exportsc Cs8t|t|t|r$ttjd|jdttS)zD Exports a filesystem as specified in the arguments z(Host cannot both in rw_list and ro_list. export_fs)setrrrLr*r+rr,) rZfs_idZ export_pathZ root_listZrw_listZro_listZanon_uidZanon_gidZ auth_typeoptionsr'rrrrs zClient.export_fscCs|jdttS)z. Removes the specified export export_remover))rZexportr'rrrr,szClient.export_removecCs t|tj|jdttS)z0 Returns a list of target ports target_ports)rrrjr*r+rr,rkrrrr9s zClient.target_portscCs|jdttS)aQuery 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. volume_raid_infor)rrrrrJs[zClient.volume_raid_infocCs|jdttS)a? 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 pool_member_infor))rrxr'rrrrs`zClient.pool_member_infocCs|jdttS)a 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. volume_raid_create_cap_getr)rgrrrrs5z!Client.volume_raid_create_cap_getcCs"t|dkrttjd|tjkr:t|dkr:ttjd|tjkr\t|dkr\ttjd|tjkr~t|dkr~ttjd|tjkrt|dst|dkrttjd |tj krt|dst|d krttjd |tj krt|dst|d krttjd |j dt tS)a 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. rz.Illegal input disks argument: no disk includedr z7Illegal input disks argument: RAID 1 only allow 2 disksz|tjkr*|tjkr*|tjkr*ttjd|jdt t S)a 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. zArgument wcp should be Volume.WRITE_CACHE_POLICY_WRITE_BACK or Volume.WRITE_CACHE_POLICY_AUTO or Volume.WRITE_CACHE_POLICY_WRITE_THROUGH volume_write_cache_policy_update) rZWRITE_CACHE_POLICY_WRITE_BACKZWRITE_CACHE_POLICY_AUTOZ WRITE_CACHE_POLICY_WRITE_THROUGHrrrLr*r+rr,)rr{Zwcpr'rrrrs4 z'Client.volume_write_cache_policy_updatecCs4|tjkr |tjkr ttjd|jdtt S)a 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. z\Argument rcp should be Volume.READ_CACHE_POLICY_ENABLED or Volume.READ_CACHE_POLICY_DISABLEDvolume_read_cache_policy_update) rZREAD_CACHE_POLICY_ENABLEDZREAD_CACHE_POLICY_DISABLEDrrrLr*r+rr,)rr{Zrcpr'rrrrs& z&Client.volume_read_cache_policy_update)r)r)NrCr)^__name__ __module__ __qualname__Z FLAG_RSVDZ#FLAG_VOLUME_CREATE_USE_SYSTEM_CACHEZ%FLAG_VOLUME_CREATE_USE_IO_PASSTHROUGHZ'FLAG_VOLUME_CREATE_DISABLE_SYSTEM_CACHEZ)FLAG_VOLUME_CREATE_DISABLE_IO_PASSTHROUGHr(rN staticmethodr?r/rR_return_requiresrTr7sixZ string_typesr_r`rJrb_IDatarcrerrfrVrrirrlrnrsrrvrwrzr}rrrrrr rrrr rrrrrrrboolrrr rrrrrrr rrrrrrrrrZANON_UID_GID_NArrrrrrrrrrrrrrrrrrrrr9sJ    -  "      1                               ag>  DS2>r)%r0rorIrWrZlsmrrrrrrr r r r r rrrrZ lsm._commonrrrr@Zlsm._transportrr5Z lsm._datarrrrrrrrrrrs D