Add BACKUP_INIT task status for queue task

This allow us to re-pulling task status and check if it still
need to trigger action.
diff --git a/staffeln/common/constants.py b/staffeln/common/constants.py
index 20f462e..b7d6d09 100644
--- a/staffeln/common/constants.py
+++ b/staffeln/common/constants.py
@@ -1,3 +1,4 @@
+BACKUP_INIT = 4
 BACKUP_FAILED = 3
 BACKUP_COMPLETED = 2
 BACKUP_WIP = 1
diff --git a/staffeln/conductor/backup.py b/staffeln/conductor/backup.py
index 19659c2..05f5cfd 100755
--- a/staffeln/conductor/backup.py
+++ b/staffeln/conductor/backup.py
@@ -107,6 +107,13 @@
         )
         return queues
 
+    def get_queue_task_by_id(self, task_id):
+        """Get single volume queue task from the queue_data table"""
+        queue = objects.Queue.get_by_id(  # pylint: disable=E1120
+            context=self.ctx, id=task_id
+        )
+        return queue
+
     def create_queue(self, old_tasks):
         """
         Create the queue of all the volumes for backup
diff --git a/staffeln/conductor/manager.py b/staffeln/conductor/manager.py
index 0f876c6..6a3ae7c 100755
--- a/staffeln/conductor/manager.py
+++ b/staffeln/conductor/manager.py
@@ -112,7 +112,12 @@
             for task in tasks_to_start:

                 with lock.Lock(self.lock_mgt, task.volume_id) as t_lock:

                     if t_lock.acquired:

-                        self.controller.create_volume_backup(task)

+                        # Re-pulling status and make it's up-to-date

+                        task = self.controller.get_queue_task_by_id(task_id=task.id)

+                        if task.backup_status == constants.BACKUP_PLANNED:

+                            task.backup_status = constants.BACKUP_INIT

+                            task.save()

+                            self.controller.create_volume_backup(task)

 

     # Refresh the task queue

     def _update_task_queue(self):

diff --git a/staffeln/db/sqlalchemy/api.py b/staffeln/db/sqlalchemy/api.py
index ff2fcfd..3cda5e7 100644
--- a/staffeln/db/sqlalchemy/api.py
+++ b/staffeln/db/sqlalchemy/api.py
@@ -314,7 +314,7 @@
             LOG.error("Queue resource not found.")
 
     def get_queue_by_id(self, context, id):
-        """Get the column from queue_data with matching backup_id"""
+        """Get the column from queue_data with matching id"""
         return self._get_queue(context, fieldname="id", value=id)
 
     def _get_queue(self, context, fieldname, value):
diff --git a/staffeln/objects/queue.py b/staffeln/objects/queue.py
index c6b1177..db49c21 100644
--- a/staffeln/objects/queue.py
+++ b/staffeln/objects/queue.py
@@ -36,7 +36,7 @@
 
     @base.remotable_classmethod
     def get_by_id(cls, context, id):  # pylint: disable=E0213
-        """Find a backup based on backup_id
+        """Find a queue task based on id
         :param context: Security context. NOTE: This should only
                         be used internally by the indirection_api.
                         Unfortunately, RPC requires context as the first