'Checks for the job till completed.'

def _check_clone_status(self, clone_id, vol_uuid, name, new_name):

    clone_status = netapp_api.NaElement('clone-list-status')
    cl_id = netapp_api.NaElement('clone-id')
    clone_status.add_child_elem(cl_id)
    cl_id.add_node_with_children('clone-id-info', **{'clone-op-id': clone_id, 'volume-uuid': vol_uuid})
    running = True
    clone_ops_info = None
    while running:
        result = self.connection.invoke_successfully(clone_status, True)
        status = result.get_child_by_name('status')
        ops_info = status.get_children()
        if ops_info:
            for info in ops_info:
                if (info.get_child_content('clone-state') == 'running'):
                    time.sleep(1)
                    break
                else:
                    running = False
                    clone_ops_info = info
                    break
    else:
        if clone_ops_info:
            fmt = {'name': name, 'new_name': new_name}
            if (clone_ops_info.get_child_content('clone-state') == 'completed'):
                LOG.debug('Clone    operation    with    src    %(name)s    and    dest    %(new_name)s    completed', fmt)
            else:
                LOG.debug('Clone    operation    with    src    %(name)s    and    dest    %(new_name)s    failed', fmt)
                raise netapp_api.NaApiError(clone_ops_info.get_child_content('error'), clone_ops_info.get_child_content('reason'))
