Swift backup driver fails to initialize unless backup_swift_url is set

Bug #1826434 reported by Alan Bishop
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Alan Bishop

Bug Description

Unless backup_swift_url is configured, the swift backup driver fails during service startup:

2019-04-23 07:20:49.511 35 ERROR oslo.service.loopingcall [-] Fixed interval looping call 'cinder.backup.manager.BackupManager._setup_backup_driver' failed: cinder.exception.BackupDriverException: Could not determine which Swift endpoint to use. This can either be set in the service catalog or with the cinder.conf config option 'backup_swift_url'.
2019-04-23 07:20:49.511 35 ERROR oslo.service.loopingcall Traceback (most recent call last):
2019-04-23 07:20:49.511 35 ERROR oslo.service.loopingcall File "/usr/lib/python3.6/site-packages/oslo_service/loopingcall.py", line 150, in _run_loop
2019-04-23 07:20:49.511 35 ERROR oslo.service.loopingcall result = func(*self.args, **self.kw)
2019-04-23 07:20:49.511 35 ERROR oslo.service.loopingcall File "/usr/lib/python3.6/site-packages/cinder/backup/manager.py", line 151, in _setup_backup_driver
2019-04-23 07:20:49.511 35 ERROR oslo.service.loopingcall backup_service = self.service(context=ctxt, db=self.db)
2019-04-23 07:20:49.511 35 ERROR oslo.service.loopingcall File "/usr/lib/python3.6/site-packages/cinder/backup/drivers/swift.py", line 159, in __init__
2019-04-23 07:20:49.511 35 ERROR oslo.service.loopingcall self.initialize()
2019-04-23 07:20:49.511 35 ERROR oslo.service.loopingcall File "/usr/lib/python3.6/site-packages/cinder/backup/drivers/swift.py", line 249, in initialize
2019-04-23 07:20:49.511 35 ERROR oslo.service.loopingcall "Could not determine which Swift endpoint to use. This "
2019-04-23 07:20:49.511 35 ERROR oslo.service.loopingcall cinder.exception.BackupDriverException: Could not determine which Swift endpoint to use. This can either be set in the service catalog or with the cinder.conf config option 'backup_swift_url'.
2019-04-23 07:20:49.511 35 ERROR oslo.service.loopingcall

This happens because the driver is trying to use the service catalog in the associated context, but on startup the catalog is empty. Traditionally, the swift driver takes care of this situation in its get_backup_driver [1]. However, with [1] that function is no longer called.

[1] https://opendev.org/openstack/cinder/src/branch/master/cinder/backup/drivers/swift.py#L402
[2] https://review.opendev.org/595372

The problem can be fixed by putting the same logic in the swift driver's constructor.

Changed in cinder:
assignee: nobody → Alan Bishop (alan-bishop)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.opendev.org/655765

Changed in cinder:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.opendev.org/655765
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=37997388725a4469624e2e14e1575301fa7cfcf7
Submitter: Zuul
Branch: master

commit 37997388725a4469624e2e14e1575301fa7cfcf7
Author: Alan Bishop <email address hidden>
Date: Thu Apr 25 14:40:48 2019 -0400

    Fix swift backup driver crashing during service startup

    This patch fixes a crash in the swift backup driver during service
    startup, when the backup_swift_url is None. When backup_swift_url is
    None, the initialization code tries to fetch swift's endpoint from the
    service catalog. However, this fails during service startup because the
    context is missing the information required to access the catalog.

    Closes-Bug: #1826434
    Change-Id: I7e7dbdae72a08e663a96b6c01340ec2a5cbe883e

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/stein)

Fix proposed to branch: stable/stein
Review: https://review.opendev.org/656537

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (stable/stein)

Reviewed: https://review.opendev.org/656537
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=8d8676381460d1719860f388929222eea436558d
Submitter: Zuul
Branch: stable/stein

commit 8d8676381460d1719860f388929222eea436558d
Author: Alan Bishop <email address hidden>
Date: Thu Apr 25 14:40:48 2019 -0400

    Fix swift backup driver crashing during service startup

    This patch fixes a crash in the swift backup driver during service
    startup, when the backup_swift_url is None. When backup_swift_url is
    None, the initialization code tries to fetch swift's endpoint from the
    service catalog. However, this fails during service startup because the
    context is missing the information required to access the catalog.

    Closes-Bug: #1826434
    Change-Id: I7e7dbdae72a08e663a96b6c01340ec2a5cbe883e
    (cherry picked from commit 37997388725a4469624e2e14e1575301fa7cfcf7)

tags: added: in-stable-stein
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 14.0.1

This issue was fixed in the openstack/cinder 14.0.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 15.0.0.0rc1

This issue was fixed in the openstack/cinder 15.0.0.0rc1 release candidate.

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.