# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1205412134 -3600
# Node ID 32a472f243e4f4a94e5c79a1f7393f1764e5cba8
# Parent c54f01516458be69a914427668857951fb94e278
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(a)linux.vnet.ibm.com>
diff -r c54f01516458 -r 32a472f243e4 src/Virt_ElementConformsToProfile.c
--- a/src/Virt_ElementConformsToProfile.c Thu Mar 13 13:41:27 2008 +0100
+++ b/src/Virt_ElementConformsToProfile.c Thu Mar 13 13:42:14 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,19 @@ 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,
+ CIM_INTEROP_NS,
+ pfx_from_conn(conn),
+ profiles[i],
+ &instance);
+ if (s.rc != CMPI_RC_OK)
goto out;
- }
-
+
inst_list_add(list, instance);
}