Skip to content

Commit 71972be

Browse files
authored
Merge pull request #60 from huangpeng5/openstack_415
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.
2 parents 895a246 + 218f667 commit 71972be

File tree

104 files changed

+23308
-235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+23308
-235
lines changed

Cinder/Antelope/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"""Version: 2.6.3"""
1+
"""Version: 2.6.4"""

Cinder/Antelope/constants.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
DEFAULT_WAIT_INTERVAL = 5
3838
MAX_NAME_LENGTH = 31
3939
SOCKET_TIMEOUT = 52
40-
LOGIN_SOCKET_TIMEOUT = 4
40+
LOGIN_SOCKET_TIMEOUT = 32
41+
DEFAULT_SEMAPHORE = 20
4142
PWD_EXPIRED_OR_INITIAL = (3, 4)
4243

4344
LUN_STATUS = (LUN_ONLINE, LUN_INITIALIZING, LUN_OFFLINE) = ('27', '53', '28')

Cinder/Antelope/huawei_base_driver.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656

5757
class HuaweiBaseDriver(object):
58-
VERSION = "2.6.3"
58+
VERSION = "2.6.4"
5959

6060
def __init__(self, *args, **kwargs):
6161
super(HuaweiBaseDriver, self).__init__(*args, **kwargs)
@@ -86,7 +86,8 @@ def do_setup(self, context):
8686
'ssl_cert_verify': self.configuration.ssl_cert_verify,
8787
'ssl_cert_path': self.configuration.ssl_cert_path,
8888
'in_band_or_not': self.configuration.in_band_or_not,
89-
'storage_sn': self.configuration.storage_sn
89+
'storage_sn': self.configuration.storage_sn,
90+
'semaphore': self.configuration.semaphore
9091
}
9192
self.local_cli = rest_client.RestClient(config_dict)
9293
self.local_cli.login()
@@ -97,11 +98,17 @@ def do_setup(self, context):
9798
self.support_capability[c] = False
9899

99100
if self.configuration.hypermetro:
101+
self.configuration.hypermetro.update(
102+
{'semaphore': self.configuration.semaphore}
103+
)
100104
self.hypermetro_rmt_cli = rest_client.RestClient(
101105
self.configuration.hypermetro)
102106
self.hypermetro_rmt_cli.login()
103107

104108
if self.configuration.replication:
109+
self.configuration.replication.update(
110+
{'semaphore': self.configuration.semaphore}
111+
)
105112
self.replication_rmt_cli = rest_client.RestClient(
106113
self.configuration.replication)
107114
self.replication_rmt_cli.login()

Cinder/Antelope/huawei_conf.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def update_config_value(self):
8484
self._get_local_in_band_or_not,
8585
self._get_local_storage_sn,
8686
self._set_qos_ignored_param,
87+
self._get_rest_client_semaphore,
8788
)
8889

8990
for f in attr_funcs:
@@ -640,3 +641,15 @@ def _set_qos_ignored_param(xml_root):
640641
qos_ignored_params = text.split(';')
641642
qos_ignored_params = list(set(x.strip() for x in qos_ignored_params if x.strip()))
642643
setattr(constants, 'QOS_IGNORED_PARAMS', qos_ignored_params)
644+
645+
def _get_rest_client_semaphore(self, xml_root):
646+
semaphore = xml_root.findtext('Storage/Semaphore')
647+
if not semaphore or not semaphore.strip():
648+
setattr(self.conf, 'semaphore', constants.DEFAULT_SEMAPHORE)
649+
elif semaphore.isdigit() and int(semaphore) > 0:
650+
setattr(self.conf, 'semaphore', int(semaphore))
651+
else:
652+
msg = _("Semaphore configured error. The semaphore must be an "
653+
"integer and must be greater than zero")
654+
LOG.error(msg)
655+
raise exception.InvalidInput(reason=msg)

Cinder/Antelope/rest_client.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,22 @@ def _error_code(result):
3838
return result['error']['code']
3939

4040

41-
# To limit the requests concurrently sent to array
42-
_semaphore = threading.Semaphore(20)
43-
44-
4541
def obj_operation_wrapper(func):
4642
@functools.wraps(func)
4743
def wrapped(self, url_format=None, **kwargs):
4844
url = self._obj_url
4945
if url_format:
5046
url += url_format % kwargs
5147

52-
_semaphore.acquire()
48+
self.semaphore.acquire()
5349

5450
try:
5551
result = func(self, url, **kwargs)
5652
except requests.HTTPError as exc:
5753
return {"error": {"code": exc.response.status_code,
5854
"description": six.text_type(exc)}}
5955
finally:
60-
_semaphore.release()
56+
self.semaphore.release()
6157

