diff --git a/cinder/backup/chunkeddriver.py b/cinder/backup/chunkeddriver.py index 2af9c6a0a64..8a3fef5bed5 100644 --- a/cinder/backup/chunkeddriver.py +++ b/cinder/backup/chunkeddriver.py @@ -427,7 +427,12 @@ class ChunkedBackupDriver(driver.BackupDriver): object_list, volume_meta, extra_metadata) - backup.object_count = object_id + # NOTE(whoami-rajat) : The object_id variable is used to name + # the backup objects and hence differs from the object_count + # variable, therefore the increment of object_id value in the last + # iteration of _backup_chunk() method shouldn't be reflected in the + # object_count variable. + backup.object_count = object_id - 1 backup.save() LOG.debug('backup %s finished.', backup['id']) diff --git a/cinder/tests/unit/backup/test_chunkeddriver.py b/cinder/tests/unit/backup/test_chunkeddriver.py index 4f084b93649..c9928e840c7 100644 --- a/cinder/tests/unit/backup/test_chunkeddriver.py +++ b/cinder/tests/unit/backup/test_chunkeddriver.py @@ -397,11 +397,7 @@ class ChunkedDriverTestCase(test.TestCase): object_meta, object_sha256) - # TODO(smcginnis): Object count is either misnamed or we use it in an - # odd way. We increment the object count from 1, so writing one chunk - # results in an object count of 2. Should probably straighten that out - # at some point. - self.assertEqual(2, self.backup.object_count) + self.assertEqual(1, self.backup.object_count) def test_backup_metadata(self): object_meta = {}