コード例 #1
0
ファイル: cephagent.py プロジェクト: tsunli/zstack-utility
 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
コード例 #2
0
ファイル: cephagent.py プロジェクト: zstackorg/zstack-utility
 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
コード例 #3
0
ファイル: zses.py プロジェクト: zstackorg/zstack-utility
 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
コード例 #4
0
ファイル: localstorage.py プロジェクト: ilibx/zstack-utility
 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
コード例 #5
0
ファイル: cephagent.py プロジェクト: tsunli/zstack-utility
 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
コード例 #6
0
ファイル: cephagent.py プロジェクト: zstackorg/zstack-utility
 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