[Libvirt-cim] [PATCH] [TEST] Retrieve revision and changeset string

zli at linux.vnet.ibm.com zli at linux.vnet.ibm.com
Wed Apr 16 11:20:57 UTC 2008


# HG changeset patch
# User Zhengang Li <lizg at cn.ibm.com>
# Date 1208344854 -28800
# Node ID 5d2e26fe8b594894946b95598aac5c43a6d3f0d0
# Parent  e54b31ce89af19ca0d4c40ce4b097685e34aa2c7
[TEST] Retrieve revision and changeset string

The two properties can be accessed in test cases as
'main.revision', 'main.changeset'

Signed-off-by: Zhengang Li <lizg at cn.ibm.com>

diff -r e54b31ce89af -r 5d2e26fe8b59 lib/CimTest/Globals.py
--- a/lib/CimTest/Globals.py	Wed Apr 16 16:10:52 2008 +0800
+++ b/lib/CimTest/Globals.py	Wed Apr 16 19:20:54 2008 +0800
@@ -135,6 +135,7 @@ def do_main(types=['Xen'], p=parser):
             def do_try():
                 try:
                     log_param(options.debug==True)
+                    revision, changeset = get_version(options.virt, options.ip)
                     from VirtLib.utils import setup_ssh_key
                     from XenKvmLib.test_doms import destroy_and_undefine_all
                     setup_ssh_key()
@@ -148,3 +149,16 @@ def do_main(types=['Xen'], p=parser):
             return do_try
     return do_type
 
+def get_version(virt, ip):
+    from pywbem import WBEMConnection
+    from XenKvmLib.classes import get_typed_class
+    conn = WBEMConnection('http://%s' % ip, (CIM_USER, CIM_PASS), CIM_NS)
+    vsms_cn = get_typed_class(virt, 'VirtualSystemManagementService')
+    try:
+        inst = conn.EnumerateInstances(vsms_cn)
+        revision = inst[0]['Revision']
+        changeset = inst[0]['Changeset']
+    except Exception:
+        return None, None
+    return revision, changeset
+




More information about the Libvirt-cim mailing list