public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Cc: Alona Paz <alkaplan@redhat.com>, Andrea Bolognani <abologna@redhat.com>
Subject: [PATCH] qrap: Pass PCI device numbers to qemu in base 10, not in base 16
Date: Tue, 21 Feb 2023 20:24:25 +0100	[thread overview]
Message-ID: <20230221192425.3745394-1-sbrivio@redhat.com> (raw)

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


             reply	other threads:[~2023-02-21 19:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21 19:24 Stefano Brivio [this message]
2023-02-22  0:27 ` [PATCH] qrap: Pass PCI device numbers to qemu in base 10, not in base 16 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

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=20230221192425.3745394-1-sbrivio@redhat.com \
    --to=sbrivio@redhat.com \
    --cc=abologna@redhat.com \
    --cc=alkaplan@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).