Skip to content

Commit

Permalink
Merge pull request #60 from huangpeng5/openstack_415
Browse files Browse the repository at this point in the history
1.Released the PowerVC plug-in to the GitHub open-source community.
2.Change the storage login timeout to 32.
3.Added support for custom semaphores.
4.the nvme over roce protocol is supported for suyan platform with openstack Pika.
  • Loading branch information
huangpeng5 authored Apr 16, 2024
2 parents 895a246 + 218f667 commit 71972be
Show file tree
Hide file tree
Showing 104 changed files with 23,308 additions and 235 deletions.
2 changes: 1 addition & 1 deletion Cinder/Antelope/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Version: 2.6.3"""
"""Version: 2.6.4"""
3 changes: 2 additions & 1 deletion Cinder/Antelope/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
DEFAULT_WAIT_INTERVAL = 5
MAX_NAME_LENGTH = 31
SOCKET_TIMEOUT = 52
LOGIN_SOCKET_TIMEOUT = 4
LOGIN_SOCKET_TIMEOUT = 32
DEFAULT_SEMAPHORE = 20
PWD_EXPIRED_OR_INITIAL = (3, 4)

LUN_STATUS = (LUN_ONLINE, LUN_INITIALIZING, LUN_OFFLINE) = ('27', '53', '28')
Expand Down
11 changes: 9 additions & 2 deletions Cinder/Antelope/huawei_base_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@


class HuaweiBaseDriver(object):
VERSION = "2.6.3"
VERSION = "2.6.4"

def __init__(self, *args, **kwargs):
super(HuaweiBaseDriver, self).__init__(*args, **kwargs)
Expand Down Expand Up @@ -86,7 +86,8 @@ def do_setup(self, context):
'ssl_cert_verify': self.configuration.ssl_cert_verify,
'ssl_cert_path': self.configuration.ssl_cert_path,
'in_band_or_not': self.configuration.in_band_or_not,
'storage_sn': self.configuration.storage_sn
'storage_sn': self.configuration.storage_sn,
'semaphore': self.configuration.semaphore
}
self.local_cli = rest_client.RestClient(config_dict)
self.local_cli.login()
Expand All @@ -97,11 +98,17 @@ def do_setup(self, context):
self.support_capability[c] = False

if self.configuration.hypermetro:
self.configuration.hypermetro.update(
{'semaphore': self.configuration.semaphore}
)
self.hypermetro_rmt_cli = rest_client.RestClient(
self.configuration.hypermetro)
self.hypermetro_rmt_cli.login()

if self.configuration.replication:
self.configuration.replication.update(
{'semaphore': self.configuration.semaphore}
)
self.replication_rmt_cli = rest_client.RestClient(
self.configuration.replication)
self.replication_rmt_cli.login()
Expand Down
13 changes: 13 additions & 0 deletions Cinder/Antelope/huawei_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def update_config_value(self):
self._get_local_in_band_or_not,
self._get_local_storage_sn,
self._set_qos_ignored_param,
self._get_rest_client_semaphore,
)

for f in attr_funcs:
Expand Down Expand Up @@ -640,3 +641,15 @@ def _set_qos_ignored_param(xml_root):
qos_ignored_params = text.split(';')
qos_ignored_params = list(set(x.strip() for x in qos_ignored_params if x.strip()))
setattr(constants, 'QOS_IGNORED_PARAMS', qos_ignored_params)

def _get_rest_client_semaphore(self, xml_root):
semaphore = xml_root.findtext('Storage/Semaphore')
if not semaphore or not semaphore.strip():
setattr(self.conf, 'semaphore', constants.DEFAULT_SEMAPHORE)
elif semaphore.isdigit() and int(semaphore) > 0:
setattr(self.conf, 'semaphore', int(semaphore))
else:
msg = _("Semaphore configured error. The semaphore must be an "
"integer and must be greater than zero")
LOG.error(msg)
raise exception.InvalidInput(reason=msg)
23 changes: 11 additions & 12 deletions Cinder/Antelope/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,22 @@ def _error_code(result):
return result['error']['code']


# To limit the requests concurrently sent to array
_semaphore = threading.Semaphore(20)


def obj_operation_wrapper(func):
@functools.wraps(func)
def wrapped(self, url_format=None, **kwargs):
url = self._obj_url
if url_format:
url += url_format % kwargs

_semaphore.acquire()
self.semaphore.acquire()

try:
result = func(self, url, **kwargs)
except requests.HTTPError as exc:
return {"error": {"code": exc.response.status_code,
"description": six.text_type(exc)}}
finally:
_semaphore.release()
self.semaphore.release()

return result

Expand All @@ -67,6 +63,7 @@ def wrapped(self, url_format=None, **kwargs):
class CommonObject(object):
def __init__(self, client):
self.client = client
self.semaphore = client.semaphore

@obj_operation_wrapper
def post(self, url, **kwargs):
Expand Down Expand Up @@ -1403,12 +1400,9 @@ def wrapped(self, url, **kwargs):
need_relogin = False

if not kwargs.get('log_filter'):
LOG.info('\nURL: %(url)s\n'
'Method: %(method)s\n'
'Data: %(data)s\n',
LOG.info('URL: %(url)s, Method: %(method)s, Data: %(data)s,',
{'url': (self._login_url or '') + url,
'method': func.__name__,
'data': kwargs.get('data')})
'method': func.__name__, 'data': kwargs.get('data')})

with self._session_lock.read_lock():
if self._login_url:
Expand Down Expand Up @@ -1451,8 +1445,10 @@ def wrapped(self, url, **kwargs):

r.raise_for_status()
result = r.json()
response_time = r.elapsed.total_seconds()
if not kwargs.get('log_filter'):
LOG.info('Response: %s', result)
LOG.info('Response: %s, Response duration time is %s',
result, response_time)
return result

return wrapped
Expand All @@ -1468,6 +1464,9 @@ def __init__(self, config_dict):
self.cert_path = config_dict.get('ssl_cert_path')
self.in_band_or_not = config_dict.get('in_band_or_not')
self.storage_sn = config_dict.get('storage_sn')
# To limit the requests concurrently sent to array
self.semaphore = threading.Semaphore(
config_dict.get('semaphore', constants.DEFAULT_SEMAPHORE))

self._login_url = None
self._login_device_id = None
Expand Down
1 change: 1 addition & 0 deletions Cinder/Bobcat/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Version: 2.6.4"""
200 changes: 200 additions & 0 deletions Cinder/Bobcat/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
# Copyright (c) 2016 Huawei Technologies Co., Ltd.
# 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.

