Francesco Romani has posted comments on this change.
Change subject: migration: added support for convergance schedule ......................................................................
Patch Set 4:
(2 comments)
https://gerrit.ovirt.org/#/c/46940/4/vdsm/virt/migration.py File vdsm/virt/migration.py:
Line 138: self._do_perform_migration = _perform_with_downtime_thread Line 139: if kwargs.has_key('convergenceSchedule'): Line 140: # example convergence schedule Line 141: # "[(1, ('setDowntime', (10))), (4, ('abort', ()))]" Line 142: schedule = literal_eval(kwargs.get('convergenceSchedule'))
Ugh, this is thought to swallow. Can't we have the convergenceSchedule expr
Proposal:
This is pretty similar and it is valid JSON:
'[[1, ["setDowntime", [10]]], [4, ["abort", []]]]'
can we use this format instead? It is also valid python, modulo the choice of quotes.
If we use this, we can have:
schedule = json.loads(kwargs.get('convergenceSchedule)) Line 143: self._do_perform_migration = \ Line 144: _perform_with_conv_schedule_monitor_thread Line 145: Line 146: self._convergenceSchedule = map(ConvergenceItem._make,
Line 145: Line 146: self._convergenceSchedule = map(ConvergenceItem._make, Line 147: [(s[0], Line 148: map(ConvergenceAction._make, Line 149: s[1:])[0]) for s in schedule])
this is hard to read, we need to simplify this. But first let's agree about
whatever format we choose, we can also write:
self._convergence_schedule = [ ConvergenceItem(lim, ConvergenceAction(act, params)) for lim, (act, params) in schedule ]
which is IMHO bettter Line 150: Line 151: self.log.debug('convergence schedule set to: ' + str(self._convergenceSchedule)) Line 152: Line 153:
vdsm-patches@lists.fedorahosted.org