[Libvirt-cim] [PATCH] Add SBLIM support to ECTP

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Tue Nov 25 23:23:39 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1227649964 28800
# Node ID f0c65377d767817fd8d28728144c655403cf06a1
# Parent  fe39b8a3b9bc769e8af3e3a39be3b77c34227c25
Add SBLIM support to ECTP

Only need to register the mofs of RP and CS in cimv2 - no need to register the
providers in cimv2.

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

diff -r fe39b8a3b9bc -r f0c65377d767 Makefile.am
--- a/Makefile.am	Tue Nov 25 10:01:20 2008 -0800
+++ b/Makefile.am	Tue Nov 25 13:52:44 2008 -0800
@@ -69,7 +69,10 @@
 	schema/HostedResourcePool.mof \
 	schema/ElementCapabilities.mof \
 	schema/HostedService.mof \
-	schema/HostedDependency.mof
+	schema/HostedDependency.mof \
+	schema/RegisteredProfile.mof \
+	schema/ComputerSystem.mof \
+	schema/ElementConformsToProfile.mof
 
 REGS = \
 	schema/ComputerSystem.registration \
@@ -128,7 +131,8 @@
 	schema/HostedResourcePool.registration \
 	schema/ElementCapabilities.registration \
 	schema/HostedService.registration \
-	schema/HostedDependency.registration
+	schema/HostedDependency.registration \
+	schema/ElementConformsToProfile.registration
 
 pkgdata_DATA = $(MOFS) $(REGS) $(INTEROP_MOFS) $(INTEROP_REGS)
 pkgdata_SCRIPTS = provider-register.sh
diff -r fe39b8a3b9bc -r f0c65377d767 schema/ElementConformsToProfile.registration
--- a/schema/ElementConformsToProfile.registration	Tue Nov 25 10:01:20 2008 -0800
+++ b/schema/ElementConformsToProfile.registration	Tue Nov 25 13:52:44 2008 -0800
@@ -2,7 +2,10 @@
 # Classname Namespace ProviderName ProviderModule ProviderTypes
 Xen_ElementConformsToProfile root/virt Virt_ElementConformsToProfile Virt_ElementConformsToProfile  association
 Xen_ElementConformsToProfile root/interop Virt_ElementConformsToProfile Virt_ElementConformsToProfile  association
+Xen_ElementConformsToProfile root/cimv2 Virt_ElementConformsToProfile Virt_ElementConformsToProfile  association
 KVM_ElementConformsToProfile root/virt Virt_ElementConformsToProfile Virt_ElementConformsToProfile  association
 KVM_ElementConformsToProfile root/interop Virt_ElementConformsToProfile Virt_ElementConformsToProfile  association
+KVM_ElementConformsToProfile root/cimv2 Virt_ElementConformsToProfile Virt_ElementConformsToProfile  association
 LXC_ElementConformsToProfile root/virt Virt_ElementConformsToProfile Virt_ElementConformsToProfile  association
 LXC_ElementConformsToProfile root/interop Virt_ElementConformsToProfile Virt_ElementConformsToProfile  association
+LXC_ElementConformsToProfile root/cimv2 Virt_ElementConformsToProfile Virt_ElementConformsToProfile  association
diff -r fe39b8a3b9bc -r f0c65377d767 src/Makefile.am
--- a/src/Makefile.am	Tue Nov 25 10:01:20 2008 -0800
+++ b/src/Makefile.am	Tue Nov 25 13:52:44 2008 -0800
@@ -108,9 +108,9 @@
 
 libVirt_DevicePool_la_SOURCES = Virt_DevicePool.c
 
-libVirt_ElementConformsToProfile_la_DEPENDENCIES = libVirt_RegisteredProfile.la
+libVirt_ElementConformsToProfile_la_DEPENDENCIES = libVirt_RegisteredProfile.la libVirt_HostSystem.la
 libVirt_ElementConformsToProfile_la_SOURCES = Virt_ElementConformsToProfile.c
