Fix creation of full backup when using cindernative incremental

Per configuration freezer should firstly create full backup
automatically if there are no backups for job and config options
incremental=True, mode=cindernative are set. This patch is fixing this.

From config:
>> # When the option is set, freezer will perform a cindernative
   incremental backup instead of the default full backup. And if True,
   but volume do not have a base full backup, freezer will do a full backup
   first.
>> #incremental = <None>

Change-Id: Ib56c5528bcdedc34c16c209488c7439250dd85e1
This commit is contained in:
Michal Arbet 2020-02-02 18:49:17 +01:00
parent a440501ab6
commit a197c8caf8
1 changed files with 2 additions and 4 deletions

View File

@ -97,10 +97,8 @@ class BackupOs(object):
} }
backups = cinder.backups.list(search_opts=search_opts) backups = cinder.backups.list(search_opts=search_opts)
if len(backups) <= 0: if len(backups) <= 0:
msg = ("Backup volume %s is failed." cinder.backups.create(volume_id, container, name, description,
"Do a full backup before incremental backup" incremental=False, force=True)
% volume_id)
raise Exception(msg)
else: else:
cinder.backups.create(volume_id, container, name, description, cinder.backups.create(volume_id, container, name, description,
incremental=incremental, force=True) incremental=incremental, force=True)