[libvirt] [PATCH 3/4] qemuBuildHostNetStr: move stray VIR_DOMAIN_NET_TYPE_INTERNAL

Pavel Hrdina phrdina at redhat.com
Fri Oct 21 12:33:14 UTC 2016


On Fri, Oct 14, 2016 at 04:32:17PM +0200, Ján Tomko wrote:
> This network type is only used by the vbox driver and it does not
> make sense to group it with VIR_DOMAIN_NET_TYPE_USER.
> 
> Introduced by commit 1dcbef8.
> ---
>  src/qemu/qemu_command.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 80ebe51..19ee652 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -3719,7 +3719,6 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
>          break;
>  
>      case VIR_DOMAIN_NET_TYPE_USER:
> -    case VIR_DOMAIN_NET_TYPE_INTERNAL:
>          virBufferAsprintf(&buf, "user%c", type_sep);
>          break;
>  
> @@ -3737,6 +3736,8 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
>                                net->driver.virtio.queues);
>          break;
>  
> +    case VIR_DOMAIN_NET_TYPE_INTERNAL:
> +        /* Not supported by QEMU driver */
>      case VIR_DOMAIN_NET_TYPE_LAST:
>          break;
>      }

This one is tricky.  The net type *internal* was introduced for vbox driver,
but there was no check in other drivers to refuse this type.  Before commit
1dcbef8 this code handled all not listed cases the same way as net type *user*
and that goes back before the *internal* type was introduced.  So basically for
qemu driver we've handled *internal* as *user* since it was introduced in
libvirt.

Personaly I don't like that fact and IMO we can add a code to
${driver}DomainDefValidate() to refuse that type except vbox driver.
The argument to do it is that the net type *internal* is not documented
so there is a chance that it's not used at all for other drivers except vbox.

This patch resolves in this error while starting a guest:

error: internal error: process exited while connecting to monitor:
2016-10-21T12:28:46.841029Z qemu-system-x86_64: -netdev id=hostnet1: Parameter
'type' is missing

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20161021/1d7d863a/attachment-0001.sig>


More information about the libvir-list mailing list