Re: [PATCH v2 11/14] qemuBuildInterfaceCommandLine: Pass proper args

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/06/2016 09:38 AM, Michal Privoznik wrote:
> Instead of various NULL arguments, we can pass proper qemu driver
> config, log manager, and virCommand.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/qemu/qemu_command.c | 31 ++++++++++++++++++-------------
>  1 file changed, 18 insertions(+), 13 deletions(-)
> 

This needs to be merged with patch 10

see note below

ACK w/ the merged patches - let's avoid a round of ATTRIBUTE_NONNULL

John

> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 246ffe0..895bb23 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -7822,12 +7822,15 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg,
>  }
>  
>  static int
> -qemuBuildVhostuserCommandLine(virCommandPtr cmd,
> +qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver,
> +                              virLogManagerPtr logManager,
> +                              virCommandPtr cmd,
>                                virDomainDefPtr def,
>                                virDomainNetDefPtr net,
>                                virQEMUCapsPtr qemuCaps,
>                                unsigned int bootindex)
>  {
> +    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
>      char *chardev = NULL;
>      virBuffer netdev_buf = VIR_BUFFER_INITIALIZER;
>      unsigned int queues = net->driver.virtio.queues;
> @@ -7841,7 +7844,7 @@ qemuBuildVhostuserCommandLine(virCommandPtr cmd,
>  
>      switch ((virDomainChrType) net->data.vhostuser->type) {
>      case VIR_DOMAIN_CHR_TYPE_UNIX:
> -        if (!(chardev = qemuBuildChrChardevStr(NULL, NULL, NULL, def,
> +        if (!(chardev = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
>                                                 net->data.vhostuser,
>                                                 net->info.alias, qemuCaps, false)))
>              goto error;
> @@ -7895,10 +7898,12 @@ qemuBuildVhostuserCommandLine(virCommandPtr cmd,
>  
>      virCommandAddArgList(cmd, "-device", nic, NULL);
>      VIR_FREE(nic);
> +    virObjectUnref(cfg);
>  
>      return 0;
>  
>   error:
> +    virObjectUnref(cfg);
>      VIR_FREE(chardev);
>      virBufferFreeAndReset(&netdev_buf);
>      VIR_FREE(nic);
> @@ -7907,8 +7912,9 @@ qemuBuildVhostuserCommandLine(virCommandPtr cmd,
>  }
>  
>  static int
> -qemuBuildInterfaceCommandLine(virCommandPtr cmd,
> -                              virQEMUDriverPtr driver,
> +qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
> +                              virLogManagerPtr logManager,
> +                              virCommandPtr cmd,
>                                virDomainDefPtr def,
>                                virDomainNetDefPtr net,
>                                virQEMUCapsPtr qemuCaps,
> @@ -7928,7 +7934,6 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
>      char **tapfdName = NULL;
>      char **vhostfdName = NULL;
>      virDomainNetType actualType = virDomainNetGetActualType(net);
> -    virQEMUDriverConfigPtr cfg = NULL;

NOTE: Ironically I had suggested removing cfg in patch 4.  You can
either do it then or now, it doesn't matter!

>      virNetDevBandwidthPtr actualBandwidth;
>      size_t i;
>  
> @@ -7971,8 +7976,6 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
>          return -1;
>      }
>  
> -    cfg = virQEMUDriverGetConfig(driver);
> -
>      switch (actualType) {
>      case VIR_DOMAIN_NET_TYPE_NETWORK:
>      case VIR_DOMAIN_NET_TYPE_BRIDGE:
> @@ -8032,7 +8035,8 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
>          break;
>  
>      case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
> -        ret = qemuBuildVhostuserCommandLine(cmd, def, net, qemuCaps, bootindex);
> +        ret = qemuBuildVhostuserCommandLine(driver, logManager, cmd, def,
> +                                            net, qemuCaps, bootindex);
>          goto cleanup;
>          break;
>  
> @@ -8205,7 +8209,6 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
>      VIR_FREE(host);
>      VIR_FREE(tapfdName);
>      VIR_FREE(vhostfdName);
> -    virObjectUnref(cfg);
>      return ret;
>  }
>  
> @@ -8215,8 +8218,9 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
>   *       API domainSetSecurityTapFDLabel that doesn't use the const format.
>   */
>  static int
> -qemuBuildNetCommandLine(virCommandPtr cmd,
> -                        virQEMUDriverPtr driver,
> +qemuBuildNetCommandLine(virQEMUDriverPtr driver,
> +                        virLogManagerPtr logManager,
> +                        virCommandPtr cmd,
>                          virDomainDefPtr def,
>                          virQEMUCapsPtr qemuCaps,
>                          virNetDevVPortProfileOp vmop,
> @@ -8254,7 +8258,7 @@ qemuBuildNetCommandLine(virCommandPtr cmd,
>              else
>                  vlan = i;
>  
> -            if (qemuBuildInterfaceCommandLine(cmd, driver, def, net,
> +            if (qemuBuildInterfaceCommandLine(driver, logManager, cmd, def, net,
>                                                qemuCaps, vlan, bootNet, vmop,
>                                                standalone, nnicindexes,
>                                                nicindexes) < 0)
> @@ -9481,7 +9485,8 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
>      if (qemuBuildFSDevCommandLine(cmd, def, qemuCaps) < 0)
>          goto error;
>  
> -    if (qemuBuildNetCommandLine(cmd, driver, def, qemuCaps, vmop, standalone,
> +    if (qemuBuildNetCommandLine(driver, logManager, cmd, def,
> +                                qemuCaps, vmop, standalone,
>                                  nnicindexes, nicindexes, &bootHostdevNet) < 0)
>          goto error;
>  
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]