qrap: Generate -netdev as JSON

While generating -device as JSON when JSON is in use is
mandatory, because not doing so can often prevent the VM from
starting up, using JSON for -netdev simply makes things a bit
nicer. No reason not to do it, though.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Andrea Bolognani 2023-02-24 19:49:49 +01:00 committed by Stefano Brivio
parent 4f2341f31d
commit 0d547a5b0f

4
qrap.c
View file

@ -311,7 +311,11 @@ int main(int argc, char **argv)
} }
qemu_argv[qemu_argc++] = "-netdev"; qemu_argv[qemu_argc++] = "-netdev";
if (!has_json) {
qemu_argv[qemu_argc++] = "socket,fd=" STR(DEFAULT_FD) ",id=hostnet0"; qemu_argv[qemu_argc++] = "socket,fd=" STR(DEFAULT_FD) ",id=hostnet0";
} else {
qemu_argv[qemu_argc++] = "{\"type\":\"socket\",\"fd\":\"" STR(DEFAULT_FD) "\",\"id\":\"hostnet0\"}";
}
qemu_argv[qemu_argc] = NULL; qemu_argv[qemu_argc] = NULL;
valid_args: valid_args: