[libvirt] [PATCH 4/6] qemu: command: replace vlan= with netdev= for legacy nic

Michal Privoznik mprivozn at redhat.com
Wed Jun 20 13:34:29 UTC 2018


On 06/19/2018 06:40 PM, Cole Robinson wrote:
> VMs with hardcoded platform network devices are forced to use old
> style '-net nic' command line config. Current we use qemu's vlan

s/Current/Currently/ perhaps?

> option to hook this with the '-netdev' host side of things.
> 
> However since qemu 1.2 there is '-net nic,netdev=X' option for
> explicitly referencing a netdev ID, which is more inline with
> typical VM commandlines, so let's switch to that
> 
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
>  src/qemu/qemu_command.c                       | 52 ++++++-------------
>  .../arm-vexpressa9-basic.args                 |  4 +-
>  2 files changed, 19 insertions(+), 37 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 31a0b7761a..a2687c5693 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -3354,15 +3354,15 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem)
>  
>  static char *
>  qemuBuildLegacyNicStr(virDomainNetDefPtr net,
> -                      int vlan)
> +                      int vlan ATTRIBUTE_UNUSED)

Might as well drop this. Looking into the future at 5/6 and you're doing
just that. My suggestion is to merge 5/6 into this one, but whatever you
prefer.

>  {
>      char *str;
>      char macaddr[VIR_MAC_STRING_BUFLEN];
>  
>      ignore_value(virAsprintf(&str,
> -                             "nic,macaddr=%s,vlan=%d%s%s%s%s",
> +                             "nic,macaddr=%s,netdev=host%s%s%s%s%s",
>                               virMacAddrFormat(&net->mac, macaddr),
> -                             vlan,
> +                             net->info.alias,
>                               (net->model ? ",model=" : ""),
>                               (net->model ? net->model : ""),
>                               (net->info.alias ? ",name=" : ""),

Michal




More information about the libvir-list mailing list