[Libvirt-cim] [PATCH] [TEST] Detect whether the revision is a distro defined value

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Fri May 29 21:39:53 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1243633176 25200
# Node ID 46664d3f9e880c69ed43a06f36d0d4f33bd29f67
# Parent  1f0e581729dc63c083a510703b47d4bd457bd178
[TEST] Detect whether the revision is a distro defined value

Even if the distro is SLES or RHEL, the providers might be installed from
source.  In which case, the revision value will be the hg revision value, and
not the distro defined value.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 1f0e581729dc -r 46664d3f9e88 suites/libvirt-cim/lib/XenKvmLib/const.py
--- a/suites/libvirt-cim/lib/XenKvmLib/const.py	Thu May 21 15:50:56 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/const.py	Fri May 29 14:39:36 2009 -0700
@@ -148,11 +148,6 @@
 
 
 def get_provider_version(virt, ip):
-    cmd = "cat /etc/issue | grep 'SUSE Linux Enterprise Server 11'"
-    rc, out = run_remote(ip, cmd)
-    if rc == 0:
-        return 0, sles11_changeset 
-
     conn = WBEMConnection('http://%s' % ip,
                           (os.getenv('CIM_USER'), os.getenv('CIM_PASS')),
                           os.getenv('CIM_NS'))
@@ -167,6 +162,18 @@
     if revision is None or changeset is None:
         return 0, "Unknown" 
 
+    # This is a sloppy mechanism for detecting a distro defined revision value
+    distro = None
+
+    cmd = "cat /etc/issue | grep 'SUSE Linux Enterprise Server 11'"
+    rc, out = run_remote(ip, cmd)
+    if rc == 0:
+        distro = "sles11"      
+
+    if revision.find(".") == 0:
+        if distro == "sles11":
+            return 0, sles11_changeset 
+
     revision = revision.strip("+")
     if revision.isdigit():
         revision = int(revision)




More information about the Libvirt-cim mailing list