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
return netRelease(dom, iface);
}
+
+bool
+virDomainNetBandwidthChangeAllowed(virDomainNetDefPtr iface,
+ virNetDevBandwidthPtr newBandwidth)
+{
+ if (!netBandwidthChangeAllowed) {
+ virReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("Network device bandwidth change query not available"));
+ return -1;
+ }
+
+ return netBandwidthChangeAllowed(iface, newBandwidth);
+}
+
+int
+virDomainNetBandwidthUpdate(virDomainNetDefPtr iface,
+ virNetDevBandwidthPtr newBandwidth)
+{
+ if (!netBandwidthUpdate) {
+ virReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("Network device bandwidth update not available"));
+ return -1;
+ }
+
+ return netBandwidthUpdate(iface, newBandwidth);
+}
(*virDomainNetReleaseActualDeviceImpl)(virDomainDefPtr dom,
virDomainNetDefPtr iface);
+typedef bool
+(*virDomainNetBandwidthChangeAllowedImpl)(virDomainNetDefPtr iface,
+ virNetDevBandwidthPtr newBandwidth);
+
+typedef int
+(*virDomainNetBandwidthUpdateImpl)(virDomainNetDefPtr iface,
+ virNetDevBandwidthPtr newBandwidth);
+
+
void
virDomainNetSetDeviceImpl(virDomainNetAllocateActualDeviceImpl allocate,
virDomainNetNotifyActualDeviceImpl notify,
- virDomainNetReleaseActualDeviceImpl release);
+ virDomainNetReleaseActualDeviceImpl release,
+ virDomainNetBandwidthChangeAllowedImpl bandwidthChangeAllowed,
+ virDomainNetBandwidthUpdateImpl bandwidthUpdate);
int
virDomainNetAllocateActualDevice(virDomainDefPtr dom,
virDomainNetDefPtr iface)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+bool
+virDomainNetBandwidthChangeAllowed(virDomainNetDefPtr iface,
+ virNetDevBandwidthPtr newBandwidth)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+
+int
+virDomainNetBandwidthUpdate(virDomainNetDefPtr iface,
+ virNetDevBandwidthPtr newBandwidth)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
#endif /* __DOMAIN_CONF_H */
virDomainMemorySourceTypeToString;
virDomainNetAllocateActualDevice;
virDomainNetAppendIPAddress;
+virDomainNetBandwidthChangeAllowed;
+virDomainNetBandwidthUpdate;
virDomainNetDefClear;
virDomainNetDefFormat;
virDomainNetDefFree;
}
-bool
+static bool
networkBandwidthChangeAllowed(virDomainNetDefPtr iface,
virNetDevBandwidthPtr newBandwidth)
{
}
-int
+static int
networkBandwidthUpdate(virDomainNetDefPtr iface,
virNetDevBandwidthPtr newBandwidth)
{
virDomainNetSetDeviceImpl(
networkAllocateActualDevice,
networkNotifyActualDevice,
- networkReleaseActualDevice);
+ networkReleaseActualDevice,
+ networkBandwidthChangeAllowed,
+ networkBandwidthUpdate);
return 0;
}
dnsmasqContext *dctx,
dnsmasqCapsPtr caps);
-bool
-networkBandwidthChangeAllowed(virDomainNetDefPtr iface,
- virNetDevBandwidthPtr newBandwidth)
- ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-
-int
-networkBandwidthUpdate(virDomainNetDefPtr iface,
- virNetDevBandwidthPtr newBandwidth)
- ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-
# else
/* Define no-op replacements that don't drag in any link dependencies. */
# define networkGetActualType(iface) (iface->type)
# define networkDnsmasqConfContents(network, pidfile, configstr, \
dctx, caps) 0
-static inline bool
-networkBandwidthChangeAllowed(virDomainNetDefPtr iface ATTRIBUTE_UNUSED,
- virNetDevBandwidthPtr newBandwidth ATTRIBUTE_UNUSED)
-{
- return true;
-}
-
-static inline int
-networkBandwidthUpdate(virDomainNetDefPtr iface ATTRIBUTE_UNUSED,
- virNetDevBandwidthPtr newBandwidth ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
# endif
#endif /* __VIR_NETWORK__DRIVER_H */
#include "virperf.h"
#include "virnuma.h"
#include "dirname.h"
-#include "network/bridge_driver.h"
#include "netdev_bandwidth_conf.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
sizeof(*newBandwidth->out));
}
- if (!networkBandwidthChangeAllowed(net, newBandwidth))
+ if (!virDomainNetBandwidthChangeAllowed(net, newBandwidth))
goto endjob;
if (virNetDevBandwidthSet(net->ifname, newBandwidth, false,
!virDomainNetTypeSharesHostView(net)) < 0 ||
- networkBandwidthUpdate(net, newBandwidth) < 0) {
+ virDomainNetBandwidthUpdate(net, newBandwidth) < 0) {
ignore_value(virNetDevBandwidthSet(net->ifname,
net->bandwidth,
false,