mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-22 22:13:18 +00:00
virQEMUBuildCommandLineJSONRecurse: Error out when array conversion function is not provided
For conversion of '-device' we'll try to avoid usage of arrays if possible, so for now if the array coversion function is not provided the convertor will error out. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
5204578993
commit
93cdb1cae2
@ -219,7 +219,13 @@ virQEMUBuildCommandLineJSONRecurse(const char *key,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arrayFunc || arrayFunc(key, value, buf, skipKey) < 0) {
|
if (!arrayFunc) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
_("JSON array -> commandline conversion function not provided"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arrayFunc(key, value, buf, skipKey) < 0) {
|
||||||
/* fallback, treat the array as a non-bitmap, adding the key
|
/* fallback, treat the array as a non-bitmap, adding the key
|
||||||
* for each member */
|
* for each member */
|
||||||
for (i = 0; i < virJSONValueArraySize(value); i++) {
|
for (i = 0; i < virJSONValueArraySize(value); i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user