The cinder.volume.drivers.inspur.instorage.instorage_common Module

The cinder.volume.drivers.inspur.instorage.instorage_common Module

class CLIParser(raw, ssh_cmd=None, delim='!', with_header=True)

Bases: object

Parse MCS CLI output and generate iterable.

static append_dict(dict_, key, value)
select(*keys)
class InStorageAssistant(run_ssh)

Bases: object

WAIT_TIME = 5
add_chap_secret_to_host(host_name)

Generate and store a randomly-generated CHAP secret for the host.

add_fc_wwpns(storage_nodes)

Add FC WWPNs to system node information.

add_iscsi_ip_addrs(storage_nodes)

Add iSCSI IP addresses to system node information.

add_vdisk_copy(vdisk, dest_pool, volume_type, state, config)

Add a vdisk copy in the given pool.

add_vdisk_qos(vdisk, qos)

Add the QoS configuration to the volume.

static build_default_opts(config)
static can_migrate_to_host(host, state)
change_vdisk_iogrp(vdisk, state, iogrp)
change_vdisk_options(vdisk, changes, opts, state)
change_vdisk_primary_copy(vdisk, copy_id)
check_host_mapped_vols(host_name)
check_vdisk_copy_synced(vdisk, copy_id)
static check_vdisk_opts(state, opts)
chpartnership(partnership_id)
compression_enabled()

Return whether or not compression is enabled for this system.

create_copy(src, tgt, src_id, config, opts, full_copy, pool=None)

Create a new snapshot using LocalCopy.

create_group_from_source(group, lc_group, sources, targets, state, config, timeout)

Create group from source

create_host(connector)

Create a new host on the storage system.

We create a host name and associate it with the given connection information. The host name will be a cleaned up version of the given host name (at most 55 characters), plus a random 8-character suffix to avoid collisions. The total length should be at most 63 characters.

create_lc_consistgrp(lc_consistgrp)
create_localcopy_to_consistgrp(source, target, consistgrp, config, opts, full_copy=False, pool=None)

Create a LocalCopy mapping and add to consistent group.

create_relationship(master, aux, system, asynccopy)
create_vdisk(name, size, units, pool, opts)
delete_consistgrp_snapshots(lc_consistgrp, snapshots)

Delete localcopy maps and consistent group.

delete_group_snapshots(lc_group, snapshots)

Delete localcopy maps and group.

delete_host(host_name)
delete_lc_consistgrp(lc_consistgrp)
delete_rc_volume(volume_name, target_vol=False)
delete_relationship(volume_name)
delete_vdisk(vdisk, force)

Ensures that vdisk is not part of FC mapping and deletes it.

disable_vdisk_qos(vdisk, qos)

Disable the QoS.

ensure_vdisk_no_lc_mappings(name, allow_snaps=True, allow_lctgt=False)

Ensure vdisk has no localcopy mappings.

extend_vdisk(vdisk, amount)
find_vdisk_copy_id(vdisk, pool)
get_available_io_groups()

Return list of available IO groups.

get_chap_secret_for_host(host_name)

Generate and store a randomly-generated CHAP secret for the host.

get_conn_fc_wwpns(host)
get_host_from_connector(connector, volume_name=None)

Return the InStorage host described by the connector.

get_node_info()

Return dictionary containing information on system’s nodes.

get_partnership_info(system_name)
get_partnershipcandidate_info(system_name)
get_pool_attrs(pool)

Return attributes for the specified pool.

get_relationship_info(volume_name)
get_system_info()

Return system’s name, ID, and code level.

get_vdisk_attributes(vdisk)
get_vdisk_copies(vdisk)
get_vdisk_copy_attrs(vdisk, copy_id)
get_vdisk_copy_ids(vdisk)
get_vdisk_count_by_io_group()
get_vdisk_params(config, state, type_id, volume_type=None, volume_metadata=None)

Return the parameters for creating the vdisk.

Get volume type and defaults from config options and take them into account.

get_volume_io_group(vol_name)
static handle_keyerror(cmd, out)
is_vdisk_defined(vdisk_name)

Check if vdisk is defined.

is_vdisk_in_use(vdisk)

Returns True if the specified vdisk is mapped to at least 1 host.

map_vol_to_host(volume_name, host_name, multihostmap)

Create a mapping between a volume to a host.

mcs_qos_keys = {'IOThrottling': {'default': '0', 'type': <type 'int'>, 'param': 'rate'}}
mkfcpartnership(system_name, bandwith=1000, copyrate=50)
mkippartnership(ip_v4, bandwith=1000, copyrate=50)
prepare_lc_consistgrp(lc_consistgrp, timeout)

