Make backup_compression_algorithm case insensitive

Disaling compression is done by setting the
backup_compression_algorithm config option to None. The valid values is
has the option of "none" but our documentation stated "None". This
caused an error, but should be allowed.

Closes-bug: #1823852

Change-Id: I5ae6e715117d0e89a9d2641602f6b70a0ce94c69
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
(cherry picked from commit 0c1e261c8b)
This commit is contained in:
Sean McGinnis 2019-04-09 06:52:01 -05:00
parent 47726fb3ad
commit bcf25eb024
2 changed files with 10 additions and 0 deletions

View File

@ -50,6 +50,7 @@ LOG = logging.getLogger(__name__)
backup_opts = [
cfg.StrOpt('backup_compression_algorithm',
default='zlib',
ignore_case=True,
choices=['none', 'off', 'no',
'zlib', 'gzip',
'bz2', 'bzip2'],

View File

@ -309,6 +309,15 @@ class BackupSwiftTestCase(test.TestCase):
backup = objects.Backup.get_by_id(self.ctxt, fake.BACKUP_ID)
service.backup(backup, self.volume_file)
def test_backup_uncompressed_casing(self):
volume_id = '2b9f10a3-42b4-dead-b316-000000ceb039'
self._create_backup_db_entry(volume_id=volume_id)
self.flags(backup_compression_algorithm='None')
service = swift_dr.SwiftBackupDriver(self.ctxt)
self.volume_file.seek(0)
backup = objects.Backup.get_by_id(self.ctxt, fake.BACKUP_ID)
service.backup(backup, self.volume_file)
def test_backup_bz2(self):
volume_id = 'dc0fee35-b44e-4f13-80d6-000000e1b50c'
self._create_backup_db_entry(volume_id=volume_id)