add agent ini file
This commit is contained in:
parent
8235239a82
commit
5e8d0cae6c
|
@ -3,5 +3,7 @@
|
|||
# debug = False
|
||||
|
||||
[WANQOS]
|
||||
lan_port = 'enp0s1f0'
|
||||
wan_port = 'enp0s1f1'
|
||||
lan_port_name = 'enp1s0f0'
|
||||
lan_max_rate = '100mbit'
|
||||
wan_port_name = 'enp1s0f1'
|
||||
wan_max_rate = '100mbit'
|
||||
|
|
|
@ -25,12 +25,18 @@ from neutron import service as neutron_service
|
|||
from wan_qos.common import topics
|
||||
|
||||
WANQOS_OPTS = [
|
||||
cfg.StrOpt('lan_port',
|
||||
cfg.StrOpt('lan_port_name',
|
||||
default='eth0',
|
||||
help="The name of the port facing teh LAN"),
|
||||
cfg.StrOpt('wan_port',
|
||||
help="The name of the port facing the LAN"),
|
||||
cfg.StrOpt('lan_max_rate',
|
||||
default='10mbit',
|
||||
help="The maximum rate of the LAN port"),
|
||||
cfg.StrOpt('wan_port_name',
|
||||
default='eth1',
|
||||
help="The name of the port facing the WAN")
|
||||
help="The name of the port facing the WAN"),
|
||||
cfg.StrOpt('wan_max_rate',
|
||||
default='10mbit',
|
||||
help="The maximum rate of the WAN port")
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from subprocess import call
|
||||
from subprocess import check_call
|
||||
|
||||
from oslo_config import cfg
|
||||
|
@ -33,7 +34,7 @@ class TcDriver(agent_api.AgentInterface):
|
|||
|
||||
def clear_all(self):
|
||||
for port in self.ports.values():
|
||||
check_call('sudo tc qdisc del dev %s root' % port, shell=True)
|
||||
call('sudo tc qdisc del dev %s root' % port, shell=True)
|
||||
|
||||
def set_root_queue(self, tc_dict):
|
||||
check_call('sudo tc qdisc add dev %s handle 1: root htb' %
|
||||
|
|
|
@ -25,16 +25,26 @@ class TcAgentManager:
|
|||
def __init__(self, host, conf=None):
|
||||
self.agent = tc_driver.TcDriver()
|
||||
if not conf:
|
||||
conf = cfg.CONF
|
||||
lan_port = conf.WANQOS.lan_port
|
||||
wan_port = conf.WANQOS.wan_port
|
||||
self.conf = cfg.CONF
|
||||
else:
|
||||
self.conf = conf
|
||||
lan_port = self.conf.WANQOS.lan_port_name
|
||||
wan_port = self.conf.WANQOS.wan_port_name
|
||||
self.agent.set_ports(lan_port, wan_port)
|
||||
|
||||
def init_host(self):
|
||||
"""Handle initialization if this is a standalone service.
|
||||
self.agent.clear_all()
|
||||
tc_dict = {
|
||||
'port_side': 'lan_port',
|
||||
'max_rate': self.conf.WANQOS.lan_max_rate
|
||||
}
|
||||
self.agent.set_root_queue(tc_dict)
|
||||
tc_dict = {
|
||||
'port_side': 'wan_port',
|
||||
'max_rate': self.conf.WANQOS.wan_max_rate
|
||||
}
|
||||
self.agent.set_root_queue(tc_dict)
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
def after_start(self):
|
||||
LOG.info("WAN QoS agent started")
|
||||
|
|
Loading…
Reference in New Issue