
# HG changeset patch # User Gareth S. Bestor <bestor@us.ibm.com> # Date 1313162799 25200 # Node ID 39c85f57c94fa36c681d4e9caa6e14617dcc7e60 # Parent 8b4f6d69f40904ced24f7948f04f89e770e37bce Patches for Virt_SettingsDefineCapabilities: incorrect Default ValueRole, strstr() misuse - The CIM_AllocationCapabilities for 'Default' RASDs have the incorrect ValueRole. per DSP1043 "Allocation Capabilities Profile", Section 10.5 "CIM_SettingsDefineCapabilities – Default" the ValueRole should be 0 ("Default") - Fixed mistake with usage of strstr() swapping the arguments; should be: char *strstr(const char *haystack, const char *needle); This may not have mattered before when both strings were always exactly same or didnt match, but now for new 'Point' instances the instanceid has a prefix. Signed-off-by: Gareth S. Bestor <bestor@us.ibm.com> diff -r 8b4f6d69f409 -r 39c85f57c94f src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Mon Aug 08 11:40:09 2011 -0700 +++ b/src/Virt_SettingsDefineCapabilities.c Fri Aug 12 08:26:39 2011 -0700 @@ -2054,19 +2054,22 @@ goto out; } - if (strstr("Default", iid) != NULL) + if (strstr(iid, "Default") != NULL) { valuerange = SDC_RANGE_POINT; - else if (strstr("Increment", iid) != NULL) + valuerole = SDC_ROLE_DEFAULT; + } + else if (strstr(iid, "Point") != NULL) + valuerange = SDC_RANGE_POINT; + else if (strstr(iid, "Increment") != NULL) valuerange = SDC_RANGE_INC; - else if (strstr("Maximum", iid) != NULL) + else if (strstr(iid, "Maximum") != NULL) valuerange = SDC_RANGE_MAX; - else if (strstr("Minimum", iid) != NULL) + else if (strstr(iid, "Minimum") != NULL) valuerange = SDC_RANGE_MIN; - else - CU_DEBUG("Unknown default RASD type: `%s'", iid); - - if (valuerange == SDC_RANGE_POINT) - valuerole = SDC_ROLE_DEFAULT; + else { + CU_DEBUG("Unknown RASD type: `%s'", iid); + goto out; + } CMSetProperty(ref_inst, "ValueRole", (CMPIValue *)&valuerole, CMPI_uint16);