Change in vdsm[master]: virt: migration: use contextmanager for monitor

Federico Simoncelli fsimonce at redhat.com
Fri Jun 13 18:05:32 UTC 2014


Federico Simoncelli has posted comments on this change.

Change subject: virt: migration: use contextmanager for monitor
......................................................................


Patch Set 20: Code-Review+1

(2 comments)

http://gerrit.ovirt.org/#/c/25978/20/vdsm/virt/migration.py
File vdsm/virt/migration.py:

Line 62:         self._tunneled = utils.tobool(tunneled)
Line 63:         self._abortOnError = utils.tobool(abortOnError)
Line 64:         self._dstqemu = dstqemu
Line 65:         self._downtime = int(kwargs.get('downtime') or
Line 66:                              config.get('vars', 'migration_downtime'))
Is this related? Because eventually this may be better:

 self._downtime = int(kwargs.get('downtime', config.get('vars', 'migration_downtime')))

Or is it better the current code because the right part of "or" is evaluated only when really needed?
Line 67:         self.status = {
Line 68:             'status': {
Line 69:                 'code': 0,
Line 70:                 'message': 'Migration in progress'},


Line 298:                                'with miguri %s', duri, muri)
Line 299: 
Line 300:             with migrationMonitor(self._vm,
Line 301:                                   startTime,
Line 302:                                   self._downtime) as self._monitorThread:
I am not a fan of this indentation but it's just taste. Incidentally I would have used:

 with migrationMonitor(
         self._vm, startTime, self._downtime) as self._monitorThread:

(PS. maybe it wouldn't fit 79 chars)
(PPS. I can't recall but I think pep8 had some bug regarding the "with" statement indentation).

Anyway I'm fine with the current code too.
Line 303:                 if self._vm.hasSpice and self._vm.conf.get('clientIp'):
Line 304:                     SPICE_MIGRATION_HANDOVER_TIME = 120
Line 305:                     self._vm._reviveTicket(SPICE_MIGRATION_HANDOVER_TIME)
Line 306: 


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie7fcd0bedf4f30cc0bcab03339322df1fc5434e8
Gerrit-PatchSet: 20
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Vinzenz Feenstra <vfeenstr at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list