Francesco Romani has uploaded a new change for review.
Change subject: virt: migration: add monitor thread control loop ......................................................................
virt: migration: add monitor thread control loop
This patch introduces a control loop in the monitor thread to factor out the scheduling logic from the worker method.
This is a necessary step toward the integration of the MigrationMonitor and MigrationDowntime threads.
Change-Id: Ie422bead060c8ba2bfd4bfada522b91d56697841 Signed-off-by: Francesco Romani fromani@redhat.com --- M vdsm/migration.py 1 file changed, 24 insertions(+), 23 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/76/25976/1
diff --git a/vdsm/migration.py b/vdsm/migration.py index 3699ca5..1234471 100644 --- a/vdsm/migration.py +++ b/vdsm/migration.py @@ -392,30 +392,34 @@ return MigrationMonitorThread._MIGRATION_MONITOR_INTERVAL > 0
def run(self): - if self.enabled: - self.monitor_migration() - else: - self.idle() + self._vm.log.debug('starting migration monitor thread')
- def monitor_migration(self): + step = 1 + self._lastProgressTime = time.time() + self._lowmark = None + + while not self._stop.isSet(): + self._stop.wait(1.0) + if self.enabled: + self.monitor_migration(step) + step += 1 + + self._vm.log.debug('migration monitor thread exiting') + + def monitor_migration(self, step): def calculateProgress(remaining, total): if remaining == 0: return 100 progress = 100 - 100 * remaining / total if total else 0 return progress if (progress < 100) else 99
- self._vm.log.debug('starting migration monitor thread') - memSize = int(self._vm.conf['memSize']) maxTimePerGiB = config.getint('vars', 'migration_max_time_per_gib_mem') migrationMaxTime = (maxTimePerGiB * memSize + 1023) / 1024 - lastProgressTime = time.time() - lowmark = None progress_timeout = config.getint('vars', 'migration_progress_timeout')
- while not self._stop.isSet(): - self._stop.wait(self._MIGRATION_MONITOR_INTERVAL) + if step % self._MIGRATION_MONITOR_INTERVAL == 0: (jobType, timeElapsed, _, dataTotal, dataProcessed, dataRemaining, memTotal, memProcessed, memRemaining, @@ -432,39 +436,36 @@ now - self._startTime, migrationMaxTime) abort = True - elif (lowmark is None) or (lowmark > dataRemaining): - lowmark = dataRemaining - lastProgressTime = now - elif (now - lastProgressTime) > progress_timeout: + elif (self._lowmark is None) or (self._lowmark > dataRemaining): + self._lowmark = dataRemaining + self._lastProgressTime = now + elif (now - self._lastProgressTime) > progress_timeout: # Migration is stuck, abort self._vm.log.warn( 'Migration is stuck: Hasn't progressed in %s seconds. ' - 'Aborting.' % (now - lastProgressTime)) + 'Aborting.' % (now - self._lastProgressTime)) abort = True
if abort: self._vm._dom.abortJob() self.stop() - break + return
- if dataRemaining > lowmark: + if dataRemaining > self._lowmark: self._vm.log.warn( 'Migration stalling: remaining (%sMiB)' ' > lowmark (%sMiB).' ' Refer to RHBZ#919201.', - dataRemaining / Mbytes, lowmark / Mbytes) + dataRemaining / Mbytes, self._lowmark / Mbytes)
if jobType == 0: - continue + return
self.progress = calculateProgress(dataRemaining, dataTotal)
self._vm.log.info('Migration Progress: %s seconds elapsed, %s%% of' ' data processed' % (timeElapsed / 1000, self.progress)) - - def idle(self): - self._stop.wait(1.0)
def stop(self): self._vm.log.debug('stopping migration monitor thread')
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6762/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7552/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7662/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6767/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7557/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7667/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6772/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7562/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7672/ : SUCCESS
Antoni Segura Puimedon has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 3: Code-Review+1
Vinzenz Feenstra has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 3:
(1 comment)
http://gerrit.ovirt.org/#/c/25976/3/vdsm/migration.py File vdsm/migration.py:
Line 420: progress_timeout Please move the configuration out of here and make them attributes
There's no reason for those values to be retrieved/recalculated every second
Francesco Romani has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 3:
(1 comment)
http://gerrit.ovirt.org/#/c/25976/3/vdsm/migration.py File vdsm/migration.py:
Line 420: progress_timeout
Please move the configuration out of here and make them attributes
Done
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 4:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6787/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7577/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7687/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 5:
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6825/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7615/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7725/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 6:
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6830/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7619/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7729/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 7:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6915/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7705/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7817/ : SUCCESS
Antoni Segura Puimedon has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 7: Code-Review-1
(2 comments)
Minor comments
http://gerrit.ovirt.org/#/c/25976/7/vdsm/virt/migration.py File vdsm/virt/migration.py:
Line 388: self.progress = 0 Line 389: Line 390: memSize = int(self._vm.conf['memSize']) Line 391: maxTimePerGiB = config.getint('vars', Line 392: 'migrationMaxTime_per_gib_mem') what about having maxTimePerGib be loaded after the imports as a constant MAX_TIME_PER_GIB = config.getint('vars', 'migrationprogressTimeour') Line 393: self._migrationMaxTime = (maxTimePerGiB * memSize + 1023) / 1024 Line 394: self._progressTimeout = config.getint('vars', Line 395: 'migrationprogressTimeout') Line 396:
Line 391: maxTimePerGiB = config.getint('vars', Line 392: 'migrationMaxTime_per_gib_mem') Line 393: self._migrationMaxTime = (maxTimePerGiB * memSize + 1023) / 1024 Line 394: self._progressTimeout = config.getint('vars', Line 395: 'migrationprogressTimeout') Same thing here, I don't think it should be an instance variable. It is read-only and a configuration value. Line 396: Line 397: @property Line 398: def enabled(self): Line 399: return MigrationMonitorThread._MIGRATION_MONITOR_INTERVAL > 0
Francesco Romani has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 7:
(2 comments)
http://gerrit.ovirt.org/#/c/25976/7/vdsm/virt/migration.py File vdsm/virt/migration.py:
Line 388: self.progress = 0 Line 389: Line 390: memSize = int(self._vm.conf['memSize']) Line 391: maxTimePerGiB = config.getint('vars', Line 392: 'migrationMaxTime_per_gib_mem')
what about having maxTimePerGib be loaded after the imports as a constant M
Done Line 393: self._migrationMaxTime = (maxTimePerGiB * memSize + 1023) / 1024 Line 394: self._progressTimeout = config.getint('vars', Line 395: 'migrationprogressTimeout') Line 396:
Line 391: maxTimePerGiB = config.getint('vars', Line 392: 'migrationMaxTime_per_gib_mem') Line 393: self._migrationMaxTime = (maxTimePerGiB * memSize + 1023) / 1024 Line 394: self._progressTimeout = config.getint('vars', Line 395: 'migrationprogressTimeout')
Same thing here, I don't think it should be an instance variable. It is rea
Done Line 396: Line 397: @property Line 398: def enabled(self): Line 399: return MigrationMonitorThread._MIGRATION_MONITOR_INTERVAL > 0
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 8:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6928/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7718/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7830/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 9:
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6951/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7853/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7742/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 10:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6958/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7859/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7748/ : SUCCESS
Vinzenz Feenstra has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 10: Code-Review+1
Antoni Segura Puimedon has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 10: Code-Review+1
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 11:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6976/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7878/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7767/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 12:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6983/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7884/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7773/ : SUCCESS
Francesco Romani has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 13:
Patch set 13: * rebased
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 13:
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/7008/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7910/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7799/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 14:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/8039/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/8152/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/7249/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 15:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/8277/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/7487/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/8395/ : SUCCESS
Antoni Segura Puimedon has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 15: Code-Review+1
Francesco Romani has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 16: Verified+1
fixed a rebase glitch which cause an AttributeError (MONITOR_INTERVAL vs MIGRATION_MONITOR_INTERVAL)
Verified together with 25977, 25978, 25979 by running migrations back and fort between a couple of hypervisors and observing the progress is still reporting and inspecting the logs.
Francesco Romani has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 16:
s/25979/26279/
Vinzenz Feenstra has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 16: Code-Review+1
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 16:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/9693/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/8760/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/9546/ : SUCCESS
Dan Kenigsberg has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 16:
(1 comment)
http://gerrit.ovirt.org/#/c/25976/16/vdsm/virt/migration.py File vdsm/virt/migration.py:
Line 409: self._lowmark = None Line 410: Line 411: while not self._stop.isSet(): Line 412: self._stop.wait(MonitorThread._MONITOR_TICK) Line 413: if self.enabled: self.enabled is a constant - why is it tested repeatedly within the thread? Why wake up every second to do nothing? Line 414: self.monitor_migration(step) Line 415: step += 1 Line 416: Line 417: self._vm.log.debug('migration monitor thread exiting')
Dan Kenigsberg has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 16: Code-Review-1
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 17:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/8918/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/9702/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_virt_functional_tests_gerrit/685/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/9857/ : SUCCESS
Dan Kenigsberg has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 17: Code-Review-1
(1 comment)
http://gerrit.ovirt.org/#/c/25976/17/vdsm/virt/migration.py File vdsm/virt/migration.py:
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: 0 is still a documented value, but it is going to cause ZeroDivisionError if used here.
Also, _MONITOR_INTERVAL is in seconds. step is in _MONITOR_TICK. I am not sure what you meant by dividing the two.
Come to think of it: have you considered to use AdvancedStatsFunction? It allows one thread to sample different properties in different frequencies. Line 431: (jobType, timeElapsed, _, Line 432: dataTotal, dataProcessed, dataRemaining, Line 433: memTotal, memProcessed, memRemaining, Line 434: fileTotal, fileProcessed, _) = self._vm._dom.jobInfo()
Francesco Romani has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 17:
(1 comment)
http://gerrit.ovirt.org/#/c/25976/17/vdsm/virt/migration.py File vdsm/virt/migration.py:
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:
0 is still a documented value, but it is going to cause ZeroDivisionError i
Right, but this code it is supposed to get called if self.enabled, which will ensure _MONITOR_INTERVAL is > 0.
What I mean here is to actually run the body only once every _MONITOR_INTERVAL secs, while 1 MONITOR_TICK is one second.
Lastly, I haven't checked AdvancedStatsFunction. Will do ASAP. Line 431: (jobType, timeElapsed, _, Line 432: dataTotal, dataProcessed, dataRemaining, Line 433: memTotal, memProcessed, memRemaining, Line 434: fileTotal, fileProcessed, _) = self._vm._dom.jobInfo()
Francesco Romani has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 18:
clarified the units; Explained previously while I don't think the division by zero is a real problem (there is an check before this code which will ensure the divisor being > 0)
Checked AdvancedStats*. It is indeed quite similar to this use case, but still different enough to deserve some preparation work which I don't feel is useful for this patchset.
I'm exploring a bit more generic concept in my upcoming threadpool patchset, we can port this code on top of that in a later patch.
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 18:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/9237/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/10022/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_virt_functional_tests_gerrit/849/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/10177/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_verify-error-codes_merged/5104/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_merged/3261/ : SUCCESS
Francesco Romani has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 19:
rebased
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 19:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/9301/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/10085/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_virt_functional_tests_gerrit/868/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/10241/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_verify-error-codes_merged/5167/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_merged/3325/ : SUCCESS
Francesco Romani has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 19:
rebased
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 20:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/9352/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/10137/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_virt_functional_tests_gerrit/892/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/10293/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_verify-error-codes_merged/5219/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_merged/3377/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 21:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/9524/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/10308/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/10464/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_verify-error-codes_merged/5390/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_merged/3548/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_virt_functional_tests_gerrit/947/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 22:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/9714/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/10499/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_virt_functional_tests_gerrit/1048/ : There was an infra issue, please contact infra@ovirt.org
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/10656/ : SUCCESS
Francesco Romani has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 22:
verified on a patched VDSM doing a few migraiton back and forth. Tested: 25976, 25977, 25978, 26279
Francesco Romani has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 22: Verified+1
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()
Francesco Romani has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 22:
(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 o
Done 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 exam
Done Line 431: (jobType, timeElapsed, _, Line 432: dataTotal, dataProcessed, dataRemaining, Line 433: memTotal, memProcessed, memRemaining, Line 434: fileTotal, fileProcessed, _) = self._vm._dom.jobInfo()
Francesco Romani has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 23: Verified+1
copied verification score
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 23:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/10132/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/10917/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_virt_functional_tests_gerrit/1219/ : There was an infra issue, please contact infra@ovirt.org
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/11074/ : SUCCESS
Dan Kenigsberg has posted comments on this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Patch Set 23: Code-Review-1
(2 comments)
http://gerrit.ovirt.org/#/c/25976/23/vdsm/virt/migration.py File vdsm/virt/migration.py:
Line 387: self._stop.set() Line 388: Line 389: Line 390: class MonitorThread(threading.Thread): Line 391: _MONITOR_TICK = 1 # unit: seconds. must be integer > 0. no one should ever change _MONITOR_TICK... If set to 2, (step % self._MONITOR_INTERVAL) would never get to zero. I believe that "step" should increase by exactly one step per iteration. _MONITOR_TICK should be eliminated. Line 392: _MONITOR_INTERVAL = config.getint( Line 393: 'vars', 'migration_monitor_interval') # unit: seconds Line 394: _MAX_TIME_PER_GIB = config.getint( Line 395: 'vars', 'migration_max_time_per_gib_mem')
Line 426: while not self._stop.isSet(): Line 427: self._stop.wait(self._MONITOR_TICK) Line 428: for action in actions: Line 429: action(step) Line 430: step += self._MONITOR_TICK I have an issue with limitless integers, despite the fact of a year-long migration is not a very frequent sight, and is going to get only to step=31 million. Line 431: Line 432: self._vm.log.debug('migration monitor thread exiting') Line 433: Line 434: def monitor_migration(self, step):
Francesco Romani has abandoned this change.
Change subject: virt: migration: add monitor thread control loop ......................................................................
Abandoned
further thoughts on this topic, for example during the discussion of http://gerrit.ovirt.org/#/c/25820/ , proved that this merger may not be so much beneficial after all. So, will take another route to make migration nicer. This patchset will be resumed if more compelling proof arise.
vdsm-patches@lists.fedorahosted.org