mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
conf: Move virDomainClearNetBandwidth() to src/hypervisor/
The reason virDomainClearNetBandwidth() exists in src/conf/ is that at the time its introduction we did not have a better place. But now we do. Firstly, virDomainClearNetBandwidth() is hypervisor agnostic code, but really has nothing to do with domain configuration (it doesn't parse/format XML). Secondly, in near future it'll call another function from src/hypervisor/ and that's not really allowed from src/conf/. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
@@ -199,20 +199,6 @@ virNetDevBandwidthFormat(const virNetDevBandwidth *def,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
virDomainClearNetBandwidth(virDomainDef *def)
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
virDomainNetType type;
|
|
||||||
|
|
||||||
for (i = 0; i < def->nnets; i++) {
|
|
||||||
type = virDomainNetGetActualType(def->nets[i]);
|
|
||||||
if (virDomainNetGetActualBandwidth(def->nets[i]) &&
|
|
||||||
virNetDevSupportsBandwidth(type))
|
|
||||||
virNetDevBandwidthClear(def->nets[i]->ifname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool virNetDevSupportsBandwidth(virDomainNetType type)
|
bool virNetDevSupportsBandwidth(virDomainNetType type)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,9 +34,6 @@ int virNetDevBandwidthFormat(const virNetDevBandwidth *def,
|
|||||||
unsigned int class_id,
|
unsigned int class_id,
|
||||||
virBuffer *buf);
|
virBuffer *buf);
|
||||||
|
|
||||||
void virDomainClearNetBandwidth(virDomainDef *def)
|
|
||||||
ATTRIBUTE_NONNULL(1);
|
|
||||||
|
|
||||||
bool virNetDevSupportsBandwidth(virDomainNetType type);
|
bool virNetDevSupportsBandwidth(virDomainNetType type);
|
||||||
bool virNetDevBandwidthHasFloor(const virNetDevBandwidth *b);
|
bool virNetDevBandwidthHasFloor(const virNetDevBandwidth *b);
|
||||||
bool virNetDevBandwidthSupportsFloor(virNetworkForwardType type);
|
bool virNetDevBandwidthSupportsFloor(virNetworkForwardType type);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include "domain_driver.h"
|
#include "domain_driver.h"
|
||||||
#include "domain_interface.h"
|
#include "domain_interface.h"
|
||||||
#include "domain_nwfilter.h"
|
#include "domain_nwfilter.h"
|
||||||
|
#include "netdev_bandwidth_conf.h"
|
||||||
#include "network_conf.h"
|
#include "network_conf.h"
|
||||||
#include "viralloc.h"
|
#include "viralloc.h"
|
||||||
#include "virconftypes.h"
|
#include "virconftypes.h"
|
||||||
@@ -469,3 +470,18 @@ virDomainInterfaceDeleteDevice(virDomainDef *def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
virDomainClearNetBandwidth(virDomainDef *def)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
virDomainNetType type;
|
||||||
|
|
||||||
|
for (i = 0; i < def->nnets; i++) {
|
||||||
|
type = virDomainNetGetActualType(def->nets[i]);
|
||||||
|
if (virDomainNetGetActualBandwidth(def->nets[i]) &&
|
||||||
|
virNetDevSupportsBandwidth(type))
|
||||||
|
virNetDevBandwidthClear(def->nets[i]->ifname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -44,3 +44,5 @@ void virDomainInterfaceDeleteDevice(virDomainDef *def,
|
|||||||
virDomainNetDef *net,
|
virDomainNetDef *net,
|
||||||
bool priv_net_created,
|
bool priv_net_created,
|
||||||
char *stateDir);
|
char *stateDir);
|
||||||
|
void virDomainClearNetBandwidth(virDomainDef *def)
|
||||||
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
|||||||
@@ -813,7 +813,6 @@ virDomainMomentDefPostParse;
|
|||||||
|
|
||||||
|
|
||||||
# conf/netdev_bandwidth_conf.h
|
# conf/netdev_bandwidth_conf.h
|
||||||
virDomainClearNetBandwidth;
|
|
||||||
virNetDevBandwidthFormat;
|
virNetDevBandwidthFormat;
|
||||||
virNetDevBandwidthHasFloor;
|
virNetDevBandwidthHasFloor;
|
||||||
virNetDevBandwidthParse;
|
virNetDevBandwidthParse;
|
||||||
@@ -1635,6 +1634,7 @@ virDomainDriverParseBlkioDeviceStr;
|
|||||||
virDomainDriverSetupPersistentDefBlkioParams;
|
virDomainDriverSetupPersistentDefBlkioParams;
|
||||||
|
|
||||||
# hypervisor/domain_interface.h
|
# hypervisor/domain_interface.h
|
||||||
|
virDomainClearNetBandwidth;
|
||||||
virDomainInterfaceDeleteDevice;
|
virDomainInterfaceDeleteDevice;
|
||||||
virDomainInterfaceEthernetConnect;
|
virDomainInterfaceEthernetConnect;
|
||||||
virDomainInterfaceIsVnetCompatModel;
|
virDomainInterfaceIsVnetCompatModel;
|
||||||
|
|||||||
Reference in New Issue
Block a user