Change in vdsm[master]: lib: migration: moving create of migration status to migrate.py

mmirecki at redhat.com mmirecki at redhat.com
Wed Jul 8 18:56:37 UTC 2015


Marcin Mirecki has uploaded a new change for review.

Change subject: lib: migration: moving create of migration status to migrate.py
......................................................................

lib: migration: moving create of migration status to migrate.py

Until now the status of migration was partly composed in migrate.py
and partly in API.py. The part done in API.py had a hardcoded error
code which did not allow the code in migrate.py to return any error
code. Now the entire status is composed in migrate.py, allowing to
return any error code which is required.

Change-Id: Icbc1525f52dc5ee49647aa6d690f221f2dc96e5d
Signed-off-by: Marcin Mirecki <mmirecki at redhat.com>
---
M vdsm/API.py
M vdsm/virt/migration.py
M vdsm/virt/vm.py
3 files changed, 11 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/43357/1

diff --git a/vdsm/API.py b/vdsm/API.py
index 9399445..73e4647 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -354,7 +354,7 @@
             v = self._cif.vmContainer[self._UUID]
         except KeyError:
             return errCode['noVM']
-        return {'status': doneCode, 'migrationStats': v.migrateStatus()}
+        return v.migrateStatus()
 
     def getStats(self):
         """
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index d6994ed..e71b6e2 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -95,11 +95,13 @@
             config.get('vars', 'migration_downtime')
         self._autoConverge = autoConverge
         self._compressed = compressed
+        self._progress = 0
         self.status = {
             'status': {
                 'code': 0,
-                'message': 'Migration in progress'}}
-        self._progress = 0
+                'message': 'Migration in progress'},
+            'migrationStats': {
+                'progress': self._progress}}
         threading.Thread.__init__(self)
         self._preparingMigrationEvt = True
         self._migrationCanceledEvt = False
@@ -113,14 +115,16 @@
         """
         Get the status of the migration.
         """
+        if 'migrationStats' not in self.status:
+            self.status['migrationStats'] = {}
         if self._monitorThread is not None:
             # fetch migration status from the monitor thread
             self._progress = self._monitorThread.progress
-        self.status['progress'] = self._progress
+        self.status['migrationStats']['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.status['migrationStats']['downtime'] = stat['downtime_net']
 
         return self.status
 
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 1ec03d4..9c05973 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1375,7 +1375,8 @@
         if 'pauseCode' in self.conf:
             stats['pauseCode'] = self.conf['pauseCode']
         if self.isMigrating():
-            stats['migrationProgress'] = self.migrateStatus()['progress']
+            migrationStats = self.migrateStatus()['migrationStats']
+            stats['migrationProgress'] = migrationStats['progress']
 
         decStats = {}
         try:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icbc1525f52dc5ee49647aa6d690f221f2dc96e5d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki <mmirecki at redhat.com>


More information about the vdsm-patches mailing list