Change in vdsm[master]: Possible runtime error in migrationStatus

shavivi at redhat.com shavivi at redhat.com
Mon Mar 23 14:07:10 UTC 2015


Shahar Havivi has uploaded a new change for review.

Change subject: Possible runtime error in migrationStatus
......................................................................

Possible runtime error in migrationStatus

migrationStatus is checking for 'downtime' which is presented in
libvirt>1.2.8, user with lower version of libvirt (such as the default
of F20) can get a runtime error.

Change-Id: I45d35258ae849a0bbb8084b156484cd1ebd93485
Signed-off-by: Shahar Havivi <shaharh at redhat.com>
---
M vdsm/rpc/vdsmapi-schema.json
M vdsm/virt/migration.py
2 files changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/39054/1

diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 477f712..6ebface 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -6442,7 +6442,7 @@
 #
 # Since: 4.17.0
 ##
-{'type', 'MigrationStatusInfo', 'data': {'downtime': 'str'}}
+{'type', 'MigrationStatusInfo', 'data': {'*downtime': 'str'}}
 
 ##
 # @VM.getMigrationStatus:
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index cb2dd9c..d38b633 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -98,9 +98,12 @@
             # fetch migration status from the monitor thread
             self.status['progress'] = self._monitorThread.progress
 
-        stat = self._vm._dom.jobStats(libvirt.VIR_DOMAIN_JOB_STATS_COMPLETED)
-        if 'downtime' in stat:
-            self.status['downtime'] = stat['downtime']
+        # this check is needed for F20 since it require libvirt>1.28
+        if hasattr(libvirt, "VIR_DOMAIN_JOB_STATS_COMPLETED"):
+            stat = self._vm._dom.jobStats(libvirt.
+                                          VIR_DOMAIN_JOB_STATS_COMPLETED)
+            if 'downtime' in stat:
+                self.status['downtime'] = stat['downtime']
 
         return self.status
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I45d35258ae849a0bbb8084b156484cd1ebd93485
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shavivi at redhat.com>


More information about the vdsm-patches mailing list