STATUS_INITIALIZE = '0'
STATUS_HEALTH = '1'
LUN_TYPE = '11'
SNAPSHOT_TYPE = '27'
BLOCK_POOL_TYPE = '1'
DORADO_V6_POOL_TYPE = '0'

HOSTGROUP_PREFIX = 'OpenStack_HostGroup_'
LUNGROUP_PREFIX = 'OpenStack_LunGroup_'
MAPPING_VIEW_PREFIX = 'OpenStack_Mapping_View_'
PORTGROUP_PREFIX = 'OpenStack_PortGroup_'
QOS_NAME_PREFIX = 'OpenStack_'
SENSITIVE_KEYS = ['auth_password']

FC_PORT_CONNECTED = '10'
FC_INIT_ONLINE = '27'
FC_INITIATOR_NOT_EXIST = 1077948996
ERROR_PARAMETER_ERROR = 50331651
PARENT_TYPE_HOST = 21
CAPACITY_UNIT = 1024 * 1024 * 2
DEFAULT_WAIT_TIMEOUT = 3600 * 24 * 30
DEFAULT_WAIT_INTERVAL = 5
MAX_NAME_LENGTH = 31
SOCKET_TIMEOUT = 52
LOGIN_SOCKET_TIMEOUT = 32
DEFAULT_SEMAPHORE = 20
PWD_EXPIRED_OR_INITIAL = (3, 4)

LUN_STATUS = (LUN_ONLINE, LUN_INITIALIZING, LUN_OFFLINE) = ('27', '53', '28')
SNAPSHOT_STATUS = (
SNAPSHOT_INITIALIZING, SNAPSHOT_ACTIVATED, SNAPSHOT_UNACTIVATED
) = ('53', '43', '45')

