diff --git a/python/cloudtik/providers/_private/huaweicloud/config.py b/python/cloudtik/providers/_private/huaweicloud/config.py index a4f3f6364..9d066c692 100644 --- a/python/cloudtik/providers/_private/huaweicloud/config.py +++ b/python/cloudtik/providers/_private/huaweicloud/config.py @@ -68,7 +68,7 @@ from cloudtik.providers._private.huaweicloud.utils import _get_node_info, \ _make_ecs_client, _make_obs_client, \ _make_vpc_client, export_huaweicloud_obs_storage_config, flat_tags_map, \ - get_huaweicloud_obs_storage_config, \ + get_huaweicloud_cloud_storage_uri, get_huaweicloud_obs_storage_config, \ get_huaweicloud_obs_storage_config_for_update, HWC_OBS_BUCKET, \ HWC_SERVER_STATUS_ACTIVE, make_ecs_client, \ make_eip_client, \ @@ -1075,13 +1075,12 @@ def get_huaweicloud_workspace_info(config): bucket_name = _get_managed_obs_bucket(obs_client, workspace_name) if bucket_name: - resp = obs_client.getBucketLocation(bucket_name) - if resp.status < 300: - managed_cloud_storage_uri = resp.body.location - managed_cloud_storage = { - HWC_MANAGED_CLOUD_STORAGE_OBS_BUCKET: bucket_name, - CLOUDTIK_MANAGED_CLOUD_STORAGE_URI: managed_cloud_storage_uri} - info[CLOUDTIK_MANAGED_CLOUD_STORAGE] = managed_cloud_storage + cloud_storage_uri = get_huaweicloud_cloud_storage_uri( + {HWC_OBS_BUCKET: bucket_name}) + managed_cloud_storage = { + HWC_MANAGED_CLOUD_STORAGE_OBS_BUCKET: bucket_name, + CLOUDTIK_MANAGED_CLOUD_STORAGE_URI: cloud_storage_uri} + info[CLOUDTIK_MANAGED_CLOUD_STORAGE] = managed_cloud_storage return info diff --git a/python/cloudtik/providers/_private/huaweicloud/utils.py b/python/cloudtik/providers/_private/huaweicloud/utils.py index 7199d397b..f62e39ef7 100644 --- a/python/cloudtik/providers/_private/huaweicloud/utils.py +++ b/python/cloudtik/providers/_private/huaweicloud/utils.py @@ -98,7 +98,10 @@ def _client_cache(region: str = None, ak: str = None, sk: str = None) -> Dict[ server=OBS_SERVICES_URL, ssl_verify=_ssl_verify, region=region) else: - obs_client = ObsClient(server=OBS_SERVICES_URL, ssl_verify=_ssl_verify, + # Enable OBSClient (ENV, ECS) security provider policy chain, see + # https://support.huaweicloud.com/sdk-python-devg-obs/obs_22_0601.html + obs_client = ObsClient(security_provider_policy='OBS_DEFAULT', + server=OBS_SERVICES_URL, ssl_verify=_ssl_verify, region=region) client_map['obs'] = obs_client