aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorAndrea Bolognani <abologna@redhat.com>2023-02-24 19:49:49 +0100
committerStefano Brivio <sbrivio@redhat.com>2023-02-27 18:56:29 +0100
commit0d547a5b0f0bcb3c98f0323adbe4b9fc242ed6a1 (patch)
treeffccc981f3c1c0ac9fbdebe9a6f9c03c85de912a
parent4f2341f31d3640751f41aeaeea24ba6ba140c140 (diff)
downloadpasst-0d547a5b0f0bcb3c98f0323adbe4b9fc242ed6a1.tar
passt-0d547a5b0f0bcb3c98f0323adbe4b9fc242ed6a1.tar.gz
passt-0d547a5b0f0bcb3c98f0323adbe4b9fc242ed6a1.tar.bz2
passt-0d547a5b0f0bcb3c98f0323adbe4b9fc242ed6a1.tar.lz
passt-0d547a5b0f0bcb3c98f0323adbe4b9fc242ed6a1.tar.xz
passt-0d547a5b0f0bcb3c98f0323adbe4b9fc242ed6a1.tar.zst
passt-0d547a5b0f0bcb3c98f0323adbe4b9fc242ed6a1.zip
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>
-rw-r--r--qrap.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/qrap.c b/qrap.c
index 27c12ed..d0e2fb2 100644
--- a/qrap.c
+++ b/qrap.c
@@ -311,7 +311,11 @@ int main(int argc, char **argv)
}
qemu_argv[qemu_argc++] = "-netdev";
- qemu_argv[qemu_argc++] = "socket,fd=" STR(DEFAULT_FD) ",id=hostnet0";
+ if (!has_json) {
+ 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;
valid_args: