[libvirt] [PATCH 2/3] qemu: XMLToNative: Don't open vhostfd

Laine Stump laine at laine.org
Thu Mar 13 21:18:33 UTC 2014


On 03/13/2014 01:13 PM, Cole Robinson wrote:
> Just skip the vhost command line generation, since this won't work if
> attempting to run manually.
> ---
>  src/qemu/qemu_command.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 755a72a..bf7fb12 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -7521,7 +7521,8 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
>                                virQEMUCapsPtr qemuCaps,
>                                int vlan,
>                                int bootindex,
> -                              enum virNetDevVPortProfileOp vmop)
> +                              enum virNetDevVPortProfileOp vmop,
> +                              bool forXMLToArgv)


Ah, *now* I understand why you used that name - you're using it to
indicate multiple behavior changes that coincidentally are needed when
calling for XMLtoNative.

Thinking... thinking...

So a more generic way of describing this is that you want a commandline
that will be runnable standalone, not requiring/supporting all the setup
done by libvirt when it will be running the command itself.

So maybe name it "standalone"?

Beyond that, now I'm wondering, *is* the purpose of xml-to-native to
generate something the user can run standalone? Or is it to give them a
simple way to see the exact command that libvirt would have run to start
this domain? If the former, then ACK to both this and 1/3 (but maybe
give another thought to the name for the bool). If the latter, then
maybe we shouldn't be doing this series anyway...


>  {
>      int ret = -1;
>      char *nic = NULL, *host = NULL;
> @@ -7579,10 +7580,11 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
>              goto cleanup;
>      }
>  
> -    if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
> -        actualType == VIR_DOMAIN_NET_TYPE_BRIDGE ||
> -        actualType == VIR_DOMAIN_NET_TYPE_ETHERNET ||
> -        actualType == VIR_DOMAIN_NET_TYPE_DIRECT) {
> +    if ((actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
> +         actualType == VIR_DOMAIN_NET_TYPE_BRIDGE ||
> +         actualType == VIR_DOMAIN_NET_TYPE_ETHERNET ||
> +         actualType == VIR_DOMAIN_NET_TYPE_DIRECT) &&
> +        !forXMLToArgv) {
>          /* Attempt to use vhost-net mode for these types of
>             network device */
>          vhostfdSize = net->driver.virtio.queues;
> @@ -8759,7 +8761,8 @@ qemuBuildCommandLine(virConnectPtr conn,
>                  vlan = i;
>  
>              if (qemuBuildInterfaceCommandLine(cmd, driver, conn, def, net,
> -                                              qemuCaps, vlan, bootNet, vmop) < 0)
> +                                              qemuCaps, vlan, bootNet, vmop,
> +                                              forXMLToArgv) < 0)
>                  goto error;
>              last_good_net = i;
>              bootNet = 0;




More information about the libvir-list mailing list