
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1209667072 25200 # Node ID df67e47476756c5cfdb77a976308677ac1742186 # Parent d4ea8516ae04a2e3ab0060f297035b107b59b81d Add the ValueRole to the SDC reference This extends the default make_reference() function to set the proper ValueRole and ValueRange properties for the AC->RASD reference. Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r d4ea8516ae04 -r df67e4747675 src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Thu May 01 10:45:16 2008 -0700 +++ b/src/Virt_SettingsDefineCapabilities.c Thu May 01 11:37:52 2008 -0700 @@ -1063,6 +1063,49 @@ static CMPIStatus vsmsd_to_migrate_cap(c return s; } +static CMPIInstance *make_ref_valuerole(const CMPIObjectPath *source_ref, + const CMPIInstance *target_inst, + struct std_assoc_info *info, + struct std_assoc *assoc) +{ + CMPIInstance *ref_inst = NULL; + uint16_t valuerole = SDC_ROLE_SUPPORTED; + uint16_t valuerange; + const char *iid = NULL; + + ref_inst = make_reference(_BROKER, + source_ref, + target_inst, + info, + assoc); + + if (cu_get_str_prop(target_inst, "InstanceID", &iid) != CMPI_RC_OK) { + CU_DEBUG("Target instance does not have an InstanceID"); + goto out; + } + + if (strstr("Default", iid) != NULL) + valuerange = SDC_RANGE_POINT; + else if (strstr("Increment", iid) != NULL) + valuerange = SDC_RANGE_INC; + else if (strstr("Maximum", iid) != NULL) + valuerange = SDC_RANGE_MAX; + else if (strstr("Minimum", iid) != NULL) + valuerange = SDC_RANGE_MIN; + else + CU_DEBUG("Unknown default RASD type: `%s'", iid); + + if (valuerange == SDC_RANGE_POINT) + valuerole = SDC_ROLE_DEFAULT; + + CMSetProperty(ref_inst, "ValueRole", + (CMPIValue *)&valuerole, CMPI_uint16); + CMSetProperty(ref_inst, "ValueRange", + (CMPIValue *)&valuerange, CMPI_uint16); + out: + return ref_inst; +} + LIBVIRT_CIM_DEFAULT_MAKEREF() static char* group_component[] = { @@ -1105,7 +1148,7 @@ static struct std_assoc _alloc_cap_to_ra .assoc_class = (char**)&assoc_classname, .handler = alloc_cap_to_rasd, - .make_ref = make_ref + .make_ref = make_ref_valuerole }; static struct std_assoc _rasd_to_alloc_cap = {