6258
return result
6359

@@ -67,6 +63,7 @@ def wrapped(self, url_format=None, **kwargs):
6763
class CommonObject(object):
6864
def __init__(self, client):
6965
self.client = client
66+
self.semaphore = client.semaphore
7067

7168
@obj_operation_wrapper
7269
def post(self, url, **kwargs):
@@ -1403,12 +1400,9 @@ def wrapped(self, url, **kwargs):
14031400
need_relogin = False
14041401

14051402
if not kwargs.get('log_filter'):
1406-
LOG.info('\nURL: %(url)s\n'
1407-
'Method: %(method)s\n'
1408-
'Data: %(data)s\n',
1403+
LOG.info('URL: %(url)s, Method: %(method)s, Data: %(data)s,',
14091404
{'url': (self._login_url or '') + url,
1410-
'method': func.__name__,
1411-
'data': kwargs.get('data')})
1405+
'method': func.__name__, 'data': kwargs.get('data')})
14121406

14131407
with self._session_lock.read_lock():
14141408
if self._login_url:
@@ -1451,8 +1445,10 @@ def wrapped(self, url, **kwargs):
14511445

14521446
r.raise_for_status()
14531447
result = r.json()
1448+
response_time = r.elapsed.total_seconds()
14541449
if not kwargs.get('log_filter'):
1455-
LOG.info('Response: %s', result)
1450+
LOG.info('Response: %s, Response duration time is %s',
1451+
result, response_time)
14561452
return result
14571453

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

14721471
self._login_url = None
14731472
self._login_device_id = None

