[Libvirt-cim] [PATCH 2 of 2] ECTP: adopt interface changes of RegisteredProfile

Heidi Eckhart heidieck at linux.vnet.ibm.com
Fri Mar 14 10:11:28 UTC 2008


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1205488995 -3600
# Node ID 59f38ff0007af1489c4946672f6caa5b5fe196ce
# Parent  a16bf3b5d0b964739a92ddbba418ab02709be59b
ECTP: adopt interface changes of RegisteredProfile

wbemain -ac CIM_ElementConformsToProfile 'http://localhost/root/virt:KVM_HostSystem.CreationClassName="KVM_HostSystem",Name="wrong"'
is returning
localhost:5988/root/virt:KVM_RegisteredProfile.InstanceID="CIM:DSP1042-SystemVirtualization-1.0.0"
instead of NOT_FOUND

Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>

diff -r a16bf3b5d0b9 -r 59f38ff0007a src/Virt_ElementConformsToProfile.c
--- a/src/Virt_ElementConformsToProfile.c	Fri Mar 14 11:02:13 2008 +0100
+++ b/src/Virt_ElementConformsToProfile.c	Fri Mar 14 11:03:15 2008 +0100
@@ -60,7 +60,7 @@ static CMPIStatus elem_instances(const C
         char *classname;
 
         classname = get_typed_class(pfx_from_conn(conn), 
-                                    profile->provider_name);
+                                    profile->scoping_class);
         if (classname == NULL) {
                 cu_statusf(_BROKER, &s,
                            CMPI_RC_ERR_FAILED, 
@@ -72,7 +72,7 @@ static CMPIStatus elem_instances(const C
         if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op))
                 goto out;
         
-        en = CBEnumInstances(_BROKER, info->context , op, NULL, &s);
+        en = CBEnumInstances(_BROKER, info->context , op, info->properties, &s);
         if (en == NULL) {
                 cu_statusf(_BROKER, &s,
                            CMPI_RC_ERR_FAILED, 
@@ -103,12 +103,17 @@ static CMPIStatus prof_to_elem(const CMP
                                struct inst_list *list)
 {
         CMPIStatus s = {CMPI_RC_OK, NULL};
+        CMPIInstance *instance = NULL;
         virConnectPtr conn = NULL;
         const char *id;
         int i;
         
         if (!match_hypervisor_prefix(ref, info))
                 return s;
+
+        s = get_profile_by_ref(_BROKER, ref, info->properties, &instance);
+        if (s.rc != CMPI_RC_OK)
+                goto out;
 
         conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
         if (conn == NULL)
@@ -122,11 +127,12 @@ static CMPIStatus prof_to_elem(const CMP
         }
 
         for (i = 0; profiles[i] != NULL; i++) {
-                if (STREQ(id, profiles[i]->reg_id)) {
-                        s = elem_instances(ref, info, list, 
-                                           profiles[i], conn);
-                        if ((s.rc != CMPI_RC_OK))
-                                goto out;
+                if (STREQC(id, profiles[i]->reg_id)) {
+                        s = elem_instances(ref,
+                                           info,
+                                           list, 
+                                           profiles[i],
+                                           conn);
                         break;
                 }
         }
@@ -142,13 +148,20 @@ static CMPIStatus elem_to_prof(const CMP
                                struct inst_list *list)
 {
         CMPIStatus s = {CMPI_RC_OK, NULL};
-        CMPIInstance *instance;
+        CMPIInstance *instance = NULL;
         virConnectPtr conn = NULL;
         char *classname;
-        struct reg_prof *candidate;
         int i;
         
         if (!match_hypervisor_prefix(ref, info))
+                return s;
+
+        instance = CBGetInstance(_BROKER,
+                                 info->context,
+                                 ref,
+                                 NULL,
+                                 &s);
+        if (s.rc != CMPI_RC_OK)
                 return s;
 
         conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
@@ -164,22 +177,18 @@ static CMPIStatus elem_to_prof(const CMP
         }
 
         for (i = 0; profiles[i] != NULL; i++) {
-                candidate = profiles[i];
-                if (!STREQC(candidate->provider_name, classname))
+                if (!STREQC(profiles[i]->scoping_class, classname))
                         continue;
 
-                instance = reg_prof_instance(_BROKER, 
-                                             "root/interop", 
-                                             NULL,
-                                             conn,
-                                             candidate);
-                if (instance == NULL) {
-                        cu_statusf(_BROKER, &s, 
-                                   CMPI_RC_ERR_FAILED,
-                                   "Can't create profile instance");
+                s = get_profile(_BROKER,
+                                ref, 
+                                info->properties,
+                                pfx_from_conn(conn),
+                                profiles[i],
+                                &instance);
+                if (s.rc != CMPI_RC_OK)
                         goto out;
-                }
-                
+
                 inst_list_add(list, instance);
         }
              




More information about the Libvirt-cim mailing list