util: qemu: Allow for different approaches to format JSON arrays

For use with memory hotplug virQEMUBuildCommandLineJSONRecurse attempted
to format JSON arrays as bitmap on the command line. Make the formatter
function configurable so that it can be reused with different syntaxes
of arrays such as numbered arrays for use with disk sources.

This patch extracts the code and adds a parameter for the function that
will allow to plug in different formatters.
This commit is contained in:
Peter Krempa
2016-07-22 17:50:03 +02:00
parent cd86d6f465
commit b7eef33df2
4 changed files with 61 additions and 26 deletions

View File

@@ -51,7 +51,8 @@ testQemuCommandBuildFromJSON(const void *opaque)
virAsprintf(&expect, ",%s", data->expectprops) < 0)
return -1;
if (virQEMUBuildCommandLineJSON(val, &buf) < 0) {
if (virQEMUBuildCommandLineJSON(val, &buf,
virQEMUBuildCommandLineJSONArrayBitmap) < 0) {
fprintf(stderr,
"\nvirQEMUBuildCommandlineJSON failed process JSON:\n%s\n",
data->props);