Re: [PATCH v3 06/15] conf: expand network device callbacks to cover bandwidth updates

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

 



On 02/05/2018 04:28 PM, Daniel P. Berrangé wrote:
> Currently the QEMU driver will call directly into the network driver
> impl to modify network device bandwidth for interfaces with
> type=network. This introduces a callback system to allow us to decouple
> the QEMU driver from the network driver.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c      | 35 ++++++++++++++++++++++++++++++++++-
>  src/conf/domain_conf.h      | 22 +++++++++++++++++++++-
>  src/libvirt_private.syms    |  2 ++
>  src/network/bridge_driver.c |  8 +++++---
>  src/network/bridge_driver.h | 24 ------------------------
>  src/qemu/qemu_driver.c      |  5 ++---
>  6 files changed, 64 insertions(+), 32 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 1e3a83cf73..205f99618d 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -28820,15 +28820,22 @@ virDomainNetTypeSharesHostView(const virDomainNetDef *net)
>  static virDomainNetAllocateActualDeviceImpl netAllocate;
>  static virDomainNetNotifyActualDeviceImpl netNotify;
>  static virDomainNetReleaseActualDeviceImpl netRelease;
> +static virDomainNetBandwidthChangeAllowedImpl netBandwidthChangeAllowed;
> +static virDomainNetBandwidthUpdateImpl netBandwidthUpdate;
> +
>  
>  void
>  virDomainNetSetDeviceImpl(virDomainNetAllocateActualDeviceImpl allocate,
>                            virDomainNetNotifyActualDeviceImpl notify,
> -                          virDomainNetReleaseActualDeviceImpl release)
> +                          virDomainNetReleaseActualDeviceImpl release,
> +                          virDomainNetBandwidthChangeAllowedImpl bandwidthChangeAllowed,
> +                          virDomainNetBandwidthUpdateImpl bandwidthUpdate)
>  {
>      netAllocate = allocate;
>      netNotify = notify;
>      netRelease = release;
> +    netBandwidthChangeAllowed = bandwidthChangeAllowed;
> +    netBandwidthUpdate = bandwidthUpdate;
>  }
>  
>  int
> @@ -28870,3 +28877,29 @@ virDomainNetReleaseActualDevice(virDomainDefPtr dom,
>  
>      return netRelease(dom, iface);
>  }
> +
> +bool
> +virDomainNetBandwidthChangeAllowed(virDomainNetDefPtr iface,
> +                              virNetDevBandwidthPtr newBandwidth)
> +{
> +    if (!netBandwidthChangeAllowed) {
> +        virReportError(VIR_ERR_NO_SUPPORT, "%s",
> +                       _("Network device release not available"));

"Network device bandwidth change not available" or something among those
lines.

> +        return -1;
> +    }
> +
> +    return netBandwidthChangeAllowed(iface, newBandwidth);
> +}> +
> +int
> +virDomainNetBandwidthUpdate(virDomainNetDefPtr iface,
> +                            virNetDevBandwidthPtr newBandwidth)
> +{
> +    if (!netBandwidthUpdate) {
> +        virReportError(VIR_ERR_NO_SUPPORT, "%s",
> +                       _("Network device release not available"));

Same here.

> +        return -1;
> +    }

Michal

--
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]

  Powered by Linux