Francesco Romani has uploaded a new change for review. Change subject: migration: make status attribute private ......................................................................
migration: make status attribute private No code outsiee the migration.SourceThread should now access this field directly anymore. So, let's make this attribute private to make the code a little tidier and to enable further refactoring. Change-Id: I33884c0e4942f9e2d7ef93b939f33b2e6147ca62 Signed-off-by: Francesco Romani <[email protected]> --- M vdsm/virt/migration.py 1 file changed, 14 insertions(+), 13 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/94/42794/1 diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py index 92efa06..a51d977 100644 --- a/vdsm/virt/migration.py +++ b/vdsm/virt/migration.py @@ -89,7 +89,7 @@ config.get('vars', 'migration_downtime') self._autoConverge = autoConverge self._compressed = compressed - self.status = { + self._last_status = { 'status': { 'code': 0, 'message': 'Migration in progress'}} @@ -110,13 +110,13 @@ if self._monitorThread is not None: # fetch migration status from the monitor thread self._progress = self._monitorThread.progress - self.status['progress'] = self._progress + self._last_status['progress'] = self._progress stat = self._vm._dom.jobStats(libvirt.VIR_DOMAIN_JOB_STATS_COMPLETED) if 'downtime_net' in stat: - self.status['downtime'] = stat['downtime_net'] + self._last_status['downtime'] = stat['downtime_net'] - return self.status + return self._last_status def _createClient(self, port): sslctx = sslutils.create_ssl_context() @@ -197,8 +197,8 @@ self._vm.lastStatus = vmstatus.MIGRATION_SOURCE def _recover(self, message): - if not self.status['status']['code']: - self.status = response.error('migrateErr') + if not self._last_status['status']['code']: + self._last_status = response.error('migrateErr') self.log.error(message) if not self.hibernating: try: @@ -215,7 +215,7 @@ self._progress = 100 if not self.hibernating: self._vm.setDownStatus(NORMAL, vmexitreason.MIGRATION_SUCCEEDED) - self.status['status']['message'] = 'Migration done' + self._last_status['status']['message'] = 'Migration done' else: # don't pickle transient params for ignoreParam in ('displayIp', 'display', 'pid'): @@ -230,7 +230,7 @@ self._vm.cif.teardownVolumePath(self._dstparams) self._vm.setDownStatus(NORMAL, vmexitreason.SAVE_STATE_SUCCEEDED) - self.status['status']['message'] = 'SaveState done' + self._last_status['status']['message'] = 'SaveState done' def _patchConfigForLegacy(self): """ @@ -288,8 +288,9 @@ self._finishSuccessfully() except libvirt.libvirtError as e: if e.get_error_code() == libvirt.VIR_ERR_OPERATION_ABORTED: - self.status = response.error('migCancelErr', - message='Migration canceled') + self._last_status = response.error( + 'migCancelErr', + message='Migration canceled') raise finally: if '_migrationParams' in self._vm.conf: @@ -325,7 +326,7 @@ destCreationTime) if result['status']['code']: - self.status = result + self._last_status = result raise RuntimeError('migration destination error: ' + result['status']['message']) if config.getboolean('vars', 'ssl'): @@ -403,9 +404,9 @@ if not self._preparingMigrationEvt: raise else: - self.status['status']['message'] = \ + self._last_status['status']['message'] = \ 'Migration process cancelled' - return self.status + return self._last_status def exponential_downtime(downtime, steps): -- To view, visit https://gerrit.ovirt.org/42794 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I33884c0e4942f9e2d7ef93b939f33b2e6147ca62 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
