Tomas Jelinek has uploaded a new change for review.

Change subject: migration: wait properly for migration to begin
......................................................................

migration: wait properly for migration to begin

If the time it takes the migration to begin is longer than the
MIGRATION_MONITOR_INTERVAL (may happen due to networking issues), the first
call to Progress.from_job_stats(self._vm._dom.jobStats()) leads to an exception
because the stats don't contain the statistics yet. This situation causes the
monitor thread to die (even the migration will continue and eventually pass).

Fixed by:
- making sure the from_job_stats() will not fail in case some of the statistics
  are not presnet
- adding a check which makes sure that the monitor thread will be executing it's
  logic only if the migration is ongoing

Change-Id: If1ba369a0992c2473acf1395fad0b0c260c250ba
Signed-off-by: Tomas Jelinek <[email protected]>
---
M vdsm/virt/migration.py
1 file changed, 15 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/73/60073/1

diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index 834460f..55d263b 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -653,6 +653,11 @@
                 break
 
             progress = Progress.from_job_stats(self._vm._dom.jobStats())
+            # It may happen that the migration did not start yet
+            # so we'll keep waitingy
+            if not progress.ongoing:
+                continue
+
             now = time.time()
             if not self._use_conv_schedule and\
                     (0 < migrationMaxTime < now - self._startTime):
@@ -754,16 +759,16 @@
     def from_job_stats(cls, stats):
         return cls(
             stats['type'],
-            stats[libvirt.VIR_DOMAIN_JOB_TIME_ELAPSED],
-            stats[libvirt.VIR_DOMAIN_JOB_DATA_TOTAL],
-            stats[libvirt.VIR_DOMAIN_JOB_DATA_PROCESSED],
-            stats[libvirt.VIR_DOMAIN_JOB_DATA_REMAINING],
-            stats[libvirt.VIR_DOMAIN_JOB_MEMORY_TOTAL],
-            stats[libvirt.VIR_DOMAIN_JOB_MEMORY_PROCESSED],
-            stats[libvirt.VIR_DOMAIN_JOB_MEMORY_REMAINING],
-            stats[libvirt.VIR_DOMAIN_JOB_MEMORY_BPS],
-            stats[libvirt.VIR_DOMAIN_JOB_MEMORY_CONSTANT],
-            stats[libvirt.VIR_DOMAIN_JOB_COMPRESSION_BYTES],
+            stats.get(libvirt.VIR_DOMAIN_JOB_TIME_ELAPSED, -1),
+            stats.get(libvirt.VIR_DOMAIN_JOB_DATA_TOTAL, -1),
+            stats.get(libvirt.VIR_DOMAIN_JOB_DATA_PROCESSED, -1),
+            stats.get(libvirt.VIR_DOMAIN_JOB_DATA_REMAINING, -1),
+            stats.get(libvirt.VIR_DOMAIN_JOB_MEMORY_TOTAL, -1),
+            stats.get(libvirt.VIR_DOMAIN_JOB_MEMORY_PROCESSED, -1),
+            stats.get(libvirt.VIR_DOMAIN_JOB_MEMORY_REMAINING, -1),
+            stats.get(libvirt.VIR_DOMAIN_JOB_MEMORY_BPS, -1),
+            stats.get(libvirt.VIR_DOMAIN_JOB_MEMORY_CONSTANT, -1),
+            stats.get(libvirt.VIR_DOMAIN_JOB_COMPRESSION_BYTES, -1),
             # available since libvirt 1.3
             stats.get('memory_dirty_rate', -1),
             # available since libvirt 1.3


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If1ba369a0992c2473acf1395fad0b0c260c250ba
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Tomas Jelinek <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/admin/lists/[email protected]

Reply via email to