mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-10-22 12:29:49 +00:00
rate-limiter: add getRateLimiter/setRateLimiter in endpoint
We use tc-based or built-in rate limiter to shape network I/O traffic and they all must be tied to one specific interface/endpoint. In order to tell whether we've ever added rate limiter to this interface/endpoint, we create get/set func to reveal/store such info. Fixes: #250 Signed-off-by: Penny Zheng <penny.zheng@arm.com>
This commit is contained in:
@@ -18,6 +18,8 @@ type IPVlanEndpoint struct {
|
||||
EndpointProperties NetworkInfo
|
||||
EndpointType EndpointType
|
||||
PCIAddr string
|
||||
RxRateLimiter bool
|
||||
TxRateLimiter bool
|
||||
}
|
||||
|
||||
func createIPVlanNetworkEndpoint(idx int, ifName string) (*IPVlanEndpoint, error) {
|
||||
@@ -139,3 +141,21 @@ func (endpoint *IPVlanEndpoint) load(s persistapi.NetworkEndpoint) {
|
||||
endpoint.NetPair = *netpair
|
||||
}
|
||||
}
|
||||
|
||||
func (endpoint *IPVlanEndpoint) GetRxRateLimiter() bool {
|
||||
return endpoint.RxRateLimiter
|
||||
}
|
||||
|
||||
func (endpoint *IPVlanEndpoint) SetRxRateLimiter() error {
|
||||
endpoint.RxRateLimiter = true
|
||||
return nil
|
||||
}
|
||||
|
||||
func (endpoint *IPVlanEndpoint) GetTxRateLimiter() bool {
|
||||
return endpoint.TxRateLimiter
|
||||
}
|
||||
|
||||
func (endpoint *IPVlanEndpoint) SetTxRateLimiter() error {
|
||||
endpoint.TxRateLimiter = true
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user