MIGRATION_STATUS_IN_PROCESS = (
MIGRATION_NORMAL, MIGRATION_QUEUING, MIGRATION_MIGRATING
) = ('1', '37', '75')
MIGRATION_STATUS_COMPLETE = (MIGRATION_COMPLETE,) = ('76',)
LUNCOPY_STATUS_COMPLETE = (LUNCOPY_COMPLETE,) = ('40',)

ERROR_CONNECT_TO_SERVER = -403
ERROR_UNAUTHORIZED_TO_SERVER = -401
ERROR_DEVICE_COMMUNICATE = 4294967297
OBJECT_NAME_ALREADY_EXIST = 1077948993
OBJECT_ID_NOT_UNIQUE = 1077948997
ERROR_VOLUME_NOT_EXIST = 1077939726
ERROR_LUN_NOT_EXIST = 1077936859
SNAPSHOT_NOT_EXIST = 1077937880
OBJECT_NOT_EXIST = 1077948996
HYPERMETRO_NOT_EXIST = 1077674242
HYPERMETRO_NOT_IN_GROUP = 1077675021
HYPERMETROGROUP_NOT_EXIST = 1077675010
HYPERMETRO_ALREADY_IN_GROUP = 1077675038
NO_HYPERMETRO_EXIST_IN_GROUP = 1077675022
HOSTGROUP_NOT_IN_MAPPINGVIEW = 1073804552
PORTGROUP_NOT_IN_MAPPINGVIEW = 1073804553
LUNGROUP_NOT_IN_MAPPINGVIEW = 1073804554
MIGRATION_NOT_EXIST = 1073806607
LUNCOPY_NOT_EXIST = 50338560
LUNCOPY_ALREADY_STOPPED = 1077950178
LUNCOPY_COMPLETED = 1077950180
PORTGROUP_NOT_EXIST = 1077951832
HOSTGROUP_NOT_EXIST = 1077937500
HOST_NOT_IN_HOSTGROUP = 1073745412
PORT_NOT_IN_PORTGROUP = 1073807618
INITIATOR_NOT_IN_HOST = 1077950342
HOST_NOT_EXIST = 1077937498
MAPPINGVIEW_NOT_EXIST = 1077951819
HOST_ALREADY_IN_HOSTGROUP = 1077937501
PORT_ALREADY_IN_PORTGROUP = 1077951833
HOSTGROUP_ALREADY_IN_MAPPINGVIEW = 1073804556
PORTGROUP_ALREADY_IN_MAPPINGVIEW = 1073804558
LUNGROUP_ALREADY_IN_MAPPINGVIEW = 1073804560
LUN_ALREADY_IN_LUNGROUP = 1077936862
ERROR_VOLUME_TIMEOUT = 1077949001
GET_VOLUME_WAIT_INTERVAL = 30
CREATE_HYPERMETRO_TIMEOUT = 1077949006
HYPERMETRO_ALREADY_EXIST = 1077674256
ERROR_VOLUME_ALREADY_EXIST = 1077948993

RELOGIN_ERROR_CODE = (ERROR_CONNECT_TO_SERVER, ERROR_UNAUTHORIZED_TO_SERVER,
ERROR_DEVICE_COMMUNICATE)

METRO_RUNNING_STATUS = (METRO_RUNNING_NORMAL, METRO_RUNNING_SYNC,
METRO_RUNNING_STOP, RUNNING_TO_BE_SYNC
) = ('1', '23', '41', '100')
METRO_HEALTH_NORMAL = '1'

THICK_LUNTYPE = '0'
THIN_LUNTYPE = '1'
LUN_TYPE_MAP = {'Thick': THICK_LUNTYPE,
'Thin': THIN_LUNTYPE}

QOS_INACTIVATED = '45'
LOWER_LIMIT_KEYS = ('MINIOPS', 'LATENCY', 'MINBANDWIDTH')
UPPER_LIMIT_KEYS = ('MAXIOPS', 'MAXBANDWIDTH')

REPLICA_SYNC_MODEL = '1'
REPLICA_ASYNC_MODEL = '2'
REPLICA_SPEED = '2'
REPLICA_PERIOD = '3600'
REPLICA_SECOND_RO = '2'
REPLICA_SECOND_RW = '3'
REPLICA_CG_PERIOD = '60'

