diff --git a/Manila/file_driver_dir/huawei/oceanstorPacific/driver_api/check_update_storage.py b/Manila/file_driver_dir/huawei/oceanstorPacific/driver_api/check_update_storage.py index 1432f95..45b8fc9 100644 --- a/Manila/file_driver_dir/huawei/oceanstorPacific/driver_api/check_update_storage.py +++ b/Manila/file_driver_dir/huawei/oceanstorPacific/driver_api/check_update_storage.py @@ -95,18 +95,14 @@ def update_storage_pool(self, data, free_pool): result = self.helper.query_pool_by_id(pool_id) if result: total = round(float(result['totalCapacity']) / 1024, 1) - allocated = round(float(result['allocatedCapacity']) / 1024, 1) used = round(float(result['usedCapacity']) / 1024, 1) free = round(float(total) - float(used), 2) - provisioned = used pool = dict( huawei_smartpartition=True, huawei_smartcache=True, pool_name=result['storagePoolName'], qos=True, compression=True, - provisioned_capacity_gb=provisioned, - allocated_capacity_gb=allocated, free_capacity_gb=free, total_capacity_gb=total, reserved_percentage=reserved_percentage, diff --git a/Manila/file_driver_dir/huawei/oceanstorPacific/driver_api/customization_for_suyan.py b/Manila/file_driver_dir/huawei/oceanstorPacific/driver_api/customization_for_suyan.py index 671cc80..66d7ffd 100644 --- a/Manila/file_driver_dir/huawei/oceanstorPacific/driver_api/customization_for_suyan.py +++ b/Manila/file_driver_dir/huawei/oceanstorPacific/driver_api/customization_for_suyan.py @@ -146,22 +146,10 @@ def _get_max_band_width_qos_config(self, extra_specs): 苏研单独的qos 参数设置与读取,其支持的参数如下: “total_bytes_sec”:总吞吐量,单位Byte/s “total_iops_sec”: 总IOPS,单位个/s - 此处解析 max_band_width,从total_bytes_sec获取 + 此处解析 max_band_width,从total_bytes_sec获取 """ - # the total_bytes_sec is Byte/s the pacific need MB/s - tmp_max_band_width = extra_specs.get('pacific:total_bytes_sec') - if tmp_max_band_width is None: - self.qos_config['max_band_width'] = constants.MAX_BAND_WIDTH - elif (tmp_max_band_width.strip().isdigit() - and 0 <= int(int(tmp_max_band_width.strip()) / constants.BYTE_TO_MB) - <= constants.BAND_WIDTH_UPPER_LIMIT): - self.qos_config['max_band_width'] = int(math.ceil(float( - tmp_max_band_width.strip()) / constants.BYTE_TO_MB)) - else: - err_msg = _("The total_bytes_sec in share type " - "must be int([0, %s]).") % constants.BAND_WIDTH_UPPER_LIMIT - raise exception.InvalidInput(reason=err_msg) - + self.qos_config['max_band_width'] = 0 + def _get_max_iops_qos_config(self, extra_specs): """ 苏研单独的qos 参数设置与读取,其支持的参数如下: @@ -169,16 +157,7 @@ def _get_max_iops_qos_config(self, extra_specs): “total_iops_sec”: 总IOPS,单位个/s 此处解析 max_iops,从total_iops_sec获取 """ - tmp_max_iops = extra_specs.get('pacific:total_iops_sec') - if tmp_max_iops is None: - self.qos_config['max_iops'] = constants.MAX_IOPS - elif tmp_max_iops.strip().isdigit() \ - and 0 <= int(tmp_max_iops.strip()) <= constants.MAX_IOPS_UPPER_LIMIT: - self.qos_config['max_iops'] = int(tmp_max_iops.strip()) - else: - err_msg = _("The max_iops in share type " - "must be int([0, %s]).") % constants.MAX_IOPS_UPPER_LIMIT - raise exception.InvalidInput(reason=err_msg) + self.qos_config['max_iops'] = 0 def _create_qos(self): qos_name = self.namespace_name @@ -219,21 +198,17 @@ def _get_update_qos_config(self, qos_specs): LOG.error(err_msg) raise exception.InvalidShare(reason=err_msg) - tmp_max_band_width = str(qos_specs.get('total_bytes_sec')) - if int(tmp_max_band_width) == 0: - self.qos_config['max_band_width'] = constants.MAX_BAND_WIDTH - elif (tmp_max_band_width.strip().isdigit() - and 0 <= int(int(tmp_max_band_width.strip()) / constants.BYTE_TO_MB) - <= constants.BAND_WIDTH_UPPER_LIMIT): - self.qos_config['max_band_width'] = int(math.ceil(float( - tmp_max_band_width.strip()) / constants.BYTE_TO_MB)) - - tmp_max_iops = str(qos_specs.get('total_iops_sec')) - if int(tmp_max_iops) == 0: - self.qos_config['max_iops'] = constants.MAX_IOPS - elif tmp_max_iops.strip().isdigit() \ - and 0 <= int(tmp_max_iops.strip()) <= constants.MAX_IOPS_UPPER_LIMIT: - self.qos_config['max_iops'] = int(tmp_max_iops.strip()) + # total_bytes_sec and total_iops_sec must be integer + tmp_max_band_width = str(qos_specs.get('total_bytes_sec')).strip() + tmp_max_iops = str(qos_specs.get('total_iops_sec')).strip() + if not (tmp_max_band_width.isdigit() and tmp_max_iops.isdigit()): + err_msg = "total_bytes_sec and total_iops_sec must be integer, " \ + "the qos_specs is {0}".format(qos_specs) + LOG.error(err_msg) + raise exception.InvalidShare(reason=err_msg) + + self.qos_config['max_band_width'] = int(math.ceil(float(tmp_max_band_width) / (1024 ** 2))) + self.qos_config['max_iops'] = int(tmp_max_iops) def _create_qos_when_update_qos(self, qos_name): try: