File versions.patch of Package libvirt-cim

Index: libvirt-cim-0.5.1/schema/VirtualSystemManagementService.mof
===================================================================
--- libvirt-cim-0.5.1.orig/schema/VirtualSystemManagementService.mof
+++ libvirt-cim-0.5.1/schema/VirtualSystemManagementService.mof
@@ -8,6 +8,9 @@ class Xen_VirtualSystemManagementService
 
    [Description("HG revision number of the providers")]
    string Revision;
+
+   [Description("LibVirt Version")]
+   string LibvirtVersion;
 };
 
 [Provider("cmpi::Virt_VirtualSystemManagementService")]
Index: libvirt-cim-0.5.1/src/Virt_VirtualSystemManagementService.c
===================================================================
--- libvirt-cim-0.5.1.orig/src/Virt_VirtualSystemManagementService.c
+++ libvirt-cim-0.5.1/src/Virt_VirtualSystemManagementService.c
@@ -1875,8 +1875,10 @@ CMPIStatus get_vsms(const CMPIObjectPath
         const char *ccname = NULL;
         virConnectPtr conn = NULL;
         unsigned long hv_version = 0;
+        unsigned long lv_version = 0;
         const char * hv_type = NULL;
         char *caption = NULL;
+        char *lv_version_string = NULL;
 
         *_inst = NULL;
         conn = connect_by_classname(broker, CLASSNAME(reference), &s);
@@ -1951,7 +1953,26 @@ CMPIStatus get_vsms(const CMPIObjectPath
                       (CMPIValue *)LIBVIRT_CIM_CS, CMPI_chars);
 
         CMSetProperty(inst, "Revision",
-                      (CMPIValue *)LIBVIRT_CIM_RV, CMPI_chars);
+                      (CMPIValue *)PACKAGE_VERSION, CMPI_chars);
+
+	if (virGetVersion(&lv_version, "Xen", &hv_version) < 0) {
+                CU_DEBUG("Unable to get libvirt version");
+                lv_version= 0;
+                hv_version= 0;
+        }
+
+        if (asprintf(&lv_version_string, "%lu.%lu.%lu",
+                     lv_version / 1000000,
+                     (lv_version % 1000000) / 1000,
+                     (lv_version % 1000000) % 1000) == -1)
+                lv_version_string = NULL;
+
+        if (lv_version_string != NULL)
+                CMSetProperty(inst, "LibvirtVersion",
+                              (CMPIValue *)lv_version_string, CMPI_chars);
+        else
+                CMSetProperty(inst, "LibvirtVersion",
+                              (CMPIValue *)"Unknown Libvirt", CMPI_chars);
 
         if (is_get_inst) {
                 s = cu_validate_ref(broker, reference, inst);
@@ -1964,6 +1985,7 @@ CMPIStatus get_vsms(const CMPIObjectPath
                    "");
  out:
         free(caption);
+        free(lv_version_string);
         virConnectClose(conn);
         *_inst = inst;
 
openSUSE Build Service is sponsored by