The cinder.volume.drivers.ibm.storwize_svc.storwize_svc_common Module

class CLIResponse(raw, ssh_cmd=None, delim=’!’, with_header=True)

Bases: object

Parse SVC CLI output and generate iterable.

static append_dict(dict_, key, value)
select(*keys)
class StorwizeHelpers(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, auto_delete=False)

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)
static check_vdisk_opts(state, opts)
chpartnership(partnership_id)
compression_enabled()

Return whether or not compression is enabled for this system.

create_cg_from_source(group, fc_consistgrp, sources, targets, state, config, timeout)

Create consistence group from source

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

Create a new snapshot using FlashCopy.

create_fc_consistgrp(fc_consistgrp)
create_flashcopy_to_consistgrp(source, target, consistgrp, config, opts, full_copy=False, pool=None)

Create a FlashCopy mapping and add to consistent group.

create_host(connector, iscsi=False)

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_relationship(master, aux, system, asyncmirror)
create_vdisk(name, size, units, pool, opts)
delete_consistgrp_snapshots(fc_consistgrp, snapshots)

Delete flashcopy maps and consistent group.

delete_fc_consistgrp(fc_consistgrp)
delete_host(host_name)
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_fc_mappings(name, allow_snaps=True, allow_fctgt=False)

Ensure vdisk has no flashcopy 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, iscsi=False)

Return the Storwize 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_count_by_io_group()
get_vdisk_params(config, state, type_id, volume_type=None, volume_metadata=None)

Return the parameters for creating the vdisk.

Takes volume type and defaults from config options into account.

get_volume_io_group(vol_name)
static handle_keyerror(cmd, out)
is_pool_defined(pool_name)

Check if vdisk is defined.

is_vdisk_copy_synced(vdisk, copy_id)
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.

lsvdiskcopy(vdisk, copy_id=None)
map_vol_to_host(volume_name, host_name, multihostmap)

Create a mapping between a volume to a host.

migratevdisk(vdisk, dest_pool, copy_id=‘0’)
mkfcpartnership(system_name, bandwith=1000, copyrate=50)
mkippartnership(ip_v4, bandwith=1000, copyrate=50)
prepare_fc_consistgrp(fc_consistgrp, timeout)

Prepare FC 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(fc_consistgrp, snapshots, state, config, timeout)
run_flashcopy(source, target, timeout, copy_rate, full_copy=True)

Create a FlashCopy mapping from the source to the target.

select_io_group(state, opts)
start_fc_consistgrp(fc_consistgrp)
start_relationship(volume_name, primary=None)
stop_fc_consistgrp(fc_consistgrp)
stop_relationship(volume_name, access=False)
svc_qos_keys = {‘IOThrottling’: {‘default’: ‘0’, ‘type’: <type ‘int’>, ‘param’: ‘rate’}}
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.

svc_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 StorwizeSSH(run_ssh)

Bases: object

SSH interface to IBM Storwize family and SVC storage systems.

add_chap_secret(secret, host)
addhostport(host, port_type, port_name)
addvdiskaccess(vdisk, iogrp)
addvdiskcopy(vdisk, dest_pool, params, auto_delete)
chfcmap(fc_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)
lsfcconsistgrp(fc_consistgrp)
lsfcmap(fc_map_id)
lsguicapabilities()
lshost(host=None)
lshostvdiskmap(host)
lsiogrp()
lsiscsiauth()
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)
lsvdiskfcmappings(vdisk)
lsvdiskhostmap(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)
migratevdisk(vdisk, dest_pool, copy_id=‘0’)
mkfcconsistgrp(fc_consist_group)
mkfcmap(source, target, full_copy, copy_rate, consistgrp=None)
mkfcpartnership(system_name, bandwith=1000, backgroundcopyrate=50)
mkhost(host_name, port_type, port_name)
mkippartnership(ip_v4, bandwith=1000, backgroundcopyrate=50)
mkrcrelationship(master, aux, system, asyncmirror)
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)
prestartfcconsistgrp(fc_consist_group)
prestartfcmap(fc_map_id)
rmfcconsistgrp(fc_consist_group)
rmfcmap(fc_map_id)
rmhost(host)
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_info(ssh_cmd, delim=’!’, with_header=False)

Run an SSH command and return parsed output.

