
KR> + KR> + op = CMGetObjectPath(inst, NULL); KR> + if (op == NULL) { KR> + CU_DEBUG("Unable to determine class of InputRASD"); KR> + return NULL; KR> + } KR> + KR> + if ((cu_get_str_prop(inst, "Caption", &val) != CMPI_RC_OK) || KR> + (get_input_type_bus_from_cap(val, &type, &bus, &vtype) != 1)) { KR> + if (STREQC(dev->dev.input.type, "mouse")) KR> + dev->dev.input.bus = strdup("ps2"); KR> + else if (STREQC(dev->dev.input.type, "tablet")) KR> + dev->dev.input.bus = strdup("usb"); KR> + else { KR> + msg = "Invalid value for ResourceSubType in InputRASD"; KR> + goto out; KR> + } KR> + } else KR> + dev->dev.input.bus = strdup(bus);
...and this, we should make sure that an invalid input type properly rejects with the libvirt error when we try to define it. Now that we have that infrastructure in place, it would be nice to make sure that if we don't do input checking here, a reasonable error makes it back to the user.
This is handled by the error message patch you recently pushed into the tree. You'll see failure messages like: <ERROR CODE="1" DESCRIPTION="CIM_ERR_FAILED: Failed to define domain: internal error unknown input device type 'invalid'"/> <ERROR CODE="1" DESCRIPTION="CIM_ERR_FAILED: Failed to define domain: internal error unknown input bus type 'invalid'"/> I'll submit a new patch set to fix the other issues. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com