Dan Kenigsberg has posted comments on this change.

Change subject: Introduce a maximum time limit a migration may take
......................................................................


Patch Set 8: Code-Review-1

(3 comments)

....................................................
File vdsm/vm.py
Line 740:     def __init__(self, vm, startTime):
Line 741:         super(MigrationMonitorThread, self).__init__()
Line 742:         self._stop = threading.Event()
Line 743:         self._vm = vm
Line 744:         self.startTime = startTime
should be _private.

The code would be slightly cleaner if you calculate and store

  self._endTime

right here.
Line 745:         self.daemon = True
Line 746:         self.data_progress = 0
Line 747:         self.mem_progress = 0
Line 748: 


Line 757: 
Line 758:         maxTimePerGiB = config.getint('vars',
Line 759:                                       
'migration_max_time_per_gib_mem')
Line 760:         memSize = int(self._vm.conf['memSize'])
Line 761:         migrationMaxTime = int(maxTimePerGiB * (memSize / 1024.))
floating point calculus is slow, imprecise, and not really needed here

  maxTimePerGiB * memSize / 1024

does the same. Though I would round it up to make sure we never have zero 
migrationMaxTime:

  (maxTimePerGiB * memSize + 1023) / 1024
Line 762:         lastProgressTime = time.time()
Line 763:         lowmark = None
Line 764:         progress_timeout = config.getint('vars', 
'migration_progress_timeout')
Line 765: 


Line 770:              memTotal, memProcessed, memRemaining,
Line 771:              fileTotal, fileProcessed, _) = self._vm._dom.jobInfo()
Line 772: 
Line 773:             remaining = dataRemaining + memRemaining
Line 774:             abort = False
now = time.time()

would come up handy - instead of calling it 3 times in this code block.
Line 775:             if 0 < migrationMaxTime < time.time() - self.startTime:
Line 776:                 self._vm.log.warn('The migration took %d seconds 
which is '
Line 777:                                   'exceeding the configured maximum 
time '
Line 778:                                   'for migrations of %d seconds. The '


-- 
To view, visit http://gerrit.ovirt.org/21708
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifd2f76b9334fcb7d2db24c081cccae15e8fd0b0c
Gerrit-PatchSet: 8
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Francesco Romani <[email protected]>
Gerrit-Reviewer: Lee Yarwood <[email protected]>
Gerrit-Reviewer: Michal Skrivanek <[email protected]>
Gerrit-Reviewer: Tomáš Došek <[email protected]>
Gerrit-Reviewer: Vinzenz Feenstra <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to