public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] qrap: Pass PCI device numbers to qemu in base 10, not in base 16
@ 2023-02-21 19:24 Stefano Brivio
  2023-02-22  0:27 ` David Gibson
  2023-02-22 10:40 ` Andrea Bolognani
  0 siblings, 2 replies; 12+ messages in thread
From: Stefano Brivio @ 2023-02-21 19:24 UTC (permalink / raw)
  To: passt-dev; +Cc: Alona Paz, Andrea Bolognani

Alona reports that when libvirt starts qrap (KubeVirt integration)
and the domain description leads to more than 10 devices, indices of
PCI device descriptors are formatted as hexadecimal, so we end up
with things like "pci.a" instead of "pci.10".

Reported-by: Alona Paz <alkaplan@redhat.com>
Fixes: 5307faa05997 ("qrap: Strip network devices from command line, set them up according to machine")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 qrap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/qrap.c b/qrap.c
index 287198e..ff99c89 100644
--- a/qrap.c
+++ b/qrap.c
@@ -281,11 +281,11 @@ int main(int argc, char **argv)
 		qemu_argv[qemu_argc++] = "-device";
 		if (!has_json) {
 			snprintf(dev_str, ARG_MAX,
-			         "%s,%s%x%s,netdev=hostnet0,x-txburst=4096",
+			         "%s,%s%i%s,netdev=hostnet0,x-txburst=4096",
 			         dev->name, dev->template, i, dev->template_post);
 		} else {
 			snprintf(dev_str, ARG_MAX,
-			         "{\"driver\":\"%s\",%s%x\"%s,\"netdev\":\"hostnet0\",\"x-txburst\":4096}",
+			         "{\"driver\":\"%s\",%s%i\"%s,\"netdev\":\"hostnet0\",\"x-txburst\":4096}",
 			         dev->name, dev->template_json, i, dev->template_json_post);
 		}
 		qemu_argv[qemu_argc++] = dev_str;
-- 
@@ -281,11 +281,11 @@ int main(int argc, char **argv)
 		qemu_argv[qemu_argc++] = "-device";
 		if (!has_json) {
 			snprintf(dev_str, ARG_MAX,
-			         "%s,%s%x%s,netdev=hostnet0,x-txburst=4096",
+			         "%s,%s%i%s,netdev=hostnet0,x-txburst=4096",
 			         dev->name, dev->template, i, dev->template_post);
 		} else {
 			snprintf(dev_str, ARG_MAX,
-			         "{\"driver\":\"%s\",%s%x\"%s,\"netdev\":\"hostnet0\",\"x-txburst\":4096}",
+			         "{\"driver\":\"%s\",%s%i\"%s,\"netdev\":\"hostnet0\",\"x-txburst\":4096}",
 			         dev->name, dev->template_json, i, dev->template_json_post);
 		}
 		qemu_argv[qemu_argc++] = dev_str;
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-02-25  1:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-21 19:24 [PATCH] qrap: Pass PCI device numbers to qemu in base 10, not in base 16 Stefano Brivio
2023-02-22  0:27 ` David Gibson
2023-02-22 10:40 ` Andrea Bolognani
2023-02-22 10:45   ` Stefano Brivio
2023-02-22 12:47     ` Andrea Bolognani
2023-02-22 13:02       ` Stefano Brivio
2023-02-22 22:27   ` David Gibson
2023-02-23 14:06     ` Andrea Bolognani
2023-02-24  7:14       ` Stefano Brivio
2023-02-24 19:05         ` Andrea Bolognani
2023-02-24 19:32           ` Stefano Brivio
2023-02-25  1:44             ` David Gibson

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).