8 changed files with 1268 additions and 331 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,165 @@
|
||||
# Copyright 2021 toyou Corp. |
||||
# All Rights Reserved. |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may |
||||
# not use this file except in compliance with the License. You may obtain |
||||
# a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
||||
# License for the specific language governing permissions and limitations |
||||
# under the License. |
||||
|
||||
""" |
||||
acs5000 FC driver |
||||
""" |
||||
|
||||
from oslo_log import log as logging |
||||
|
||||
from cinder import exception |
||||
from cinder.i18n import _ |
||||
from cinder import interface |
||||
from cinder import utils |
||||
from cinder.volume.drivers.toyou.acs5000 import acs5000_common |
||||
from cinder.zonemanager import utils as zone_utils |
||||
|
||||
LOG = logging.getLogger(__name__) |
||||
|
||||
|
||||
@interface.volumedriver |
||||
class Acs5000FCDriver(acs5000_common.Acs5000CommonDriver): |
||||
"""TOYOU ACS5000 storage FC volume driver. |
||||
|
||||
.. code-block:: none |
||||
|
||||
Version history: |
||||
1.0.0 - Initial driver |
||||
|
||||
""" |
||||
|
||||
VENDOR = 'TOYOU' |
||||
VERSION = '1.0.0' |
||||
PROTOCOL = 'FC' |
||||
|
||||
# ThirdPartySystems wiki page |
||||
CI_WIKI_NAME = 'TOYOU_ACS5000_CI' |
||||
|
||||
def __init__(self, *args, **kwargs): |
||||
super(Acs5000FCDriver, self).__init__(*args, **kwargs) |
||||
self.protocol = self.PROTOCOL |
||||
|
||||
@staticmethod |
||||
def get_driver_options(): |
||||
return acs5000_common.Acs5000CommonDriver.get_driver_options() |
||||
|
||||
def _get_connected_wwpns(self): |
||||
fc_ports = self._cmd.ls_fc() |
||||
connected_wwpns = [] |
||||
for port in fc_ports: |
||||
if 'wwpn' in port: |
||||
connected_wwpns.append(port['wwpn']) |
||||
elif 'WWPN' in port: |
||||
connected_wwpns.append(port['WWPN']) |
||||
return connected_wwpns |
||||
|
||||
def validate_connector(self, connector): |
||||
"""Check connector for at least one enabled FC protocol.""" |
||||
if 'wwpns' not in connector: |
||||
LOG.error('The connector does not ' |
||||
'contain the required information.') |
||||
raise exception.InvalidConnectorException( |
||||
missing='wwpns') |
||||
|
||||
@utils.synchronized('acs5000A-host', external=True) |
||||
def initialize_connection(self, volume, connector): |
||||
LOG.debug('enter: initialize_connection: volume ' |
||||
'%(vol)s with connector %(conn)s', |
||||
{'vol': volume.id, 'conn': connector}) |
||||
volume_name = self._convert_name(volume.name) |
||||
ret = self._cmd.create_lun_map(volume_name, |
||||
self.protocol, |
||||
connector['wwpns']) |
||||
if ret['key'] == 0: |
||||
if 'lun' in ret['arr']: |
||||
lun_id = int(ret['arr']['lun']) |
||||
else: |
||||
msg = (_('_create_fc_lun: Lun id did not find ' |
||||
'when volume %s create lun map.') % volume['id']) |
||||
raise exception.VolumeBackendAPIException(data=msg) |
||||
|
||||
target_wwpns = self._get_connected_wwpns() |
||||
if len(target_wwpns) == 0: |
||||
if self._check_multi_attached(volume, connector) < 1: |
||||
self._cmd.delete_lun_map(volume_name, |
||||
self.protocol, |
||||
connector['wwpns']) |
||||
msg = (_('_create_fc_lun: Did not find ' |
||||
'available fc wwpns when volume %s ' |
||||
'create lun map.') % volume['id']) |
||||
raise exception.VolumeBackendAPIException(data=msg) |
||||
|
||||
initiator_target = {} |
||||
for initiator_wwpn in connector['wwpns']: |
||||
initiator_target[str(initiator_wwpn)] = target_wwpns |
||||
properties = {'driver_volume_type': 'fibre_channel', |
||||
'data': {'target_wwn': target_wwpns, |
||||
'target_discovered': False, |
||||
'target_lun': lun_id, |
||||
'volume_id': volume['id']}} |
||||
properties['data']['initiator_target_map'] = initiator_target |
||||
elif ret['key'] == 303: |
||||
raise exception.VolumeNotFound(volume_id=volume_name) |
||||
else: |
||||
msg = (_('failed to map the volume %(vol)s to ' |
||||
'connector %(conn)s.') % |
||||
{'vol': volume['id'], 'conn': connector}) |
||||
raise exception.VolumeBackendAPIException(data=msg) |
||||
|
||||
zone_utils.add_fc_zone(properties) |
||||
LOG.debug('leave: initialize_connection: volume ' |
||||
'%(vol)s with connector %(conn)s', |
||||
{'vol': volume.id, 'conn': connector}) |
||||
return properties |
||||
|
||||
@utils.synchronized('acs5000A-host', external=True) |
||||
def terminate_connection(self, volume, connector, **kwargs): |
||||
LOG.debug('enter: terminate_connection: volume ' |
||||
'%(vol)s with connector %(conn)s', |
||||
{'vol': volume.id, 'conn': connector}) |
||||
volume_name = self._convert_name(volume.name) |
||||
properties = {'driver_volume_type': 'fibre_channel', |
||||
'data': {}} |
||||
initiator_wwpns = [] |
||||
target_wwpns = [] |
||||
if connector and 'wwpns' in connector: |
||||
initiator_wwpns = connector['wwpns'] |
||||
target_wwpns = self._get_connected_wwpns() |
||||
if len(target_wwpns) == 0: |
||||
target_wwpns = [] |
||||
LOG.warn('terminate_connection: Did not find ' |
||||
'available fc wwpns when volume %s ' |
||||
'delete lun map.', volume.id) |
||||
|
||||
initiator_target = {} |
||||
for i_wwpn in initiator_wwpns: |
||||
initiator_target[str(i_wwpn)] = target_wwpns |
||||
properties['data'] = {'initiator_target_map': initiator_target} |
||||
if self._check_multi_attached(volume, connector) < 2: |
||||
if not initiator_wwpns: |
||||
# -1 means all lun maps of this volume |
||||
initiator_wwpns = -1 |
||||
self._cmd.delete_lun_map(volume_name, |
||||
self.protocol, |
||||
initiator_wwpns) |
||||
else: |
||||
LOG.warn('volume %s has been mapped to multi VMs, and these VMs ' |
||||
'belong to the same host. The mapping cancellation ' |
||||
'request is aborted.', volume.id) |
||||
zone_utils.remove_fc_zone(properties) |
||||
LOG.debug('leave: terminate_connection: volume ' |
||||
'%(vol)s with connector %(conn)s', |
||||
{'vol': volume.id, 'conn': connector}) |
||||
return properties |
@ -1,72 +0,0 @@
|
||||
========================== |
||||
TOYOU ACS5000 iSCSI driver |
||||
========================== |
||||
|
||||
TOYOU ACS5000 series volume driver provides OpenStack Compute instances |
||||
with access to TOYOU ACS5000 series storage systems. |
||||
|
||||
TOYOU ACS5000 storage can be used with iSCSI connection. |
||||
|
||||
This documentation explains how to configure and connect the block storage |
||||
nodes to TOYOU ACS5000 series storage. |
||||
|
||||
Driver options |
||||
~~~~~~~~~~~~~~ |
||||
|
||||
The following table contains the configuration options supported by the |
||||
TOYOU ACS5000 iSCSI driver. |
||||
|
||||
.. config-table:: |
||||
:config-target: TOYOU ACS5000 |
||||
|
||||
cinder.volume.drivers.toyou.acs5000.acs5000_iscsi |
||||
cinder.volume.drivers.toyou.acs5000.acs5000_common |
||||
|
||||
Supported operations |
||||
~~~~~~~~~~~~~~~~~~~~ |
||||
|
||||
- Create, list, delete, attach (map), and detach (unmap) volumes. |
||||
- Create, list and delete volume snapshots. |
||||
- Create a volume from a snapshot. |
||||
- Copy an image to a volume. |
||||
- Copy a volume to an image. |
||||
- Clone a volume. |
||||
- Extend a volume. |
||||
- Migrate a volume. |
||||
|
||||
Configure TOYOU ACS5000 iSCSI backend |
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
||||
|
||||
This section details the steps required to configure the TOYOU ACS5000 |
||||
storage cinder driver. |
||||
|
||||
#. In the ``cinder.conf`` configuration file under the ``[DEFAULT]`` |
||||
section, set the enabled_backends parameter. |
||||
|
||||
.. code-block:: ini |
||||
|
||||
[DEFAULT] |
||||
enabled_backends = ACS5000-1 |
||||
|
||||
|
||||
#. Add a backend group section for the backend group specified |
||||
in the enabled_backends parameter. |
||||
|
||||
#. In the newly created backend group section, set the |
||||
following configuration options: |
||||
|
||||
.. code-block:: ini |
||||
|
||||
[ACS5000-1] |
||||
# The driver path |
||||
volume_driver = cinder.volume.drivers.toyou.acs5000.acs5000_iscsi.Acs5000ISCSIDriver |
||||
# Management IP of TOYOU ACS5000 storage array |
||||
san_ip = 10.0.0.10 |
||||
# Management username of TOYOU ACS5000 storage array |
||||
san_login = cliuser |
||||
# Management password of TOYOU ACS5000 storage array |
||||
san_password = clipassword |
||||
# The Pool used to allocated volumes |
||||
acs5000_volpool_name = pool01 |
||||
# Backend name |
||||
volume_backend_name = ACS5000 |
@ -0,0 +1,106 @@
|
||||
=========================== |
||||
TOYOU NetStor Cinder driver |
||||
=========================== |
||||
|
||||
TOYOU NetStor series volume driver provides OpenStack Compute instances |
||||
with access to TOYOU NetStor series storage systems. |
||||
|
||||
TOYOU NetStor storage can be used with iSCSI or FC connection. |
||||
|
||||
This documentation explains how to configure and connect the block storage |
||||
nodes to TOYOU NetStor series storage. |
||||
|
||||
Driver options |
||||
~~~~~~~~~~~~~~ |
||||
|
||||
The following table contains the configuration options supported by the |
||||
TOYOU NetStor iSCSI/FC driver. |
||||
|
||||
.. config-table:: |
||||
:config-target: TOYOU NetStor |
||||
|
||||
cinder.volume.drivers.toyou.acs5000.acs5000_common |
||||
|
||||
Supported operations |
||||
~~~~~~~~~~~~~~~~~~~~ |
||||
|
||||
- Create, list, delete, attach (map), and detach (unmap) volumes. |
||||
- Create, list and delete volume snapshots. |
||||
- Create a volume from a snapshot. |
||||
- Copy an image to a volume. |
||||
- Copy a volume to an image. |
||||
- Clone a volume. |
||||
- Extend a volume. |
||||
- Migrate a volume. |
||||
- Manage/Unmanage volume. |
||||
- Revert to Snapshot. |
||||
- Multi-attach. |
||||
- Thin Provisioning. |
||||
- Extend Attached Volume. |
||||
|
||||
Configure TOYOU NetStor iSCSI/FC backend |
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
||||
|
||||
This section details the steps required to configure the TOYOU NetStor |
||||
storage cinder driver. |
||||
|
||||
#. In the ``cinder.conf`` configuration file under the ``[DEFAULT]`` |
||||
section, set the enabled_backends parameter |
||||
with the iSCSI or FC back-end group. |
||||
|
||||
- For Fibre Channel: |
||||
|
||||
.. code-block:: ini |
||||
|
||||
[DEFAULT] |
||||
enabled_backends = toyou-fc-1 |
||||
|
||||
- For iSCSI: |
||||
|
||||
.. code-block:: ini |
||||
|
||||
[DEFAULT] |
||||
enabled_backends = toyou-iscsi-1 |
||||
|
||||
|
||||
#. Add a backend group section for the backend group specified |
||||
in the enabled_backends parameter. |
||||
|
||||
#. In the newly created backend group section, set the |
||||
following configuration options: |
||||
|
||||
- For Fibre Channel: |
||||
|
||||
.. code-block:: ini |
||||
|
||||
[toyou-fc-1] |
||||
# The TOYOU NetStor driver path |
||||
volume_driver = cinder.volume.drivers.toyou.acs5000.acs5000_fc.Acs5000FCDriver |
||||
# Management IP of TOYOU NetStor storage array |
||||
san_ip = 10.0.0.10 |
||||
# Management username of TOYOU NetStor storage array |
||||
san_login = cliuser |
||||
# Management password of TOYOU NetStor storage array |
||||
san_password = clipassword |
||||
# The Pool used to allocated volumes |
||||
acs5000_volpool_name = pool01 |
||||
# Backend name |
||||
volume_backend_name = toyou-fc |
||||
|
||||
- For iSCSI: |
||||
|
||||
.. code-block:: ini |
||||
|
||||
[toyou-iscsi-1] |
||||
# The TOYOU NetStor driver path |
||||
volume_driver = cinder.volume.drivers.toyou.acs5000.acs5000_iscsi.Acs5000ISCSIDriver |
||||
# Management IP of TOYOU NetStor storage array |
||||
san_ip = 10.0.0.10 |
||||
# Management username of TOYOU NetStor storage array |
||||
san_login = cliuser |
||||
# Management password of TOYOU NetStor storage array |
||||
san_password = clipassword |
||||
# The Pool used to allocated volumes |
||||
acs5000_volpool_name = pool01 |
||||
# Backend name |
||||
volume_backend_name = toyou-iscsi |
Loading…
Reference in new issue