Merge "Fix broken backup_swift_service_auth=True" into stable/2024.1
This commit is contained in:
commit
0ff4262fba
cinder
releasenotes/notes
@ -192,7 +192,8 @@ class SwiftBackupDriver(chunkeddriver.ChunkedBackupDriver):
|
|||||||
|
|
||||||
sa_plugin = service_auth.get_service_auth_plugin()
|
sa_plugin = service_auth.get_service_auth_plugin()
|
||||||
if sa_plugin is not None:
|
if sa_plugin is not None:
|
||||||
result['X-Service-Token'] = sa_plugin.get_token()
|
sa_session = service_auth.get_service_session()
|
||||||
|
result['X-Service-Token'] = sa_plugin.get_token(session=sa_session)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ from cinder import exception
|
|||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
_SERVICE_AUTH = None
|
_SERVICE_AUTH = None
|
||||||
|
_SERVICE_SESSION = None
|
||||||
|
|
||||||
SERVICE_USER_GROUP = 'service_user'
|
SERVICE_USER_GROUP = 'service_user'
|
||||||
|
|
||||||
@ -66,6 +67,16 @@ def get_service_auth_plugin():
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def get_service_session():
|
||||||
|
if CONF.service_user.send_service_user_token:
|
||||||
|
global _SERVICE_SESSION
|
||||||
|
if not _SERVICE_SESSION:
|
||||||
|
_SERVICE_SESSION = ks_loading.load_session_from_conf_options(
|
||||||
|
CONF, SERVICE_USER_GROUP, auth=get_service_auth_plugin())
|
||||||
|
return _SERVICE_SESSION
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_auth_plugin(context, auth=None):
|
def get_auth_plugin(context, auth=None):
|
||||||
if auth:
|
if auth:
|
||||||
user_auth = auth
|
user_auth = auth
|
||||||
|
@ -317,7 +317,7 @@ class BackupSwiftTestCase(test.TestCase):
|
|||||||
@mock.patch.object(service_auth, 'get_service_auth_plugin')
|
@mock.patch.object(service_auth, 'get_service_auth_plugin')
|
||||||
def test_backup_swift_service_auth_headers_enabled(self, mock_plugin):
|
def test_backup_swift_service_auth_headers_enabled(self, mock_plugin):
|
||||||
class FakeServiceAuthPlugin:
|
class FakeServiceAuthPlugin:
|
||||||
def get_token(self):
|
def get_token(self, session):
|
||||||
return "fake"
|
return "fake"
|
||||||
self.override_config('send_service_user_token', True,
|
self.override_config('send_service_user_token', True,
|
||||||
group='service_user')
|
group='service_user')
|
||||||
|
6
releasenotes/notes/bug-2058596-3c676e7fdc642b3d.yaml
Normal file
6
releasenotes/notes/bug-2058596-3c676e7fdc642b3d.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
`Bug #2058596 <https://bugs.launchpad.net/cinder/+bug/2058596>`_: Fixed
|
||||||
|
broken ``backup_swift_service_auth=True`` which made swift backup driver
|
||||||
|
consistently fail during object data access.
|
Loading…
x
Reference in New Issue
Block a user