Fix Error handle and logs
diff --git a/staffeln/conductor/backup.py b/staffeln/conductor/backup.py
index 3deff7f..8394187 100755
--- a/staffeln/conductor/backup.py
+++ b/staffeln/conductor/backup.py
@@ -180,7 +180,8 @@
 
         except OpenstackSDKException as e:
             reason = _("Backup %s deletion failed. %s" % (task.backup_id, str(e)[:64]))
-            LOG.info(reason)
+            log_msg = _("Backup %s deletion failed. %s" % (task.backup_id, str(e)))
+            LOG.warn(log_msg)
             task.reason = reason
             task.backup_status = constants.BACKUP_FAILED
             task.save()
@@ -217,7 +218,7 @@
                 )
 
         except OpenstackSDKException as e:
-            LOG.info(
+            LOG.warn(
                 _("Backup %s deletion failed." "%s" % (backup_object.backup_id, str(e)))
             )
             # TODO(Alex): Add it into the notification queue
@@ -249,8 +250,8 @@
             self.openstacksdk.delete_backup(uuid=backup_object.backup_id)
             backup_object.delete_backup()
 
-        except OpenstackSDKException as e:
-            LOG.info(
+        except Exception as e:
+            LOG.warn(
                 _(
                     "Backup %s deletion failed. Need to delete manually."
                     "%s" % (backup_object.backup_id, str(e))
@@ -467,21 +468,36 @@
                 task.backup_status = constants.BACKUP_WIP
                 task.save()
             except OpenstackSDKException as error:
-                reason = _(
-                    "Backup (name: %s) creation for the volume %s failled. %s"
-                    % (backup_name, task.volume_id, str(error)[:64])
-                )
-                LOG.info(reason)
-                task.reason = reason
-                task.backup_status = constants.BACKUP_FAILED
-                task.save()
+                inc_err_msg = "No backups available to do an incremental backup"
+                if inc_err_msg in str(error):
+                    LOG.info(
+                        "Retry to create full backup for volume %s instead of incremental."
+                        % task.volume_id
+                    )
+                    task.incremental = False
+                    task.save()
+                else:
+                    reason = _(
+                        "Backup (name: %s) creation for the volume %s failled. %s"
+                        % (backup_name, task.volume_id, str(error)[:64])
+                    )
+                    LOG.warn(
+                        "Backup (name: %s) creation for the volume %s failled. %s"
+                        % (backup_name, task.volume_id, str(error))
+                    )
+                    task.reason = reason
+                    task.backup_status = constants.BACKUP_FAILED
+                    task.save()
             # Added extra exception as OpenstackSDKException does not handle the keystone unauthourized issue.
             except Exception as error:
                 reason = _(
                     "Backup (name: %s) creation for the volume %s failled. %s"
                     % (backup_name, task.volume_id, str(error)[:64])
                 )
-                LOG.error(reason)
+                LOG.warn(
+                    "Backup (name: %s) creation for the volume %s failled. %s"
+                    % (backup_name, task.volume_id, str(error))
+                )
                 task.reason = reason
                 task.backup_status = constants.BACKUP_FAILED
                 task.save()
@@ -509,7 +525,7 @@
         try:
             self.openstacksdk.delete_backup(uuid=task.backup_id, force=True)
         except OpenstackHttpException as ex:
-            LOG.error(
+            LOG.warn(
                 _(
                     "Failed to delete volume backup %s. %s. Need to delete manually."
                     % (task.backup_id, str(ex))
diff --git a/staffeln/conductor/manager.py b/staffeln/conductor/manager.py
index a8d69a0..a105fc1 100755
--- a/staffeln/conductor/manager.py
+++ b/staffeln/conductor/manager.py
@@ -200,17 +200,17 @@
             self.controller.hard_remove_volume_backup(retention_backup)

 

     def is_retention(self, backup):

+        now = datetime.now()

+        backup_age = now.astimezone() - backup.created_at

         # see if need to be delete.

         if backup.instance_id in self.instance_retention_map:

-            now = datetime.now()

             retention_time = now - self.get_time_from_str(

                 self.instance_retention_map[backup.instance_id]

             )

-            backup_age = now - backup.created_at

             if backup_age > retention_time:

                 # Backup remain longer than retention, need to purge it.

                 return True

-        elif self.threshold_strtime.astimezone() < backup.created_at:

+        elif now - self.threshold_strtime < backup_age:

             return True

         return False

 

diff --git a/staffeln/conf/conductor.py b/staffeln/conf/conductor.py
index 4ac69c9..1032ab4 100755
--- a/staffeln/conf/conductor.py
+++ b/staffeln/conf/conductor.py
@@ -74,7 +74,7 @@
     ),
     cfg.IntOpt(
         "retention_service_period",
-        default=20,
+        default=1200,
         min=10,
         help=_("The period of the retention service, the unit is one second."),
     ),