From: Andrea Bolognani <abologna@redhat.com>
To: passt-dev@passt.top
Subject: [PATCH 5/5] qrap: Generate -netdev as JSON
Date: Fri, 24 Feb 2023 19:49:49 +0100 [thread overview]
Message-ID: <20230224184949.518615-6-abologna@redhat.com> (raw)
In-Reply-To: <20230224184949.518615-1-abologna@redhat.com>
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>
---
qrap.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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:
--
@@ -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:
--
2.39.2
next prev parent reply other threads:[~2023-02-24 18:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-24 18:49 [PATCH 0/5] qrap: Fix a number of issues Andrea Bolognani
2023-02-24 18:49 ` [PATCH 1/5] qrap: Fix limits for PCI addresses Andrea Bolognani
2023-02-26 23:54 ` David Gibson
2023-02-24 18:49 ` [PATCH 2/5] qrap: Fix support for pc machines Andrea Bolognani
2023-02-26 23:55 ` David Gibson
2023-02-24 18:49 ` [PATCH 3/5] qrap: Drop args in JSON format Andrea Bolognani
2023-02-26 23:56 ` David Gibson
2023-02-24 18:49 ` [PATCH 4/5] qrap: Introduce machine-specific PCI address base Andrea Bolognani
2023-02-26 23:58 ` David Gibson
2023-02-24 18:49 ` Andrea Bolognani [this message]
2023-02-27 0:00 ` [PATCH 5/5] qrap: Generate -netdev as JSON David Gibson
2023-02-24 19:36 ` [PATCH 0/5] qrap: Fix a number of issues Andrea Bolognani
2023-02-27 10:25 ` Stefano Brivio
2023-02-27 13:59 ` Andrea Bolognani
2023-02-27 21:54 ` Stefano Brivio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230224184949.518615-6-abologna@redhat.com \
--to=abologna@redhat.com \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).