Exemplo n.º 1
0
 def _get_progress(synced):
     if not os.path.exists(PFILE):
         return synced
     last = linux.tail_1(PFILE).strip()
     if not last or not last.isdigit():
         return synced
     report.progress_report(int(last) * 90 / 100, "report")
     return synced
Exemplo n.º 2
0
 def _get_progress(synced):
     logger.debug("getProgress in add image")
     if not os.path.exists(PFILE):
         return synced
     last = linux.tail_1(PFILE).strip()
     if not last or not last.isdigit():
         return synced
     report.progress_report(int(last)*90/100, "report")
     return synced
Exemplo n.º 3
0
 def _get_progress(synced):
     logger.debug("getProgress in check_md5")
     if not os.path.exists(PFILE):
         return synced
     last = linux.tail_1(PFILE).strip()
     if not last or not last.isdigit():
         return synced
     percent = int(round((float(written) * 100 + os.path.getsize(to.path) * float(last)) / total * (end - start) / 100) + start)
     report.progress_report(percent, "report")
     return synced
Exemplo n.º 4
0
 def _get_progress(synced):
     logger.debug("getProgress in check_md5")
     if not os.path.exists(PFILE):
         return synced
     last = linux.tail_1(PFILE).strip()
     if not last or not last.isdigit():
         return synced
     percent = int(
         round((float(written) * 100 +
                os.path.getsize(to.path) * float(last)) / total *
               (end - start) / 100) + start)
     report.progress_report(percent, "report")
     return synced
Exemplo n.º 5
0
 def _getProgress(synced):
     last = linux.tail_1(PFILE).strip()
     if not last or len(last.split(
     )) < 1 or 'HTTP request sent, awaiting response' in last:
         return synced
     logger.debug("last synced: %s" % last)
     written = _getRealSize(last.split()[0])
     if total > 0 and synced < written:
         synced = written
         if synced < total:
             percent = int(round(float(synced) / float(total) * 90))
             report.progress_report(percent, "report")
     return synced
Exemplo n.º 6
0
 def _getProgress(synced):
     logger.debug("getProgress in ceph-bs-agent, synced: %s, total: %s" % (synced, total))
     last = linux.tail_1(PFILE).strip()
     if not last or len(last.split()) < 1 or 'HTTP request sent, awaiting response' in last:
         return synced
     logger.debug("last synced: %s" % last)
     written = _getRealSize(last.split()[0])
     if total > 0 and synced < written:
         synced = written
         if synced < total:
             percent = int(round(float(synced) / float(total) * 90))
             report.progress_report(percent, "report")
     return synced