diff options
author | Zuul <zuul@review.opendev.org> | 2023-03-22 16:00:44 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2023-03-22 16:00:44 +0000 |
commit | 31c279ff0ea0d1ede1a118d7189dcd009c14e23a (patch) | |
tree | 7db9558ffb740364a787ca34c0619b4c458eb2b0 /swiftclient/service.py | |
parent | cd82d15506307326afb2497e704df89ef04fb6f6 (diff) | |
parent | 6a8675e897e634abd26d993181ac4a45b9cf16f7 (diff) | |
download | python-swiftclient-31c279ff0ea0d1ede1a118d7189dcd009c14e23a.tar.gz |
Merge "Use SLO by default for segmented uploads if the cluster supports it"
Diffstat (limited to 'swiftclient/service.py')
-rw-r--r-- | swiftclient/service.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/swiftclient/service.py b/swiftclient/service.py index e905ea6..dd71409 100644 --- a/swiftclient/service.py +++ b/swiftclient/service.py @@ -196,7 +196,7 @@ _default_global_options = _build_default_global_options() _default_local_options = { 'sync_to': None, 'sync_key': None, - 'use_slo': False, + 'use_slo': None, 'segment_size': None, 'segment_container': None, 'leave_segments': False, @@ -1467,7 +1467,7 @@ class SwiftService: 'meta': [], 'header': [], 'segment_size': None, - 'use_slo': False, + 'use_slo': True, 'segment_container': None, 'leave_segments': False, 'changed': None, @@ -1493,6 +1493,18 @@ class SwiftService: except ValueError: raise SwiftError('Segment size should be an integer value') + if segment_size and options['use_slo'] is None: + try: + cap_result = self.capabilities() + except ClientException: + # pre-info swift, maybe? assume no slo middleware + options['use_slo'] = False + else: + if not cap_result['success']: + options['use_slo'] = False + else: + options['use_slo'] = 'slo' in cap_result['capabilities'] + # Incase we have a psudeo-folder path for <container> arg, derive # the container name from the top path and prepend the rest to # the object name. (same as passing --object-name). |