REPLICA_RUNNING_STATUS_SYNC = '23'
REPLICA_RUNNING_STATUS_NORMAL = '1'
REPLICA_RUNNING_STATUS_SPLIT = '26'
REPLICA_RUNNING_STATUS_INTERRUPTED = '34'
REPLICA_SECRES_DATA_SYNC = '1'
REPLICA_SECRES_DATA_COMPLETE = '2'
REPLICA_HEALTH_STATUS_NORMAL = '1'

REPLICATION_PAIR_NOT_EXIST = 1077937923
REPLICATION_GROUP_NOT_EXIST = 1077937924
REPLICATION_PAIR_NOT_GROUP_MEMBER = 1077937927
REPLICATION_GROUP_IS_EMPTY = 1077937960
CLONE_PAIR_SYNC_COMPLETE = 1073798176
CLONE_PAIR_SYNC_NOT_EXIST = 1073798172

VALID_PRODUCT = ('V3', 'V5', '18000', 'Dorado', 'V6')
TIER_DISK_TYPES = ('ssd', 'sas', 'nl_sas')
DORADO_V6_AND_V6_PRODUCT = ('Dorado', 'V6')

AVAILABLE_FEATURE_STATUS = (1, 2)
CHECK_FEATURES = {
'SmartTier': None,
'SmartThin': None,
'SmartQoS': 'ioclass',
'SmartPartition': 'cachepartition',
'SmartCache': 'smartcachepartition',
'SmartMigration': 'LUN_MIGRATION',
'HyperMetro': 'HyperMetroPair',
'HyperReplication': 'REPLICATIONPAIR',
'HyperSnap': 'snapshot',
'HyperCopy': 'LUNCOPY',
'SmartDedupe[\s\S]*LUN': None,
'SmartCompression[\s\S]*LUN': None,
'Effective Capacity': None,
}

LUN_COPY_SPEED_TYPES = (
LUN_COPY_SPEED_LOW,
LUN_COPY_SPEED_MEDIUM,
LUN_COPY_SPEED_HIGH,
LUN_COPY_SPEED_HIGHEST
) = ('1', '2', '3', '4')
DEFAULT_CLONE_MODE = "luncopy"

HYPER_SYNC_SPEED_TYPES = (
HYPER_SYNC_SPEED_LOW,
HYPER_SYNC_SPEED_MEDIUM,
HYPER_SYNC_SPEED_HIGH,
HYPER_SYNC_SPEED_HIGHEST
) = ('1', '2', '3', '4')

REPLICA_SYNC_SPEED_TYPES = (
REPLICA_SYNC_SPEED_LOW,
REPLICA_SYNC_SPEED_MEDIUM,
REPLICA_SYNC_SPEED_HIGH,
REPLICA_SYNC_SPEED_HIGHEST
) = ('1', '2', '3', '4')

CLONE_STATUS_HEALTH = '0'
CLONE_STATUS_COMPLETE = (CLONE_COMPLETE,) = ('2',)
CLONE_PAIR_NOT_EXIST = "1073798147"
SUPPORT_CLONE_PAIR_VERSION = "V600R003C00"
GET_PATCH_NUM = 100

DEFAULT_MINIMUM_FC_INITIATOR_ONLINE = 0

SNAPSHOT_HEALTH_STATUS = (
SNAPSHOT_HEALTH_STATUS_NORMAL,
SNAPSHOT_HEALTH_STATUS_FAULTY) = ('1', '2')
SNAPSHOT_RUNNING_STATUS = (
SNAPSHOT_RUNNING_STATUS_ACTIVATED,
SNAPSHOT_RUNNING_STATUS_ROLLINGBACK) = ('43', '44')
SNAPSHOT_ROLLBACK_PROGRESS_FINISH = '100'
SNAPSHOT_ROLLBACK_SPEED_TYPES = (
SNAPSHOT_ROLLBACK_SPEED_LOW,
SNAPSHOT_ROLLBACK_SPEED_MEDIUM,
SNAPSHOT_ROLLBACK_SPEED_HIGH,
SNAPSHOT_ROLLBACK_SPEED_HIGHEST
) = ('1', '2', '3', '4')

INBAND_LUN_TYPE = '5'
Loading

0 comments on commit 71972be

Please sign in to comment.