-libVirt_ElementConformsToProfile_la_LIBADD = -lVirt_RegisteredProfile
+libVirt_ElementConformsToProfile_la_LIBADD = -lVirt_RegisteredProfile -lVirt_HostSystem
 
 libVirt_ReferencedProfile_la_DEPENDENCIES = libVirt_RegisteredProfile.la
 libVirt_ReferencedProfile_la_SOURCES = Virt_ReferencedProfile.c
diff -r fe39b8a3b9bc -r f0c65377d767 src/Virt_ElementConformsToProfile.c
--- a/src/Virt_ElementConformsToProfile.c	Tue Nov 25 10:01:20 2008 -0800
+++ b/src/Virt_ElementConformsToProfile.c	Tue Nov 25 13:52:44 2008 -0800
@@ -37,6 +37,7 @@
 #include "config.h"
 
 #include "Virt_RegisteredProfile.h"
+#include "Virt_HostSystem.h"
 
 /* Associate an XXX_RegisteredProfile to the proper XXX_ManagedElement.
  *
@@ -54,13 +55,21 @@
                                  const char *class)
 {
         CMPIStatus s = {CMPI_RC_OK, NULL};
+        CMPIInstance *inst;
         CMPIObjectPath *op;
         CMPIEnumeration *en  = NULL;
-        CMPIData data ;
-        char *classname;
+        CMPIData data;
+        char *classname = NULL;
 
         if (class == NULL)
                 return s;
+
+        if (STREQC(class, "HostSystem")) {
+                s = get_host(_BROKER, info->context, ref, &inst, false);
+                if (s.rc == CMPI_RC_OK)
+                        inst_list_add(list, inst);
+                goto out;
+        }
 
         classname = get_typed_class(pfx_from_conn(conn), 
                                     class);
@@ -158,11 +167,13 @@
         CMPIStatus s = {CMPI_RC_OK, NULL};
         CMPIInstance *instance = NULL;
         virConnectPtr conn = NULL;
-        char *classname;
+        CMPIObjectPath *vref = NULL;
+        char *classname = NULL;
         int i;
-        
-        if (!match_hypervisor_prefix(ref, info))
-                return s;
+
+        if (!STARTS_WITH(CLASSNAME(ref), "Linux_") &&
+            !match_hypervisor_prefix(ref, info))
+                goto out;
 
         instance = CBGetInstance(_BROKER,
                                  info->context,
@@ -172,17 +183,24 @@
         if (s.rc != CMPI_RC_OK)
                 return s;
 
-        conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
-        if (conn == NULL)
-                return s;
-
-        classname = class_base_name(CLASSNAME(ref));
+        if (STREQC(CLASSNAME(ref), "Linux_ComputerSystem"))
+                classname = class_base_name("Linux_HostSystem");
+        else
+                classname = class_base_name(CLASSNAME(ref));
         if (classname == NULL) {
                 cu_statusf(_BROKER, &s, 
                            CMPI_RC_ERR_FAILED,
                            "Can't get class name");
                 goto out;
         }
+
+        vref = convert_sblim_hostsystem(_BROKER, ref, info);
+        if (vref == NULL)
+                goto out;
+
+        conn = connect_by_classname(_BROKER, CLASSNAME(vref), &s);
+        if (conn == NULL)
+                return s;
 
         for (i = 0; profiles[i] != NULL; i++) {
 
@@ -195,7 +213,7 @@
                 }
 
                 s = get_profile(_BROKER,
-                                ref, 
+                                vref, 
                                 info->properties,
                                 pfx_from_conn(conn),
                                 profiles[i],
@@ -244,6 +262,7 @@
         "LXC_NetworkPool",
         "LXC_ProcessorPool",
         "LXC_VirtualSystemMigrationService",
+        "Linux_ComputerSystem",
         NULL
 };
 




More information about the Libvirt-cim mailing list