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: 


-- 
To view, visit https://gerrit.ovirt.org/46940
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I989cff12d08ef1cab36bd10df7daaa999a8dac14
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Tomas Jelinek <[email protected]>
Gerrit-Reviewer: Francesco Romani <[email protected]>
Gerrit-Reviewer: Tomas Jelinek <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to