From 0c1e261c8b73b07e1fd8d5e6d8f03998fec0fc8c Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Tue, 9 Apr 2019 06:52:01 -0500 Subject: [PATCH] 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 --- cinder/backup/chunkeddriver.py | 1 + cinder/tests/unit/backup/drivers/test_backup_swift.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/cinder/backup/chunkeddriver.py b/cinder/backup/chunkeddriver.py index 6ca786b5088..7954705ffaa 100644 --- a/cinder/backup/chunkeddriver.py +++ b/cinder/backup/chunkeddriver.py @@ -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'], diff --git a/cinder/tests/unit/backup/drivers/test_backup_swift.py b/cinder/tests/unit/backup/drivers/test_backup_swift.py index 401542334e3..d318fa369d9 100644 --- a/cinder/tests/unit/backup/drivers/test_backup_swift.py +++ b/cinder/tests/unit/backup/drivers/test_backup_swift.py @@ -308,6 +308,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)