Change in vdsm[master]: migration: don't mess up with _status fields

fromani at redhat.com fromani at redhat.com
Tue Dec 1 15:50:40 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: migration: don't mess up with _status fields
......................................................................

migration: don't mess up with _status fields

Now that we store status-related fields separately
instead of slamming them in an internal response object,
we can create responses on the fly when needed, instead
of changing specific fields.

This makes the code easier to follow.

Change-Id: Iec1f705fd28d11e6048379c9dc33a752a07a2f9e
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/migration.py
1 file changed, 7 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/49524/1

diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index 29b7536..70993f5 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -95,10 +95,8 @@
             config.get('vars', 'migration_downtime')
         self._autoConverge = autoConverge
         self._compressed = compressed
-        self._last_status = {
-            'status': {
-                'code': 0,
-                'message': 'Migration in progress'}}
+        self._last_status = response.success(
+            message='Migration in progress')
         self._progress = 0
         threading.Thread.__init__(self)
         self._preparingMigrationEvt = True
@@ -224,7 +222,7 @@
         self._progress = 100
         if not self.hibernating:
             self._vm.setDownStatus(NORMAL, vmexitreason.MIGRATION_SUCCEEDED)
-            self._last_status['status']['message'] = 'Migration done'
+            self._last_status = response.success(message='Migration done')
         else:
             # don't pickle transient params
             for ignoreParam in ('displayIp', 'display', 'pid'):
@@ -240,7 +238,7 @@
                 self._vm.cif.teardownVolumePath(self._dstparams)
 
             self._vm.setDownStatus(NORMAL, vmexitreason.SAVE_STATE_SUCCEEDED)
-            self._last_status['status']['message'] = 'SaveState done'
+            self._last_status = response.success(message='SaveState done')
 
     def _patchConfigForLegacy(self):
         """
@@ -417,9 +415,9 @@
             if not self._preparingMigrationEvt:
                 raise
         else:
-            self._last_status['status']['message'] = \
-                'Migration process cancelled'
-            return self._last_status
+            self._last_status = response.success(
+                message='Migration process cancelled')
+            return self.getStat()
 
 
 def exponential_downtime(downtime, steps):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iec1f705fd28d11e6048379c9dc33a752a07a2f9e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>


More information about the vdsm-patches mailing list