
# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1195812682 -3600 # Node ID 883d767c64256f4d582f06125e05f392454f8a15 # Parent 50b0c2bad1e31abff47a9c3a98f9e14b5e29efe9 Fix class prefix to depend on established hypervisor connection Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com> diff -r 50b0c2bad1e3 -r 883d767c6425 src/Virt_ElementConformsToProfile.c --- a/src/Virt_ElementConformsToProfile.c Fri Nov 23 11:05:46 2007 +0100 +++ b/src/Virt_ElementConformsToProfile.c Fri Nov 23 11:11:22 2007 +0100 @@ -50,7 +50,8 @@ static CMPIStatus elem_instances(const C static CMPIStatus elem_instances(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list, - struct reg_prof *profile) + struct reg_prof *profile, + virConnectPtr conn) { CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIObjectPath *op; @@ -58,7 +59,8 @@ static CMPIStatus elem_instances(const C CMPIData data ; char *classname; - classname = get_typed_class("Xen", profile->provider_name); + classname = get_typed_class(pfx_from_conn(conn), + profile->provider_name); if (classname == NULL) { CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -101,9 +103,14 @@ static CMPIStatus prof_to_elem(const CMP struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; + virConnectPtr conn = NULL; char *id; int i; + conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); + if (conn == NULL) + goto out; + id = cu_get_str_path(ref, "InstanceID"); if (id == NULL) { CMSetStatusWithChars(_BROKER, &s, @@ -114,7 +121,8 @@ 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]); + s = elem_instances(ref, info, list, + profiles[i], conn); if ((s.rc != CMPI_RC_OK)) goto error; break; @@ -122,6 +130,7 @@ static CMPIStatus prof_to_elem(const CMP } error: + virConnectClose(conn); free(id); out: return s; @@ -180,10 +189,16 @@ static CMPIInstance *make_ref(const CMPI struct std_assoc_info *info, struct std_assoc *assoc) { - CMPIInstance *assoc_inst; + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *assoc_inst = NULL; + virConnectPtr conn = NULL; + + conn = connect_by_classname(_BROKER, CLASSNAME(source_op), &s); + if (conn == NULL) + goto out; assoc_inst = get_typed_instance(_BROKER, - "Xen", + pfx_from_conn(conn), "ElementConformsToProfile", NAMESPACE(source_op)); @@ -197,6 +212,9 @@ static CMPIInstance *make_ref(const CMPI (CMPIValue *)&(target_op), CMPI_ref); } + virConnectClose(conn); + + out: return assoc_inst; }