[libvirt PATCH 4/8] conf: rename virNetDevSupportBandwidth to virNetDevSupportsBandwidth

Pavel Mores pmores at redhat.com
Mon Feb 24 10:24:30 UTC 2020


On Sat, Feb 22, 2020 at 05:31:55PM +0100, Ján Tomko wrote:
> Signed-off-by: Ján Tomko <jtomko at redhat.com>
> ---
>  src/conf/netdev_bandwidth_conf.c | 2 +-
>  src/conf/netdev_bandwidth_conf.h | 2 +-
>  src/lxc/lxc_driver.c             | 4 ++--
>  src/lxc/lxc_process.c            | 2 +-
>  src/qemu/qemu_command.c          | 2 +-
>  src/qemu/qemu_driver.c           | 4 ++--
>  src/qemu/qemu_hotplug.c          | 4 ++--
>  7 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/src/conf/netdev_bandwidth_conf.c b/src/conf/netdev_bandwidth_conf.c
> index 5cbb9f46e4..349b451e41 100644
> --- a/src/conf/netdev_bandwidth_conf.c
> +++ b/src/conf/netdev_bandwidth_conf.c
> @@ -293,7 +293,7 @@ virDomainClearNetBandwidth(virDomainObjPtr vm)
>      for (i = 0; i < vm->def->nnets; i++) {
>          type = virDomainNetGetActualType(vm->def->nets[i]);
>          if (virDomainNetGetActualBandwidth(vm->def->nets[i]) &&
> -            virNetDevSupportBandwidth(type))
> +            virNetDevSupportsBandwidth(type))
>              virNetDevBandwidthClear(vm->def->nets[i]->ifname);
>      }
>  }
> diff --git a/src/conf/netdev_bandwidth_conf.h b/src/conf/netdev_bandwidth_conf.h
> index b9e57168be..172f9a50f9 100644
> --- a/src/conf/netdev_bandwidth_conf.h
> +++ b/src/conf/netdev_bandwidth_conf.h
> @@ -37,7 +37,7 @@ int virNetDevBandwidthFormat(const virNetDevBandwidth *def,
>  void virDomainClearNetBandwidth(virDomainObjPtr vm)
>      ATTRIBUTE_NONNULL(1);
>  
> -static inline bool virNetDevSupportBandwidth(virDomainNetType type)
> +static inline bool virNetDevSupportsBandwidth(virDomainNetType type)
>  {
>      switch (type) {
>      case VIR_DOMAIN_NET_TYPE_BRIDGE:
> diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
> index f7376188f0..f01c71f9e2 100644
> --- a/src/lxc/lxc_driver.c
> +++ b/src/lxc/lxc_driver.c
> @@ -3920,7 +3920,7 @@ lxcDomainAttachDeviceNetLive(virLXCDriverPtr driver,
>      /* Set bandwidth or warn if requested and not supported. */
>      actualBandwidth = virDomainNetGetActualBandwidth(net);
>      if (actualBandwidth) {
> -        if (virNetDevSupportBandwidth(actualType)) {
> +        if (virNetDevSupportsBandwidth(actualType)) {
>              if (virNetDevBandwidthSet(net->ifname, actualBandwidth, false,
>                                        !virDomainNetTypeSharesHostView(net)) < 0)
>                  goto cleanup;
> @@ -4377,7 +4377,7 @@ lxcDomainDetachDeviceNetLive(virDomainObjPtr vm,
>  
>      /* clear network bandwidth */
>      if (virDomainNetGetActualBandwidth(detach) &&
> -        virNetDevSupportBandwidth(actualType) &&
> +        virNetDevSupportsBandwidth(actualType) &&
>          virNetDevBandwidthClear(detach->ifname))
>          goto cleanup;
>  
> diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
> index 6851b3e3e2..d05304dd8f 100644
> --- a/src/lxc/lxc_process.c
> +++ b/src/lxc/lxc_process.c
> @@ -621,7 +621,7 @@ virLXCProcessSetupInterfaces(virLXCDriverPtr driver,
>          /* Set bandwidth or warn if requested and not supported. */
>          actualBandwidth = virDomainNetGetActualBandwidth(net);
>          if (actualBandwidth) {
> -            if (virNetDevSupportBandwidth(type)) {
> +            if (virNetDevSupportsBandwidth(type)) {
>                  if (virNetDevBandwidthSet(net->ifname, actualBandwidth, false,
>                                            !virDomainNetTypeSharesHostView(net)) < 0)
>                      goto cleanup;
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index f69a9e651c..c44f50b2a8 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -8080,7 +8080,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
>      /* Set bandwidth or warn if requested and not supported. */
>      actualBandwidth = virDomainNetGetActualBandwidth(net);
>      if (actualBandwidth) {
> -        if (virNetDevSupportBandwidth(actualType)) {
> +        if (virNetDevSupportsBandwidth(actualType)) {
>              if (virNetDevBandwidthSet(net->ifname, actualBandwidth, false,
>                                        !virDomainNetTypeSharesHostView(net)) < 0)
>                  goto cleanup;
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 39e1f044e0..0faf79e0d1 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -11594,12 +11594,12 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
>  
>      if (net) {
>          actualType = virDomainNetGetActualType(net);
> -        qosSupported = virNetDevSupportBandwidth(actualType);
> +        qosSupported = virNetDevSupportsBandwidth(actualType);
>      }
>  
>      if (qosSupported && persistentNet) {
>          actualType = virDomainNetGetActualType(persistentNet);
> -        qosSupported = virNetDevSupportBandwidth(actualType);
> +        qosSupported = virNetDevSupportsBandwidth(actualType);
>      }
>  
>      if (!qosSupported) {
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index 9800491755..ca18bb9e5f 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -1342,7 +1342,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
>      /* Set bandwidth or warn if requested and not supported. */
>      actualBandwidth = virDomainNetGetActualBandwidth(net);
>      if (actualBandwidth) {
> -        if (virNetDevSupportBandwidth(actualType)) {
> +        if (virNetDevSupportsBandwidth(actualType)) {
>              if (virNetDevBandwidthSet(net->ifname, actualBandwidth, false,
>                                        !virDomainNetTypeSharesHostView(net)) < 0)
>                  goto cleanup;
> @@ -4582,7 +4582,7 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver,
>          return -1;
>  
>      if (virDomainNetGetActualBandwidth(net) &&
> -        virNetDevSupportBandwidth(virDomainNetGetActualType(net)) &&
> +        virNetDevSupportsBandwidth(virDomainNetGetActualType(net)) &&
>          virNetDevBandwidthClear(net->ifname) < 0)
>          VIR_WARN("cannot clear bandwidth setting for device : %s",
>                   net->ifname);
> -- 
> 2.24.1
> 

Good change, I for one found the original, seemingly imperative name rather
confusing.

Somewhat related, there's a function called virNetDevBandwidthSupportsFloor()
in the same header file whose name seems a bit dubious as well.  Now admittedly
I was the one to add it :-) but on second thought, it doesn't really check a
bandwidth property, actually it checks a network property (it takes
virNetworkForwardType as its argument).  Would it make sense to rename it to
something like virNetworkSupportsFloor() (and then also probably move it a
better header file)?

Reviewed-by: Pavel Mores <pmores at redhat.com>




More information about the libvir-list mailing list