startfcconsistgrp(fc_consist_group)
startfcmap(fc_map_id)
startrcrelationship(rc_rel, primary=None)
stopfcconsistgrp(fc_consist_group)
stopfcmap(fc_map_id)
stoprcrelationship(relationship, access=False)
switchrelationship(relationship, aux=True)
class StorwizeSVCCommonDriver(*args, **kwargs)

Bases: cinder.volume.drivers.san.san.SanDriver, cinder.volume.driver.ManageableVD, cinder.volume.driver.MigrateVD, cinder.volume.driver.CloneableImageVD

IBM Storwize V7000 SVC abstract base class for iSCSI/FC volume drivers.

Version history:

1.0 - Initial driver
1.1 - FC support, create_cloned_volume, volume type support,
      get_volume_stats, minor bug fixes
1.2.0 - Added retype
1.2.1 - Code refactor, improved exception handling
1.2.2 - Fix bug #1274123 (races in host-related functions)
1.2.3 - Fix Fibre Channel connectivity: bug #1279758 (add delim
        to lsfabric, clear unused data from connections, ensure
        matching WWPNs by comparing lower case
1.2.4 - Fix bug #1278035 (async migration/retype)
1.2.5 - Added support for manage_existing (unmanage is inherited)
1.2.6 - Added QoS support in terms of I/O throttling rate
1.3.1 - Added support for volume replication
1.3.2 - Added support for consistency group
1.3.3 - Update driver to use ABC metaclasses
2.0 - Code refactor, split init file and placed shared methods
      for FC and iSCSI within the StorwizeSVCCommonDriver class
2.1 - Added replication V2 support to the global/metro mirror
      mode
2.1.1 - Update replication to version 2.1
DEFAULT_GR_SLEEP = 4.26
VDISKCOPYOPS_INTERVAL = 600
VERSION = ‘2.1.1’
add_vdisk_copy(volume, dest_pool, vol_type, auto_delete=False)
check_for_setup_error()

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)

Creates a group.

Parameters:
  • context – the context of the caller.
  • group – the group object.
Returns:

model_update

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 Group object to be created.
  • volumes – a list of Volume objects in the group.
  • group_snapshot – the GroupSnapshot object as source.
  • snapshots – a list of snapshot objects in group_snapshot.
  • source_group – the Group object as source.
  • source_vols – a list of volume objects in the source_group.
Returns:

model_update, volumes_model_update

create_group_snapshot(context, group_snapshot, snapshots)

Creates a group_snapshot.

Parameters:
  • context – the context of the caller.
  • group_snapshot – the GroupSnapshot object to be created.
  • snapshots – a list of Snapshot objects in the group_snapshot.
Returns:

model_update, snapshots_model_update

create_replica_test_volume(tgt_volume, src_volume)
create_snapshot(snapshot)
create_volume(volume)
create_volume_from_snapshot(volume, snapshot)
delete_group(context, group, volumes)

Deletes a group.

Parameters:
  • context – the context of the caller.
  • group – the group object.
  • volumes – a list of volume objects in the group.
Returns:

model_update, volumes_model_update

delete_group_snapshot(context, group_snapshot, snapshots)

Deletes a group_snapshot.

Parameters:
  • context – the context of the caller.
  • group_snapshot – the GroupSnapshot object to be deleted.
  • snapshots – a list of snapshot objects in the group_snapshot.
Returns:

model_update, snapshots_model_update

delete_snapshot(snapshot)
delete_volume(volume)
do_setup(ctxt)

Check that we have all configuration details from the storage.

ensure_export(ctxt, volume)

Check that the volume exists on the storage.

The system does not “export” volumes as a Linux iSCSI target does, and therefore we just check that the volume exists on the storage.

extend_volume(volume, new_size)
failover_host(context, volumes, secondary_id=None)
get_pool(volume)
get_replication_status(ctxt, 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(ctxt, volume, host)

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.
promote_replica(ctxt, volume)
reenable_replication(ctxt, volume)
remove_export(ctxt, volume)
retype(ctxt, volume, new_type, diff, host)

Convert the volume to be of the new type.

Returns a boolean indicating whether the retype occurred.

Parameters:
  • ctxt – Context
  • volume – A dictionary 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(context, group, add_volumes=None, remove_volumes=None)

Updates a group.

Parameters:
  • context – the context of the caller.
  • group – the group object.
  • add_volumes – a list of volume objects to be added.
  • remove_volumes – a list of volume objects to be removed.
Returns:

model_update, add_volumes_update, remove_volumes_update

update_migrated_volume(ctxt, volume, new_volume, original_volume_status)

Return model update from Storwize 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