Prepare LC Consistency Group.

rename_vdisk(vdisk, new_name)
replication_licensed()

Return whether or not replication is enabled for this system.

rm_vdisk_copy(vdisk, copy_id)
run_consistgrp_snapshots(lc_consistgrp, snapshots, state, config, timeout)
run_group_snapshots(lc_group, snapshots, state, config, timeout)
run_localcopy(source, target, timeout, copy_rate, full_copy=True)

Create a LocalCopy mapping from the source to the target.

select_io_group(state, opts)
start_lc_consistgrp(lc_consistgrp)
start_relationship(volume_name, primary=None)
stop_lc_consistgrp(lc_consistgrp)
stop_relationship(volume_name, access=False)
switch_relationship(relationship, aux=True)
unmap_vol_from_host(volume_name, host_name)

Unmap the volume and delete the host if it has no more mappings.

update_vdisk_qos(vdisk, qos)

Update all the QoS in terms of a key and value.

mcs_qos_keys saves all the supported QoS parameters. Going through this dict, we set the new values to all the parameters. If QoS is available in the QoS configuration, the value is taken from it; if not, the value will be set to default.

vdisk_by_uid(vdisk_uid)

Returns the properties of the vdisk with the specified UID.

Returns None if no such disk exists.

class InStorageMCSCommonDriver(*args, **kwargs)

Bases: cinder.volume.driver.VolumeDriver, cinder.volume.drivers.san.san.SanDriver

Inspur InStorage MCS abstract base class for iSCSI/FC volume drivers.

Version history:

1.0 - Initial driver
DEFAULT_GR_SLEEP = 1.37
VDISKCOPYOPS_INTERVAL = 600
VERSION = '1.0.0'
add_vdisk_copy(volume, dest_pool, vol_type)
check_for_setup_error(*args, **kwargs)

Ensure that the flags are set properly.

create_cloned_volume(tgt_volume, src_volume)

Creates a clone of the specified volume.

create_export(ctxt, volume, connector)
create_group(context, group)

Create a group.

Inspur InStorage will create group until group-snapshot creation, db will maintain the volumes and group relationship.

create_group_from_src(context, group, volumes, group_snapshot=None, snapshots=None, source_group=None, source_vols=None)

Creates a group from source.

Parameters:
  • context – the context of the caller.
  • group – the dictionary of the group to be created.
  • volumes – a list of volume dictionaries in the group.
  • group_snapshot – the dictionary of the group_snapshot as source.
  • snapshots – a list of snapshot dictionaries in the group_snapshot.
  • source_group – the dictionary of a group as source.
  • source_vols – a list of volume dictionaries in the source_group.
Returns:

model_update, volumes_model_update

create_group_snapshot(ctxt, group_snapshot, snapshots)

Creates a cgsnapshot.

create_snapshot(snapshot)
create_volume(*args, **kwargs)
create_volume_from_snapshot(volume, snapshot)
delete_group(context, group, volumes)

Deletes a group.

Inspur InStorage will delete the volumes of the group.

delete_group_snapshot(context, group_snapshot, snapshots)

Deletes a cgsnapshot.

delete_snapshot(snapshot)
delete_volume(*args, **kwargs)
do_setup(*args, **kwargs)

Check that we have all configuration details from the storage.

ensure_export(ctxt, volume)

Check that the volume exists on the storage.

extend_volume(volume, new_size)
failover_host(*args, **kwargs)
get_pool(volume)
get_volume_stats(refresh=False)

Get volume stats.

If we haven’t gotten stats yet or ‘refresh’ is True, run update the stats first.

manage_existing(volume, ref)

Manages an existing vdisk.