Cinder/Bobcat/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Version: 2.6.4"""

Cinder/Bobcat/constants.py

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# Copyright (c) 2016 Huawei Technologies Co., Ltd.
2+
# All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
5+
# not use this file except in compliance with the License. You may obtain
6+
# a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
# License for the specific language governing permissions and limitations
14+
# under the License.
15+
16+
STATUS_INITIALIZE = '0'
17+
STATUS_HEALTH = '1'
18+
LUN_TYPE = '11'
19+
SNAPSHOT_TYPE = '27'
20+
BLOCK_POOL_TYPE = '1'
21+
DORADO_V6_POOL_TYPE = '0'
22+
23+
HOSTGROUP_PREFIX = 'OpenStack_HostGroup_'
24+
LUNGROUP_PREFIX = 'OpenStack_LunGroup_'
25+
MAPPING_VIEW_PREFIX = 'OpenStack_Mapping_View_'
26+
PORTGROUP_PREFIX = 'OpenStack_PortGroup_'
27+
QOS_NAME_PREFIX = 'OpenStack_'
28+
SENSITIVE_KEYS = ['auth_password']
29+
30+
FC_PORT_CONNECTED = '10'
31+
FC_INIT_ONLINE = '27'
32+
FC_INITIATOR_NOT_EXIST = 1077948996
33+
ERROR_PARAMETER_ERROR = 50331651
34+
PARENT_TYPE_HOST = 21
35+
CAPACITY_UNIT = 1024 * 1024 * 2
36+
DEFAULT_WAIT_TIMEOUT = 3600 * 24 * 30
37+
DEFAULT_WAIT_INTERVAL = 5
38+
MAX_NAME_LENGTH = 31
39+
SOCKET_TIMEOUT = 52
40+
LOGIN_SOCKET_TIMEOUT = 32
41+
DEFAULT_SEMAPHORE = 20
42+
PWD_EXPIRED_OR_INITIAL = (3, 4)
43+
44+
LUN_STATUS = (LUN_ONLINE, LUN_INITIALIZING, LUN_OFFLINE) = ('27', '53', '28')
45+
SNAPSHOT_STATUS = (
46+
SNAPSHOT_INITIALIZING, SNAPSHOT_ACTIVATED, SNAPSHOT_UNACTIVATED
47+
) = ('53', '43', '45')
48+
49+
MIGRATION_STATUS_IN_PROCESS = (
50+
MIGRATION_NORMAL, MIGRATION_QUEUING, MIGRATION_MIGRATING
51+
) = ('1', '37', '75')
52+
MIGRATION_STATUS_COMPLETE = (MIGRATION_COMPLETE,) = ('76',)
53+
LUNCOPY_STATUS_COMPLETE = (LUNCOPY_COMPLETE,) = ('40',)
54+
55+
ERROR_CONNECT_TO_SERVER = -403
56+
ERROR_UNAUTHORIZED_TO_SERVER = -401
57+
ERROR_DEVICE_COMMUNICATE = 4294967297
58+
OBJECT_NAME_ALREADY_EXIST = 1077948993
59+
OBJECT_ID_NOT_UNIQUE = 1077948997
60+
ERROR_VOLUME_NOT_EXIST = 1077939726
61+
ERROR_LUN_NOT_EXIST = 1077936859
62+
SNAPSHOT_NOT_EXIST = 1077937880
63+
OBJECT_NOT_EXIST = 1077948996
64+
HYPERMETRO_NOT_EXIST = 1077674242
65+
HYPERMETRO_NOT_IN_GROUP = 1077675021
66+
HYPERMETROGROUP_NOT_EXIST = 1077675010
67+
HYPERMETRO_ALREADY_IN_GROUP = 1077675038
68+
NO_HYPERMETRO_EXIST_IN_GROUP = 1077675022
69+
HOSTGROUP_NOT_IN_MAPPINGVIEW = 1073804552
70+
PORTGROUP_NOT_IN_MAPPINGVIEW = 1073804553
71+
LUNGROUP_NOT_IN_MAPPINGVIEW = 1073804554
72+
MIGRATION_NOT_EXIST = 1073806607
73+
LUNCOPY_NOT_EXIST = 50338560
74+
LUNCOPY_ALREADY_STOPPED = 1077950178
75+
LUNCOPY_COMPLETED = 1077950180
76+
PORTGROUP_NOT_EXIST = 1077951832
77+
HOSTGROUP_NOT_EXIST = 1077937500
78+
HOST_NOT_IN_HOSTGROUP = 1073745412
79+
PORT_NOT_IN_PORTGROUP = 1073807618
80+
INITIATOR_NOT_IN_HOST = 1077950342
81+
HOST_NOT_EXIST = 1077937498
82+
MAPPINGVIEW_NOT_EXIST = 1077951819
83+
HOST_ALREADY_IN_HOSTGROUP = 1077937501
84+
PORT_ALREADY_IN_PORTGROUP = 1077951833
85+
HOSTGROUP_ALREADY_IN_MAPPINGVIEW = 1073804556
86+
PORTGROUP_ALREADY_IN_MAPPINGVIEW = 1073804558
87+
LUNGROUP_ALREADY_IN_MAPPINGVIEW = 1073804560
88+
LUN_ALREADY_IN_LUNGROUP = 1077936862
89+
ERROR_VOLUME_TIMEOUT = 1077949001
90+
GET_VOLUME_WAIT_INTERVAL = 30
91+
CREATE_HYPERMETRO_TIMEOUT = 1077949006
92+
HYPERMETRO_ALREADY_EXIST = 1077674256
93+
ERROR_VOLUME_ALREADY_EXIST = 1077948993
94+
95+
RELOGIN_ERROR_CODE = (ERROR_CONNECT_TO_SERVER, ERROR_UNAUTHORIZED_TO_SERVER,
96+
ERROR_DEVICE_COMMUNICATE)
97+
98+
METRO_RUNNING_STATUS = (METRO_RUNNING_NORMAL, METRO_RUNNING_SYNC,
99+
METRO_RUNNING_STOP, RUNNING_TO_BE_SYNC
100+
) = ('1', '23', '41', '100')
101+
METRO_HEALTH_NORMAL = '1'
102+
103+
THICK_LUNTYPE = '0'
104+
THIN_LUNTYPE = '1'
105+
LUN_TYPE_MAP = {'Thick': THICK_LUNTYPE,
106+
'Thin': THIN_LUNTYPE}
107+
108+
QOS_INACTIVATED = '45'
109+
LOWER_LIMIT_KEYS = ('MINIOPS', 'LATENCY', 'MINBANDWIDTH')
110+
UPPER_LIMIT_KEYS = ('MAXIOPS', 'MAXBANDWIDTH')
111+
112+
REPLICA_SYNC_MODEL = '1'
113+
REPLICA_ASYNC_MODEL = '2'
114+
REPLICA_SPEED = '2'
115+
REPLICA_PERIOD = '3600'
116+
REPLICA_SECOND_RO = '2'
117+
REPLICA_SECOND_RW = '3'
118+
REPLICA_CG_PERIOD = '60'
119+
120+
REPLICA_RUNNING_STATUS_SYNC = '23'
121+
REPLICA_RUNNING_STATUS_NORMAL = '1'
122+
REPLICA_RUNNING_STATUS_SPLIT = '26'
123+
REPLICA_RUNNING_STATUS_INTERRUPTED = '34'
124+
REPLICA_SECRES_DATA_SYNC = '1'
125+
REPLICA_SECRES_DATA_COMPLETE = '2'
126+
REPLICA_HEALTH_STATUS_NORMAL = '1'
127+
128+
REPLICATION_PAIR_NOT_EXIST = 1077937923
129+
REPLICATION_GROUP_NOT_EXIST = 1077937924
130+
REPLICATION_PAIR_NOT_GROUP_MEMBER = 1077937927
131+
REPLICATION_GROUP_IS_EMPTY = 1077937960
132+
CLONE_PAIR_SYNC_COMPLETE = 1073798176
133+
CLONE_PAIR_SYNC_NOT_EXIST = 1073798172
134+
135+
VALID_PRODUCT = ('V3', 'V5', '18000', 'Dorado', 'V6')
136+
TIER_DISK_TYPES = ('ssd', 'sas', 'nl_sas')
137+
DORADO_V6_AND_V6_PRODUCT = ('Dorado', 'V6')
138+
139+
AVAILABLE_FEATURE_STATUS = (1, 2)
140+
CHECK_FEATURES = {
141+
'SmartTier': None,
142+
'SmartThin': None,
143+
'SmartQoS': 'ioclass',
144+
'SmartPartition': 'cachepartition',
145+
'SmartCache': 'smartcachepartition',
146+
'SmartMigration': 'LUN_MIGRATION',
147+
'HyperMetro': 'HyperMetroPair',
148+
'HyperReplication': 'REPLICATIONPAIR',
149+
'HyperSnap': 'snapshot',
150+
'HyperCopy': 'LUNCOPY',
151+
'SmartDedupe[\s\S]*LUN': None,
152+
'SmartCompression[\s\S]*LUN': None,
153+
'Effective Capacity': None,
154+
}
155+
156+
LUN_COPY_SPEED_TYPES = (
157+
LUN_COPY_SPEED_LOW,
158+
LUN_COPY_SPEED_MEDIUM,
159+
LUN_COPY_SPEED_HIGH,
160+
LUN_COPY_SPEED_HIGHEST
161+
) = ('1', '2', '3', '4')
162+
DEFAULT_CLONE_MODE = "luncopy"
163+
164+
HYPER_SYNC_SPEED_TYPES = (
165+
HYPER_SYNC_SPEED_LOW,
166+
HYPER_SYNC_SPEED_MEDIUM,
167+
HYPER_SYNC_SPEED_HIGH,
168+
HYPER_SYNC_SPEED_HIGHEST
169+
) = ('1', '2', '3', '4')
170+
171+
REPLICA_SYNC_SPEED_TYPES = (
172+
REPLICA_SYNC_SPEED_LOW,
173+
REPLICA_SYNC_SPEED_MEDIUM,
174+
REPLICA_SYNC_SPEED_HIGH,
175+
REPLICA_SYNC_SPEED_HIGHEST
176+
) = ('1', '2', '3', '4')
177+
178+
CLONE_STATUS_HEALTH = '0'
179+
CLONE_STATUS_COMPLETE = (CLONE_COMPLETE,) = ('2',)
180+
CLONE_PAIR_NOT_EXIST = "1073798147"
181+
SUPPORT_CLONE_PAIR_VERSION = "V600R003C00"
182+
GET_PATCH_NUM = 100
183+
184+
DEFAULT_MINIMUM_FC_INITIATOR_ONLINE = 0
185+
186+
SNAPSHOT_HEALTH_STATUS = (
187+
SNAPSHOT_HEALTH_STATUS_NORMAL,
188+
SNAPSHOT_HEALTH_STATUS_FAULTY) = ('1', '2')
189+
SNAPSHOT_RUNNING_STATUS = (
190+
SNAPSHOT_RUNNING_STATUS_ACTIVATED,
191+
SNAPSHOT_RUNNING_STATUS_ROLLINGBACK) = ('43', '44')
192+
SNAPSHOT_ROLLBACK_PROGRESS_FINISH = '100'
193+
SNAPSHOT_ROLLBACK_SPEED_TYPES = (
194+
SNAPSHOT_ROLLBACK_SPEED_LOW,
195+
SNAPSHOT_ROLLBACK_SPEED_MEDIUM,
196+
SNAPSHOT_ROLLBACK_SPEED_HIGH,
197+
SNAPSHOT_ROLLBACK_SPEED_HIGHEST
198+
) = ('1', '2', '3', '4')
199+
200+
INBAND_LUN_TYPE = '5'

0 commit comments

Comments
 (0)