This of course was working for all the rcs, but broke with 1.0 itself.

Signed-off-by: Guido Trotter <[email protected]>
---
 lib/hypervisor/hv_kvm.py |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py
index f660966..e3729e0 100644
--- a/lib/hypervisor/hv_kvm.py
+++ b/lib/hypervisor/hv_kvm.py
@@ -209,7 +209,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
   _MIGRATION_INFO_MAX_BAD_ANSWERS = 5
   _MIGRATION_INFO_RETRY_DELAY = 2
 
-  _VERSION_RE = re.compile(r"\b(\d+)\.(\d+)\.(\d+)\b")
+  _VERSION_RE = re.compile(r"\b(\d+)\.(\d+)(\.(\d+))?\b")
 
   ANCILLARY_FILES = [
     _KVM_NETWORK_SCRIPT,
@@ -1021,8 +1021,14 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     if not match:
       raise errors.HypervisorError("Unable to get KVM version")
 
-    return (match.group(0), int(match.group(1)), int(match.group(2)),
-            int(match.group(3)))
+    v_all = match.group(0)
+    v_maj = int(match.group(1))
+    v_min = int(match.group(2))
+    if match.group(4):
+      v_rev = int(match.group(4))
+    else:
+      v_rev = 0
+    return (v_all, v_maj, v_min, v_rev)
 
   def StopInstance(self, instance, force=False, retry=False, name=None):
     """Stop an instance.
-- 
1.7.7.3

Reply via email to