charm-cinder-backup-swift-proxy installed python-swiftclient wrong parsing on swift endpoint url

Bug #1877674 reported by Yanos Angelopoulos
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juju Charms Collection
New
Undecided
Unassigned

Bug Description

In our case, we wanted to use a Swift endpoint on Ceph (ceph-radosgw) for our volume backups.

We used the charm "cinder-backup-swift-proxy".
Among other packages, it also installs the apt package "python3-swiftclient".

In the charm options we used the field:
endpoint-url: "https://radosgw-endpoint:80/swift/"

The fact that the endpoint URL contains a path after the port (swift/) resulted in the following error:

2020-05-08 18:59:43.374 39951 ERROR oslo.service.loopingcall [-] Fixed interval looping call 'cinder.backup.manager.BackupManager._setup_backup_driver' failed: swiftclient.exceptions.ClientException: Capabilities GET failed: https://radosgw-endpoint:80/info 404 Not Found [first 60 chars of response] b'<?xml version="1.0" encoding="UTF-8"?><Error><Code>NoSuchBucket'
2020-05-08 18:59:43.374 39951 ERROR oslo.service.loopingcall Traceback (most recent call last):
2020-05-08 18:59:43.374 39951 ERROR oslo.service.loopingcall File "/usr/lib/python3/dist-packages/oslo_service/loopingcall.py", line 150, in _run_loop
2020-05-08 18:59:43.374 39951 ERROR oslo.service.loopingcall result = func(*self.args, **self.kw)
2020-05-08 18:59:43.374 39951 ERROR oslo.service.loopingcall File "/usr/lib/python3/dist-packages/cinder/backup/manager.py", line 163, in _setup_backup_driver
2020-05-08 18:59:43.374 39951 ERROR oslo.service.loopingcall backup_service.check_for_setup_error()
2020-05-08 18:59:43.374 39951 ERROR oslo.service.loopingcall File "/usr/lib/python3/dist-packages/cinder/backup/drivers/swift.py", line 394, in check_for_setup_error
2020-05-08 18:59:43.374 39951 ERROR oslo.service.loopingcall conn.get_capabilities()
2020-05-08 18:59:43.374 39951 ERROR oslo.service.loopingcall File "/usr/lib/python3/dist-packages/swiftclient/client.py", line 1928, in get_capabilities
2020-05-08 18:59:43.374 39951 ERROR oslo.service.loopingcall return get_capabilities((parsed, self.http_conn[1]))
2020-05-08 18:59:43.374 39951 ERROR oslo.service.loopingcall File "/usr/lib/python3/dist-packages/swiftclient/client.py", line 1565, in get_capabilities
2020-05-08 18:59:43.374 39951 ERROR oslo.service.loopingcall resp, 'Capabilities GET failed', body)
2020-05-08 18:59:43.374 39951 ERROR oslo.service.loopingcall swiftclient.exceptions.ClientException: Capabilities GET failed: https://radosgw-endpoint:80/info 404 Not Found [first 60 chars of response] b'<?xml version="1.0" encoding="UTF-8"?><Error><Code>NoSuchBucket'

So the URL given was: "https://radosgw-endpoint:80/swift/"
but the URL used was: "https://radosgw-endpoint:80/info/" instead of "https://radosgw-endpoint:80/swift/info/"

This happens because of the python3-swiftclient code, in file "/usr/lib/python3/dist-packages/swiftclient/client.py" in line 1921:

    def get_capabilities(self, url=None):
        url = url or self.url
        if not url:
            url, _ = self.get_auth()
        parsed = urlparse(urljoin(url, '/info'))
        if not self.http_conn:
            self.http_conn = self.http_connection(url)
        return get_capabilities((parsed, self.http_conn[1]))

The line "parsed = urlparse(urljoin(url, '/info'))" removes the existing path ("/swift") from the url.

This issue seems to be fixed in the master branch of "python-swiftclient":
https://opendev.org/openstack/python-swiftclient/src/branch/master/swiftclient/client.py

I think we need an updated version on python3-swiftclient for the apt package.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.