Refactors QosAgentDriver
QosAgentDriver has a method which uses linux specific module, which is trying to import pyroute2. Module pyroute2 tries to import a module from socket which does not exists on windows (socket.inet_pton[1]). This can cause neutron services to fail to start on windows[2]. [1]: https://docs.python.org/2/library/socket.html#socket.inet_pton [2]: http://paste.openstack.org/show/593272/ Change-Id: I706368bfcaece380e1357e0c504fd3b9553ba49c Related-Bug: #1492714
This commit is contained in:
parent
d0a2c1650a
commit
7fc79f43dc
|
@ -23,7 +23,6 @@ import six
|
|||
|
||||
from neutron._i18n import _LW, _LI
|
||||
from neutron.agent.l2 import l2_agent_extension
|
||||
from neutron.agent.linux import tc_lib
|
||||
from neutron.api.rpc.callbacks.consumer import registry
|
||||
from neutron.api.rpc.callbacks import events
|
||||
from neutron.api.rpc.callbacks import resources
|
||||
|
@ -122,15 +121,6 @@ class QosAgentDriver(object):
|
|||
LOG.debug("Port %(port)s excluded from QoS rule %(rule)s",
|
||||
{'port': port, 'rule': rule.id})
|
||||
|
||||
def _get_egress_burst_value(self, rule):
|
||||
"""Return burst value used for egress bandwidth limitation.
|
||||
|
||||
Because Egress bw_limit is done on ingress qdisc by LB and ovs drivers
|
||||
so it will return burst_value used by tc on as ingress_qdisc.
|
||||
"""
|
||||
return tc_lib.TcCommand.get_ingress_qdisc_burst_value(
|
||||
rule.max_kbps, rule.max_burst_kbps)
|
||||
|
||||
|
||||
class PortPolicyMap(object):
|
||||
def __init__(self):
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
# Copyright (c) 2017 Cloudbase Solutions
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.agent.l2.extensions import qos
|
||||
from neutron.agent.linux import tc_lib
|
||||
|
||||
|
||||
class QosLinuxAgentDriver(qos.QosAgentDriver):
|
||||
|
||||
def _get_egress_burst_value(self, rule):
|
||||
"""Return burst value used for egress bandwidth limitation.
|
||||
|
||||
Because Egress bw_limit is done on ingress qdisc by LB and ovs drivers
|
||||
so it will return burst_value used by tc on as ingress_qdisc.
|
||||
"""
|
||||
return tc_lib.TcCommand.get_ingress_qdisc_burst_value(
|
||||
rule.max_kbps, rule.max_burst_kbps)
|
|
@ -17,7 +17,7 @@ from oslo_log import helpers as log_helpers
|
|||
from oslo_log import log
|
||||
|
||||
from neutron._i18n import _LI
|
||||
from neutron.agent.l2.extensions import qos
|
||||
from neutron.agent.l2.extensions import qos_linux as qos
|
||||
from neutron.agent.linux import iptables_manager
|
||||
from neutron.agent.linux import tc_lib
|
||||
import neutron.common.constants as const
|
||||
|
@ -27,7 +27,7 @@ from neutron.plugins.ml2.drivers.linuxbridge.mech_driver import (
|
|||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
class QosLinuxbridgeAgentDriver(qos.QosAgentDriver):
|
||||
class QosLinuxbridgeAgentDriver(qos.QosLinuxAgentDriver):
|
||||
|
||||
SUPPORTED_RULES = (
|
||||
mech_linuxbridge.LinuxbridgeMechanismDriver.supported_qos_rule_types
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
from oslo_log import log as logging
|
||||
|
||||
from neutron._i18n import _LE, _LI
|
||||
from neutron.agent.l2.extensions import qos
|
||||
from neutron.agent.l2.extensions import qos_linux as qos
|
||||
from neutron.plugins.ml2.drivers.mech_sriov.agent.common import (
|
||||
exceptions as exc)
|
||||
from neutron.plugins.ml2.drivers.mech_sriov.agent import eswitch_manager as esm
|
||||
|
@ -25,7 +25,7 @@ from neutron.plugins.ml2.drivers.mech_sriov.mech_driver import (
|
|||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class QosSRIOVAgentDriver(qos.QosAgentDriver):
|
||||
class QosSRIOVAgentDriver(qos.QosLinuxAgentDriver):
|
||||
|
||||
SUPPORTED_RULES = (
|
||||
mech_driver.SriovNicSwitchMechanismDriver.supported_qos_rule_types)
|
||||
|
|
|
@ -17,7 +17,7 @@ import collections
|
|||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron.agent.l2.extensions import qos
|
||||
from neutron.agent.l2.extensions import qos_linux as qos
|
||||
from neutron.plugins.ml2.drivers.openvswitch.mech_driver import (
|
||||
mech_openvswitch)
|
||||
from neutron.services.qos import qos_consts
|
||||
|
@ -26,7 +26,7 @@ from neutron.services.qos import qos_consts
|
|||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class QosOVSAgentDriver(qos.QosAgentDriver):
|
||||
class QosOVSAgentDriver(qos.QosLinuxAgentDriver):
|
||||
|
||||
SUPPORTED_RULES = (
|
||||
mech_openvswitch.OpenvswitchMechanismDriver.supported_qos_rule_types)
|
||||
|
|
|
@ -18,6 +18,7 @@ from neutron_lib import exceptions
|
|||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron.agent.l2.extensions import qos
|
||||
from neutron.agent.l2.extensions import qos_linux
|
||||
from neutron.api.rpc.callbacks.consumer import registry
|
||||
from neutron.api.rpc.callbacks import events
|
||||
from neutron.api.rpc.callbacks import resources
|
||||
|
@ -55,7 +56,7 @@ FAKE_RULE_ID = uuidutils.generate_uuid()
|
|||
REALLY_FAKE_RULE_ID = uuidutils.generate_uuid()
|
||||
|
||||
|
||||
class FakeDriver(qos.QosAgentDriver):
|
||||
class FakeDriver(qos_linux.QosLinuxAgentDriver):
|
||||
|
||||
SUPPORTED_RULES = {qos_consts.RULE_TYPE_BANDWIDTH_LIMIT}
|
||||
|
||||
|
@ -152,7 +153,7 @@ class QosExtensionBaseTestCase(base.BaseTestCase):
|
|||
# Don't rely on used driver
|
||||
mock.patch(
|
||||
'neutron.manager.NeutronManager.load_class_for_provider',
|
||||
return_value=lambda: mock.Mock(spec=qos.QosAgentDriver)
|
||||
return_value=lambda: mock.Mock(spec=qos_linux.QosLinuxAgentDriver)
|
||||
).start()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue