qmp: set accurate parameter name for error msg of device-list-properties
PATCH 1/1 qmp: set accurate parameter name for error msg of device-list-properties
--- qmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qmp.c +1 -1
@@ -531,7 +531,7 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename, klass =object_class_dynamic_cast (klass,TYPE_DEVICE );if (klass ==NULL ) { -error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"name" ,TYPE_DEVICE ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"typename" ,TYPE_DEVICE );return NULL ; }
Signature · 1 line
2.9.2
Quoted 2 lines · Lin Ma
Signed-off-by Lin Ma <[email protected]>---
The commit message is rather sparse; is there an easy formula for triggering the error message, to give more context about the change?
Quoted 17 lines
qmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)qmp.c +1
-1@@ -531,7 +531,7 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename, klass =object_class_dynamic_cast (klass,TYPE_DEVICE );if (klass ==NULL ) { -error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"name" ,TYPE_DEVICE ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"typename" ,TYPE_DEVICE );return NULL ; }
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 6 lines · Eric Blake
Quoted 2 lines · Lin Ma
Signed-off-by Lin Ma <[email protected]>---
The commit message is rather sparse; is there an easy formula for triggering the error message, to give more context about the change?
Try this:
-> { "execute": "device-list-properties", "arguments": { "typename": "accel" } } <- {"error": {"class": "GenericError", "desc": "Parameter 'name' expects device"}}
Type "accel" exists, but it's not a subtype of TYPE_DEVICE.
Perhaps:
qmp: Fix argument name in error message of device-list-properties
The argument is called "typename", not "name".
Quoted 9 lines
Quoted 9 lines
qmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)qmp.c +0
-0@@ -531,7 +531,7 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
Quoted 6 lines
qmp.c DevicePropertyInfoList *qmp_device_list_properties(const char *typename, · line 536
Quoted 6 lines
qmp.c +1
-1klass =object_class_dynamic_cast (klass,TYPE_DEVICE );if (klass ==NULL ) { -error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"name" ,TYPE_DEVICE ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"typename" ,TYPE_DEVICE );return NULL ; }
Incomplete, the next one needs the same change:
if (object_class_is_abstract(klass)) {
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "name",
"non-abstract device type");
return NULL;
}Reproducer:
-> { "execute": "device-list-properties", "arguments": { "typename": "pci-qxl" } } <- {"error": {"class": "GenericError", "desc": "Parameter 'name' expects non-abstract device type"}}
Please fix this one, too.