File 948-versions.patch of Package libvirt-cim

Index: libvirt-cim-0.5.6/schema/VirtualSystemManagementService.mof
===================================================================
--- libvirt-cim-0.5.6.orig/schema/VirtualSystemManagementService.mof
+++ libvirt-cim-0.5.6/schema/VirtualSystemManagementService.mof
@@ -11,6 +11,9 @@ class Xen_VirtualSystemManagementService
 
    [Description("Package Version")]
    string Release;
+ 
+   [Description("libvirt Version")]
+   string LibvirtVersion;
 };
 
 [Provider("cmpi::Virt_VirtualSystemManagementService")]
@@ -24,6 +27,9 @@ class KVM_VirtualSystemManagementService
 
    [Description("Package Version")]
    string Release;
+
+   [Description("libvirt Version")]
+   string LibvirtVersion;
 };
 
 [Provider("cmpi::Virt_VirtualSystemManagementService")]
@@ -37,4 +43,7 @@ class LXC_VirtualSystemManagementService
 
    [Description("Package Version")]
    string Release;
+
+   [Description("libvirt Version")]
+   string LibvirtVersion;
 };
Index: libvirt-cim-0.5.6/src/Virt_VirtualSystemManagementService.c
===================================================================
--- libvirt-cim-0.5.6.orig/src/Virt_VirtualSystemManagementService.c
+++ libvirt-cim-0.5.6/src/Virt_VirtualSystemManagementService.c
@@ -2306,8 +2306,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;
         CMPIArray *array;
         uint16_t op_status;
 
@@ -2386,6 +2388,25 @@ CMPIStatus get_vsms(const CMPIObjectPath
         CMSetProperty(inst, "Revision",
                       (CMPIValue *)LIBVIRT_CIM_RV, CMPI_chars);
 
+	if (virGetVersion(&lv_version, hv_type, &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);
+
         CMSetProperty(inst, "Release",
                       (CMPIValue *)PACKAGE_VERSION, CMPI_chars);
 
@@ -2410,6 +2431,7 @@ CMPIStatus get_vsms(const CMPIObjectPath
                    "");
  out:
         free(caption);
+        free(lv_version_string);
         virConnectClose(conn);
         *_inst = inst;
 
openSUSE Build Service is sponsored by