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

fromani at redhat.com fromani at redhat.com
Mon Jun 16 07:25:29 UTC 2014


Francesco Romani has posted comments on this change.

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


Patch Set 20:

(3 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:
Not stricly related, will split in a (trivial) patch.
I like the current code slightly more because, as you pointed out, the short-circuit behaviour of the 'or' operator.
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:
> Setting self._monitorThread in the "as" part is surprising, while the old c
I agree your version is better in every way. Will change accordingly.
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: 


Line 340:     monitorThread.start()
Line 341:     try:
Line 342:         yield monitorThread
Line 343:     finally:
Line 344:         monitorThread.stop()
> This can be much more useful as general utility for things that you can sta
Right. Will change.
Line 345: 
Line 346: 
Line 347: class MonitorThread(threading.Thread):
Line 348:     _MONITOR_TICK = 1.0  # unit: seconds


-- 
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: Nir Soffer <nsoffer 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