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 8cc4df1..671cc80 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 @@ -416,6 +416,11 @@ def _get_namespace_name_from_location(self, export_location): self.namespace_name = export_location.split('\\')[-1].split('/')[-1] def _get_dtree_quota_info(self, action, parent_id, new_size, parent_type): + if not parent_id: + error_msg = (_("%s share failed because of dtree not exist") % action) + LOG.error(error_msg) + raise exception.InvalidInput(reason=error_msg) + dtree_quota = self.helper.query_quota_by_parent(parent_id, parent_type) cur_size = float(dtree_quota.get('space_used', 0.0)) / constants.CAPACITY_UNIT_BYTE_TO_GB cur_size = math.ceil(cur_size) diff --git a/Manila/file_driver_dir/huawei/oceanstorPacific/helper/helper.py b/Manila/file_driver_dir/huawei/oceanstorPacific/helper/helper.py index 366263f..02cdd5f 100644 --- a/Manila/file_driver_dir/huawei/oceanstorPacific/helper/helper.py +++ b/Manila/file_driver_dir/huawei/oceanstorPacific/helper/helper.py @@ -1026,9 +1026,9 @@ def query_dtree_by_name(self, dtree_name, namespace_id): data = jsonutils.dumps(query_para) result = self.call(url, data, "GET") - if result.get('result', {}).get('code') == 0 and result.get('data'): + if result.get('result', {}).get('code') == 0: LOG.info(_("Query dtree success.(dtree_name: {0})".format(dtree_name))) - elif result.get('result', {}).get('code') == constants.DTREE_NOT_EXIST and not result.get('data'): + elif result.get('result', {}).get('code') == constants.DTREE_NOT_EXIST or not result.get('data'): LOG.info(_("Query dtree does not exist.(dtree_name: {0})".format(dtree_name))) else: err_msg = _("Query dtree_name({0}) failed".format(dtree_name))