The current code returns the major, minor and rev portions of the version of
KVM as strings. Returning them as integers makes it easier to compare.

Signed-off-by: Miguel Di Ciurcio Filho <[email protected]>
---
 lib/hypervisor/hv_kvm.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py
index 9816b35..3314fe2 100644
--- a/lib/hypervisor/hv_kvm.py
+++ b/lib/hypervisor/hv_kvm.py
@@ -836,7 +836,12 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     match = cls._VERSION_RE.search(result.output.splitlines()[0])
     if not match:
       return None
-    return (match.group(0), match.group(1), match.group(2), match.group(3))
+
+    try:
+        return (match.group(0), int(match.group(1)), int(match.group(2)),
+                int(match.group(3)))
+    except ValueError:
+        return None
 
   def StopInstance(self, instance, force=False, retry=False, name=None):
     """Stop an instance.
-- 
1.7.2.3

Reply via email to