The cinder.volume.drivers.hitachi.hnas_backend Module

Hitachi Unified Storage (HUS-HNAS) platform. Backend operations.

class HNASSSHBackend(backend_opts)

Bases: object

add_iscsi_conn(*args, **kwargs)

Sets up the Logical Unit on the specified target port.

Parameters:
  • lu_name – id of the Logical Unit being extended
  • fs_label – data pool of the Logical Unit
  • port – iSCSI port
  • tgt_alias – iSCSI qualified name
  • initiator – initiator address
Returns:

dictionary (conn_info) with the connection information

conn_info={

‘lu’: Logical Unit ID, ‘iqn’: iSCSI qualified name, ‘lu_name’: Logical Unit name, ‘initiator’: iSCSI initiator, ‘fs_label’: File system to connect, ‘port’: Port to make the iSCSI connection

}
check_lu(vol_name, fs_label)

Checks if a given LU is already mapped

Parameters:
  • vol_name – name of the LU
  • fs_label – storage pool of the LU
Returns:

dictionary (lu_info) with LU information

lu_info={
‘mapped’: LU state (mapped or not), ‘id’: ID of the LU, ‘tgt’: the iSCSI target alias }
check_snapshot_parent(volume_path, snap_name, fs_label)

Check if a volume is the snapshot source

Parameters:
  • volume_path – path of the volume
  • snap_name – name of the snapshot
  • fs_label – filesystem label
Returns:

True if the volume is the snapshot’s source or False otherwise

check_target(fs_label, target_alias)

Checks if a given target exists and gets its info.

Parameters:
  • fs_label – pool name used
  • target_alias – alias of the target
Returns:

dictionary (tgt_info)

tgt_info={
‘alias’: The alias of the target, ‘found’: boolean to inform if the target was found or not, ‘tgt’: dictionary with the target information }
create_cloned_lu(src_lu, fs_label, clone_name)

Clones a Logical Unit

Clone primitive used to support all iSCSI snapshot/cloning functions.

Parameters:
  • src_lu – id of the Logical Unit being deleted
  • fs_label – data pool of the Logical Unit
  • clone_name – name of the snapshot
create_lu(fs_label, size, lu_name)

Creates a new Logical Unit.

If the operation can not be performed for some reason, utils.execute() throws an error and aborts the operation. Used for iSCSI only

Parameters:
  • fs_label – data pool the Logical Unit will be created
  • size – Size (GB) of the new Logical Unit
  • lu_name – name of the Logical Unit
create_target(tgt_alias, fs_label, secret)

Creates a new iSCSI target

Parameters:
  • tgt_alias – the alias with which the target will be created
  • fs_label – the label of the file system to create the target
  • secret – the secret for authentication of the target
del_iscsi_conn(evs_id, iqn, lu_id)

Removes the Logical Unit on the specified target port.

Parameters:
  • evs_id – EVSID for the file system
  • iqn – iSCSI qualified name
  • lu_id – Logical Unit id
delete_lu(fs_label, lu_name)

Deletes a Logical Unit.

Parameters:
  • fs_label – data pool of the Logical Unit
  • lu_name – id of the Logical Unit being deleted
extend_lu(fs_label, new_size, lu_name)

Extends an iSCSI volume.

Parameters:
  • fs_label – data pool of the Logical Unit
  • new_size – new size of the Logical Unit
  • lu_name – name of the Logical Unit
file_clone(fs_label, src, name)

Clones NFS files to a new one named ‘name’.

Clone primitive used to support all NFS snapshot/cloning functions.

Parameters:
  • fs_label – file system label of the new file
  • src – source file
  • name – target path of the new created file
get_cloned_file_relatives(file_path, fs_label, raise_except=False)

Gets the files related to a clone

Parameters:
  • file_path – path of the cloned file
  • fs_label – filesystem of the cloned file
  • raise_except – If True exception will be raised for files that

aren’t clones. If False, only an error message is logged. :returns: list with names of the related files

get_evs(fs_label)

Gets the EVS ID for the named filesystem.

Parameters:fs_label – The filesystem label related to the EVS required
Returns:EVS ID of the filesystem
get_evs_info()

Gets the IP addresses of all EVSs in HNAS.

Returns:dictionary with EVS information
evs_info={
<IP1>: {evs_number: number identifying the EVS1 on HNAS}, <IP2>: {evs_number: number identifying the EVS2 on HNAS}, ...

}

get_existing_lu_info(lu_name, fs_label=None, evs_id=None)

Gets the information for the specified Logical Unit.

Returns the information of an existing Logical Unit on HNAS, according to the name provided.

Parameters:
  • lu_name – label of the Logical Unit
  • fs_label – label of the file system
  • evs_id – ID of the EVS where the LU is located
Returns:

dictionary (lu_info) with LU information

lu_info={
‘name’: A Logical Unit name, ‘comment’: A comment about the LU, not used for Cinder, ‘path’: Path to LU inside filesystem, ‘size’: Logical Unit size returned always in GB (volume size), ‘filesystem’: File system where the Logical Unit was created, ‘fs_mounted’: Information about the state of file system (mounted or not), ‘lu_mounted’: Information about the state of Logical Unit (mounted or not) }
get_export_list()

Gets information on each NFS export.

Returns:a list of the exports configured on HNAS
get_export_path(export, fs_label)

Gets the path of an export on HNAS

Parameters:
  • export – the export’s name
  • fs_label – the filesystem name
Returns:

string of the export’s path

get_fs_info(fs_label)

Gets the information of a given FS.

Parameters:fs_label – Label of the filesystem
Returns:dictionary with FS information
fs_info={
‘id’: a Logical Unit ID, ‘label’: a Logical Unit name, ‘evs_id’: the ID of the EVS in which the filesystem is created (not present if there is a single EVS), ‘total_size’: the total size of the FS (in GB), ‘used_size’: the size that is already used (in GB), ‘available_size’: the free space (in GB) }
get_target_iqn(tgt_alias, fs_label)

Obtains the target full iqn

Returns the target’s full iqn rather than its alias.

Parameters:
  • tgt_alias – alias of the target
  • fs_label – data pool of the Logical Unit
Returns:

string with full IQN

get_target_secret(targetalias, fs_label)

Gets the chap secret for the specified target.

Parameters:
  • targetalias – alias of the target
  • fs_label – data pool of the Logical Unit
Returns:

CHAP secret of the target

get_version()

Gets version information from the storage unit.

Returns:dictionary with HNAS information
storage_version={
‘mac’: HNAS MAC ID, ‘model’: HNAS model, ‘version’: the software version, ‘hardware’: the hardware version, ‘serial’: HNAS serial number}
rename_existing_lu(fs_label, vol_name, new_name)

Renames the specified Logical Unit.

Renames an existing Logical Unit on HNAS according to the new name provided.
Parameters:
  • fs_label – label of the file system
  • vol_name – current name of the existing volume
  • new_name – new name to the existing volume
set_target_secret(targetalias, fs_label, secret)

Sets the chap secret for the specified target.

Parameters:
  • targetalias – alias of the target
  • fs_label – data pool of the Logical Unit
  • secret – CHAP secret of the target