Cinder Backup: object_count value incorrect
Whenever we create a backup, the object_count value doesn't match with the actual number of objects created. This patch addresses the change. Co-authored-by: wanghongxu <wang19930902@gmail.com> Change-Id: I972df393fe64ca55fcdaa629f03cfc10761f0f24 Closes-Bug: #1685731
This commit is contained in:
parent
fccd84cb2e
commit
84d2a8b09d
|
@ -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'])
|
||||
|
||||
|
|
|
@ -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 = {}
|
||||
|
|
Loading…
Reference in New Issue