On Fri, Feb 24, 2023 at 07:49:44PM +0100, Andrea Bolognani wrote:Andrea Bolognani (5): qrap: Fix limits for PCI addresses qrap: Fix support for pc machines qrap: Drop args in JSON format qrap: Introduce machine-specific PCI address base qrap: Generate -netdev as JSON qrap.c | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-)Some information about testing. In order to convince myself that the changes I was working on were correct, I have created a few quick and dirty test scripts. You can find them here: https://gitlab.com/abologna/passt/-/commits/qrap-tests The commit contains a few YAML files: vmi-small-q35-passt.yaml # q35 VM with few devices vmi-small-pc-passt.yaml # pc VM with few devices vmi-big-q35-passt.yaml # q35 VM with many devices vmi-big-pc-passt.yaml # pc VM with many devices Each one of those, fed into KubeVirt, results in qrap being called with a bunch of command line arguments. These are normally passed to the actual QEMU binary, but in my case I've hacked qrap so that they're simply printed out. For each of the scenarios, there are three files: vm.in # arguments passed to qrap vm.exp # arguments generated by the current version of qrap vm.sh # test script Running vm.sh results in qrap being called with the same arguments contained in vm.in (but quoted for shell consumption), with the output collected into the temporary file vm.out. This file is then compared with both vm.in (to highlight changes made by qrap) and with vm.exp (to highlight changes in behavior compared to the current version of qrap). Running these tests before applying my patches should result in vm.out being identical to vm.ext whereas, after my patches have been applied, the following important changes will be visible: --- pc-small.exp 2023-02-24 20:11:14.559711296 +0100 +++ pc-small.out 2023-02-24 20:26:53.557307727 +0100 @@ -75,6 +75,6 @@ -msg timestamp=on -device -virtio-net-pci,bus=pci.0,addr=0x2,netdev=hostnet0,x-txburst=4096 +{"driver":"virtio-net-pci","bus":"pci.0","addr":"0x8","netdev":"hostnet0","x-txburst":4096} (addresses of other devices are now parsed correctly, so qrap's interface will be assigned to slot 8, which is available, instead of slot 2, which isn't) --- q35-big.exp 2023-02-24 20:11:14.560711288 +0100 +++ q35-big.out 2023-02-24 20:27:20.632094269 +0100 @@ -159,6 +159,6 @@ -msg timestamp=on -device -{"driver":"virtio-net-pci","bus":"pci.a","addr":"0x0","netdev":"hostnet0","x-txburst":4096} +{"driver":"virtio-net-pci","bus":"pci.15","addr":"0x0","netdev":"hostnet0","x-txburst":4096} (pci.15 is correctly identified as the bus where qrap's interface should be placed instead of the non-existing pci.a bus) --- pc-big.exp 2023-02-24 20:11:14.559711296 +0100 +++ pc-big.out 2023-02-24 20:27:37.124964240 +0100 @@ -129,6 +129,6 @@ -msg timestamp=on -device -virtio-net-pci,bus=pci.0,addr=0x2,netdev=hostnet0,x-txburst=4096 +{"driver":"virtio-net-pci","bus":"pci.0","addr":"0x11","netdev":"hostnet0","x-txburst":4096} (again, an available slot will be picked) Note how the q35-small test sees no differences. That's the one scenario that was already working, so the lack of changes there is a very good thing :) In addition to these crude test scripts, I've also made a custom RPM build of passt with these patches applied and integrated it into KubeVirt. Using it, I was able to successfully submit all the YAML files mentioned earlier and get working VMs, with functional network connection, as a result. I also ran the passt tests from KubeVirt's own functional test suite, and they all passed except for one. That one's about IPv6 connectivity, and I think the lack of IPv6 connectivity in my own machine / network is to blame for the failure. This specific test fails with the non-patched version of passt too, further validating this theory. -- Andrea Bolognani / Red Hat / Virtualization