Renames the vdisk to match the expected name for the volume. Error checking done by manage_existing_get_size is not repeated - if we got here then we have a vdisk that isn’t in use (or we don’t care if it is in use.

manage_existing_get_size(volume, ref)

Return size of an existing Vdisk for manage_existing.

existing_ref is a dictionary of the form: {‘source-id’: <uid of disk>} or {‘source-name’: <name of the disk>}

Optional elements are:
‘manage_if_in_use’: True/False (default is False)
If set to True, a volume will be managed even if it is currently attached to a host system.
migrate_volume(*args, **kwargs)

Migrate directly if source and dest are managed by same storage.

We create a new vdisk copy in the desired pool, and add the original vdisk copy to the admin_metadata of the volume to be deleted. The deletion will occur using a periodic task once the new copy is synced.

Parameters:
  • ctxt – Context
  • volume – A dictionary describing the volume to migrate
  • host – A dictionary describing the host to migrate to, where host[‘host’] is its name, and host[‘capabilities’] is a dictionary of its reported capabilities.
remove_export(ctxt, volume)
retype(*args, **kwargs)

Convert the volume to be of the new type.

Returns a boolean indicating whether the retype occurred.

Parameters:
  • ctxt – Context
  • volume – A volume object describing the volume to migrate
  • new_type – A dictionary describing the volume type to convert to
  • diff – A dictionary with the difference between the two types
  • host – A dictionary describing the host to migrate to, where host[‘host’] is its name, and host[‘capabilities’] is a dictionary of its reported capabilities.
unmanage(volume)

Remove the specified volume from Cinder management.

update_group(ctxt, group, add_volumes=None, remove_volumes=None)

Adds or removes volume(s) to/from an existing group.

update_migrated_volume(ctxt, volume, new_volume, original_volume_status)

Return model update from InStorage for migrated volume.

This method should rename the back-end volume name(id) on the destination host back to its original name(id) on the source host.

Parameters:
  • ctxt – The context used to run the method update_migrated_volume
  • volume – The original volume that was migrated to this backend
  • new_volume – The migration volume object that was created on this backend as part of the migration process
  • original_volume_status – The status of the original volume
Returns:

model_update to update DB with any needed changes

class InStorageSSH(run_ssh)

Bases: object

SSH interface to Inspur InStorage systems.

add_chap_secret(secret, host)
addhostport(host, port_type, port_name)
addvdiskaccess(vdisk, iogrp)
addvdiskcopy(vdisk, dest_pool, params)
chlcmap(lc_map_id, copyrate='50', autodel='on')
chpartnership(partnership_id, start=True)
chvdisk(vdisk, params)
expandvdisksize(vdisk, amount)
get_vdiskhostmapid(vdisk, host)
lsfabric(wwpn=None, host=None)
lsguicapabilities()
lshost(host=None)
lshostvdiskmap(host)
lsiogrp()
lsiscsiauth()
lslcconsistgrp(lc_consistgrp)
lslcmap(lc_map_id)
lslicense()
lsmdiskgrp(pool)
lsnode(node_id=None)
lspartnership(system_name)
lspartnershipcandidate()
lsportfc(node_id)
lsportip()
lsrcrelationship(rc_rel)
lssystem()
lsvdisk(vdisk)

Return vdisk attributes or None if it doesn’t exist.

lsvdiskcopy(vdisk, copy_id=None)
lsvdiskhostmap(vdisk)
lsvdisklcmappings(vdisk)
lsvdisks_from_filter(filter_name, value)

Performs an lsvdisk command, filtering the results as specified.

Returns an iterable for all matching vdisks.

lsvdisksyncprogress(vdisk, copy_id)
mkfcpartnership(system_name, bandwith=1000, backgroundcopyrate=50)
mkhost(host_name, port_type, port_name)
mkippartnership(ip_v4, bandwith=1000, backgroundcopyrate=50)
mklcconsistgrp(lc_consist_group)
mklcmap(source, target, full_copy, copy_rate, consistgrp=None)
mkrcrelationship(master, aux, system, asynccopy)
mkvdisk(name, size, units, pool, opts, params)
mkvdiskhostmap(host, vdisk, lun, multihostmap)

Map vdisk to host.

If vdisk already mapped and multihostmap is True, use the force flag.

movevdisk(vdisk, iogrp)
prestartlcconsistgrp(lc_consist_group)
prestartlcmap(lc_map_id)
rmhost(host)
rmlcconsistgrp(lc_consist_group)
rmlcmap(lc_map_id)
rmrcrelationship(relationship, force=False)
rmvdisk(vdisk, force=True)
rmvdiskaccess(vdisk, iogrp)
rmvdiskcopy(vdisk, copy_id)
rmvdiskhostmap(host, vdisk)
run_ssh_assert_no_output(ssh_cmd)

Run an SSH command and assert no output returned.

run_ssh_check_created(ssh_cmd)

Run an SSH command and return the ID of the created object.

run_ssh_inq(ssh_cmd, delim='!', with_header=False)

Run an SSH command and return parsed output.

startlcconsistgrp(lc_consist_group)
startlcmap(lc_map_id)
startrcrelationship(rc_rel, primary=None)
stoplcconsistgrp(lc_consist_group)
stoplcmap(lc_map_id)
stoprcrelationship(relationship, access=False)
switchrelationship(relationship, aux=True)
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.