Dan Kenigsberg has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop
......................................................................
Patch Set 22: Code-Review-1
(2 comments)
http://gerrit.ovirt.org/#/c/25976/22/vdsm/virt/migration.py
File vdsm/virt/migration.py:
Line 415: while not self._stop.isSet():
Line 416: self._stop.wait(self._MONITOR_TICK)
Line 417: for action in actions:
Line 418: action(step)
Line 419: step += self._MONITOR_TICK
"step" has to be integer - there are no 1.2 steps. It's not just a matter of
names (see next comment), but I think things woul dbecome simpler if you track elapsed
time.
Line 420:
Line 421: self._vm.log.debug('migration monitor thread exiting')
Line 422:
Line 423: def monitor_migration(self, step):
Line 426: return 100
Line 427: progress = 100 - 100 * remaining / total if total else 0
Line 428: return progress if (progress < 100) else 99
Line 429:
Line 430: if step % self._MONITOR_INTERVAL == 0: # each _MONITOR_INTERVAL ticks
this would not work if someone sets a non-integer _MONITOR_TICK: for example,
10 % 0.2 != 0
as a rule, floating point arithmetic should be avoided.
Line 431: (jobType, timeElapsed, _,
Line 432: dataTotal, dataProcessed, dataRemaining,
Line 433: memTotal, memProcessed, memRemaining,
Line 434: fileTotal, fileProcessed, _) = self._vm._dom.jobInfo()
--
To view, visit
http://gerrit.ovirt.org/25976
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie422bead060c8ba2bfd4bfada522b91d56697841
Gerrit-PatchSet: 22
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Vinzenz Feenstra <vfeenstr(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes