'This waits for a 3PAR background task complete or fail.
This looks for a task to get out of the \'active\' state.'

def _wait_for_task_completion(self, task_id):

    def _wait_for_task(task_id):
        status = self.client.getTask(task_id)
        LOG.debug('3PAR    Task    id    %(id)s    status    =    %(status)s', {'id': task_id, 'status': status['status']})
        if (status['status'] is not self.client.TASK_ACTIVE):
            self._task_status = status
            raise loopingcall.LoopingCallDone()
    self._task_status = None
    timer = loopingcall.FixedIntervalLoopingCall(_wait_for_task, task_id)
    timer.start(interval=1).wait()
    return self._task_status
