'Execute the rsync binary to replicate a partition.
:returns: return code of rsync process. 0 is successful'

def _rsync(self, args):

    start_time = time.time()
    ret_val = None
    try:
        with Timeout(self.rsync_timeout):
            proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
            results = proc.stdout.read()
            ret_val = proc.wait()
    except Timeout:
        self.logger.error(_('Killing    long-running    rsync:    %s'), str(args))
        proc.kill()
        return 1
    total_time = (time.time() - start_time)
    for result in results.split('\n'):
        if (result == ''):
            continue
        if result.startswith('cd+'):
            continue
        if (not ret_val):
            self.logger.info(result)
        else:
            self.logger.error(result)
    if ret_val:
        error_line = (_('Bad    rsync    return    code:    %(ret)d    <-    %(args)s') % {'args': str(args), 'ret': ret_val})
        if self.rsync_error_log_line_length:
            error_line = error_line[:self.rsync_error_log_line_length]
        self.logger.error(error_line)
    else:
        log_method = (self.logger.info if results else self.logger.debug)
        log_method(_('Successful    rsync    of    %(src)s    at    %(dst)s    (%(time).03f)'), {'src': args[(-2)], 'dst': args[(-1)], 'time': total_time})
    return ret_val
