On Fri Oct 16, 2026 at 9:00 AM CEST, Michal Privoznik via Devel wrote:
> From: Michal Privoznik <[email protected]>
>
> Inside of qemuxml2argvmock.c there's an alternative
> implementation of qemuInterfaceOpenVhostNet(). Fair enough. But
> the original function (living in qemu_interface.c) has a check
> which exits early from the function. This check is lacking in the
> mock which then leads qemuxmlconftest generate a different cmd
> line than the production code.
>
> The is particularly important, when the check is changed and we

s/The/The check/ ??

> want to verify through tests that it doesn't break anything.
>

Well, ideally we should extract the part of the function that opens the
vhostnet_path and mock that which would lead to more deduplication and it would
also be more error-prone in case any future change is done.  But that's not a
hard blocker.

> Signed-off-by: Michal Privoznik <[email protected]>
> ---
>  tests/qemuxml2argvmock.c                                   | 7 ++++++-
>  tests/qemuxmlconfdata/downscript.x86_64-latest.args        | 2 +-
>  tests/qemuxmlconfdata/net-coalesce.x86_64-latest.args      | 6 +++---
>  .../net-eth-unmanaged-tap.x86_64-latest.args               | 2 +-
>  tests/qemuxmlconfdata/net-isolated-port.x86_64-latest.args | 2 +-
>  tests/qemuxmlconfdata/net-midonet.x86_64-latest.args       | 2 +-
>  tests/qemuxmlconfdata/net-mtu.x86_64-latest.args           | 4 ++--
>  .../net-virtio-network-portgroup.x86_64-latest.args        | 2 +-
>  .../net-virtio-teaming-network.x86_64-latest.args          | 2 +-
>  tests/qemuxmlconfdata/net-virtio-vhost.x86_64-latest.args  | 6 +++---
>  .../qemuxmlconfdata/tap-vhost-incorrect.x86_64-latest.args | 2 +-
>  tests/qemuxmlconfdata/tap-vhost.x86_64-latest.args         | 2 +-
>  12 files changed, 22 insertions(+), 17 deletions(-)
>
> diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
> index 4f47b2598e..7b211a191d 100644
> --- a/tests/qemuxml2argvmock.c
> +++ b/tests/qemuxml2argvmock.c
> @@ -222,13 +222,18 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path 
> G_GNUC_UNUSED,
>  }
>  
>  int
> -qemuInterfaceOpenVhostNet(virDomainObj *vm G_GNUC_UNUSED,
> +qemuInterfaceOpenVhostNet(virDomainObj *vm,
>                            virDomainNetDef *net)
>  {
>      qemuDomainNetworkPrivate *netpriv = QEMU_DOMAIN_NETWORK_PRIVATE(net);
>      size_t vhostfdSize = net->driver.virtio.queues;
>      size_t i;
>  
> +    if (vm->def->virtType != VIR_DOMAIN_VIRT_KVM ||
> +        net->driver.virtio.name == VIR_DOMAIN_NET_DRIVER_TYPE_QEMU) {
> +        return 0;
> +    }
> +
>      if (!vhostfdSize)
>           vhostfdSize = 1;
>  

One nitpick, just to make it "look" like the mocked function, I'd reorder these
two conditions.

But since the changes (apart from the commit message fix) are optionals, then

Reviewed-by: Martin Kletzander <[email protected]>

with the commit message fixed.

Reply via email to