File 0001-Do-not-call-update-device-list-in-large-sets.patch of Package openstack-neutron
diff -crB --new-file neutron-9.4.2.dev21-backup/neutron/agent/rpc.py neutron-9.4.2.dev21/neutron/agent/rpc.py
*** neutron-9.4.2.dev21-backup/neutron/agent/rpc.py 2019-09-18 15:42:55.984627466 -0700
--- neutron-9.4.2.dev21/neutron/agent/rpc.py 2019-09-18 15:45:14.004628908 -0700
***************
*** 176,185 ****
agent_id, host, agent_restarted=False):
try:
cctxt = self.client.prepare(version='1.5')
! res = cctxt.call(context, 'update_device_list',
! devices_up=devices_up, devices_down=devices_down,
! agent_id=agent_id, host=host,
! agent_restarted=agent_restarted)
except oslo_messaging.UnsupportedVersion:
#TODO(rossella_s): Remove this failback logic in M
dev_up = self._device_list_rpc_call_with_failed_dev(
--- 176,206 ----
agent_id, host, agent_restarted=False):
try:
cctxt = self.client.prepare(version='1.5')
! ret_devices_up = []
! failed_devices_up = []
! ret_devices_down = []
! failed_devices_down = []
!
! step = n_const.RPC_RES_PROCESSING_STEP
! devices_up = list(devices_up)
! devices_down = list(devices_down)
! for i in range(0, max(len(devices_up), len(devices_down)), step):
! # Divide-and-conquer RPC timeout
! ret = cctxt.call(context, 'update_device_list',
! devices_up=devices_up[i:i + step],
! devices_down=devices_down[i:i + step],
! agent_id=agent_id, host=host,
! agent_restarted=agent_restarted)
! ret_devices_up.extend(ret.get("devices_up", []))
! failed_devices_up.extend(ret.get("failed_devices_up", []))
! ret_devices_down.extend(ret.get("devices_down", []))
! failed_devices_down.extend(ret.get("failed_devices_down", []))
!
! res = {'devices_up': ret_devices_up,
! 'failed_devices_up': failed_devices_up,
! 'devices_down': ret_devices_down,
! 'failed_devices_down': failed_devices_down}
!
except oslo_messaging.UnsupportedVersion:
#TODO(rossella_s): Remove this failback logic in M
dev_up = self._device_list_rpc_call_with_failed_dev(
diff -crB --new-file neutron-9.4.2.dev21-backup/neutron/common/constants.py neutron-9.4.2.dev21/neutron/common/constants.py
*** neutron-9.4.2.dev21-backup/neutron/common/constants.py 2019-09-18 15:42:55.988627466 -0700
--- neutron-9.4.2.dev21/neutron/common/constants.py 2019-09-18 15:45:14.004628908 -0700
***************
*** 167,172 ****
--- 167,176 ----
# [1] http://paste.openstack.org/show/745685/
AGENT_RES_PROCESSING_STEP = 100
+ # Number of resources for neutron to divide the large RPC
+ # call data sets.
+ RPC_RES_PROCESSING_STEP = 20
+
# Neutron-lib migration shim. This will emit a deprecation warning on any
# reference to constants that have been moved out of this module and into
# the neutron_lib.constants module.
diff -crB --new-file neutron-9.4.2.dev21-backup/neutron/common/constants.py.orig neutron-9.4.2.dev21/neutron/common/constants.py.orig
*** neutron-9.4.2.dev21-backup/neutron/common/constants.py.orig 1969-12-31 16:00:00.000000000 -0800
--- neutron-9.4.2.dev21/neutron/common/constants.py.orig 2019-09-18 15:42:55.988627466 -0700
***************
*** 0 ****
--- 1,173 ----
+ # Copyright (c) 2012 OpenStack Foundation.
+ #
+ # 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_lib import constants as lib_constants
+
+ from neutron.common import _deprecate
+
+
+ ROUTER_PORT_OWNERS = lib_constants.ROUTER_INTERFACE_OWNERS_SNAT + \
+ (lib_constants.DEVICE_OWNER_ROUTER_GW,)
+
+ ROUTER_STATUS_ACTIVE = 'ACTIVE'
+ # NOTE(kevinbenton): a BUILD status for routers could be added in the future
+ # for agents to indicate when they are wiring up the ports. The following is
+ # to indicate when the server is busy building sub-components of a router
+ ROUTER_STATUS_ALLOCATING = 'ALLOCATING'
+
+ DEVICE_ID_RESERVED_DHCP_PORT = "reserved_dhcp_port"
+
+ HA_ROUTER_STATE_KEY = '_ha_state'
+ METERING_LABEL_KEY = '_metering_labels'
+ FLOATINGIP_AGENT_INTF_KEY = '_floatingip_agent_interfaces'
+ SNAT_ROUTER_INTF_KEY = '_snat_router_interfaces'
+
+ HA_NETWORK_NAME = 'HA network tenant %s'
+ HA_SUBNET_NAME = 'HA subnet tenant %s'
+ HA_PORT_NAME = 'HA port tenant %s'
+ MINIMUM_MINIMUM_AGENTS_FOR_HA = 1
+ DEFAULT_MINIMUM_AGENTS_FOR_HA = 2
+ HA_ROUTER_STATE_ACTIVE = 'active'
+ HA_ROUTER_STATE_STANDBY = 'standby'
+
+ PAGINATION_INFINITE = 'infinite'
+
+ SORT_DIRECTION_ASC = 'asc'
+ SORT_DIRECTION_DESC = 'desc'
+
+ ETHERTYPE_NAME_ARP = 'arp'
+ ETHERTYPE_ARP = 0x0806
+ ETHERTYPE_IP = 0x0800
+ ETHERTYPE_IPV6 = 0x86DD
+
+ IP_PROTOCOL_NAME_ALIASES = {lib_constants.PROTO_NAME_IPV6_ICMP_LEGACY:
+ lib_constants.PROTO_NAME_IPV6_ICMP}
+
+ VALID_DSCP_MARKS = [0, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34,
+ 36, 38, 40, 46, 48, 56]
+
+ IP_PROTOCOL_NUM_TO_NAME_MAP = {
+ str(v): k for k, v in lib_constants.IP_PROTOCOL_MAP.items()}
+
+ # Special provisional prefix for IPv6 Prefix Delegation
+ PROVISIONAL_IPV6_PD_PREFIX = '::/64'
+
+ # Timeout in seconds for getting an IPv6 LLA
+ LLA_TASK_TIMEOUT = 40
+
+ # length of all device prefixes (e.g. qvo, tap, qvb)
+ LINUX_DEV_PREFIX_LEN = 3
+ # must be shorter than linux IFNAMSIZ (which is 16)
+ LINUX_DEV_LEN = 14
+
+ # Possible prefixes to partial port IDs in interface names used by the OVS,
+ # Linux Bridge, and IVS VIF drivers in Nova and the neutron agents. See the
+ # 'get_ovs_interfaceid' method in Nova (nova/virt/libvirt/vif.py) for details.
+ INTERFACE_PREFIXES = (lib_constants.TAP_DEVICE_PREFIX,
+ lib_constants.VETH_DEVICE_PREFIX,
+ lib_constants.SNAT_INT_DEV_PREFIX)
+
+ ATTRIBUTES_TO_UPDATE = 'attributes_to_update'
+
+ # Maximum value integer can take in MySQL and PostgreSQL
+ # In SQLite integer can be stored in 1, 2, 3, 4, 6, or 8 bytes,
+ # but here it will be limited by this value for consistency.
+ DB_INTEGER_MAX_VALUE = 2 ** 31 - 1
+
+ # TODO(amuller): Re-define the RPC namespaces once Oslo messaging supports
+ # Targets with multiple namespaces. Neutron will then implement callbacks
+ # for its RPC clients in order to support rolling upgrades.
+
+ # RPC Interface for agents to call DHCP API implemented on the plugin side
+ RPC_NAMESPACE_DHCP_PLUGIN = None
+ # RPC interface for the metadata service to get info from the plugin side
+ RPC_NAMESPACE_METADATA = None
+ # RPC interface for agent to plugin security group API
+ RPC_NAMESPACE_SECGROUP = None
+ # RPC interface for agent to plugin DVR api
+ RPC_NAMESPACE_DVR = None
+ # RPC interface for reporting state back to the plugin
+ RPC_NAMESPACE_STATE = None
+ # RPC interface for agent to plugin resources API
+ RPC_NAMESPACE_RESOURCES = None
+
+ # Default network MTU value when not configured
+ DEFAULT_NETWORK_MTU = 1500
+ IPV6_MIN_MTU = 1280
+
+ ROUTER_MARK_MASK = "0xffff"
+
+ # Agent states as detected by server, used to reply on agent's state report
+ # agent has just been registered
+ AGENT_NEW = 'new'
+ # agent is alive
+ AGENT_ALIVE = 'alive'
+ # agent has just returned to alive after being dead
+ AGENT_REVIVED = 'revived'
+
+ INGRESS_DIRECTION = 'ingress'
+ EGRESS_DIRECTION = 'egress'
+
+ VALID_DIRECTIONS = (INGRESS_DIRECTION, EGRESS_DIRECTION)
+ VALID_ETHERTYPES = (lib_constants.IPv4, lib_constants.IPv6)
+
+ IP_ALLOWED_VERSIONS = [lib_constants.IP_VERSION_4, lib_constants.IP_VERSION_6]
+
+ PORT_RANGE_MIN = 1
+ PORT_RANGE_MAX = 65535
+
+ # Configuration values for accept_ra sysctl, copied from linux kernel
+ # networking (netdev) tree, file Documentation/networking/ip-sysctl.txt
+ #
+ # Possible values are:
+ # 0 Do not accept Router Advertisements.
+ # 1 Accept Router Advertisements if forwarding is disabled.
+ # 2 Overrule forwarding behaviour. Accept Router Advertisements
+ # even if forwarding is enabled.
+ ACCEPT_RA_DISABLED = 0
+ ACCEPT_RA_WITHOUT_FORWARDING = 1
+ ACCEPT_RA_WITH_FORWARDING = 2
+
+ # Some components communicate using private address ranges, define
+ # them all here. These address ranges should not cause any issues
+ # even if they overlap since they are used in disjoint namespaces,
+ # but for now they are unique.
+ # We define the metadata cidr since it falls in the range.
+ PRIVATE_CIDR_RANGE = '169.254.0.0/16'
+ DVR_FIP_LL_CIDR = '169.254.64.0/18'
+ L3_HA_NET_CIDR = '169.254.192.0/18'
+ METADATA_CIDR = '169.254.169.254/32'
+
+
+ # IPtables version to support --random-fully option.
+ # Do not move this constant to neutron-lib, since it is temporary
+ IPTABLES_RANDOM_FULLY_VERSION = '1.6.2'
+
+ # Number of resources for neutron agent side functions to deal
+ # with large sets.
+ # Setting this value does not count on special conditions, it is just a human
+ # countable or scalable number. [1] gives us the method to test the scale
+ # issue. And we have tested the value of 1000, 500, 200, 100. But for 100,
+ # ovs-agent will have a lower timeout probability. And according to the
+ # testing result, step size 100 can indeed cost about 10% much more time
+ # than 500/1000. But such extra time looks inevitably needed to be sacrificed
+ # for the restart success rate.
+ # [1] http://paste.openstack.org/show/745685/
+ AGENT_RES_PROCESSING_STEP = 100
+
+ # Neutron-lib migration shim. This will emit a deprecation warning on any
+ # reference to constants that have been moved out of this module and into
+ # the neutron_lib.constants module.
+ _deprecate._MovedGlobals(lib_constants)
diff -crB --new-file neutron-9.4.2.dev21-backup/neutron/tests/unit/plugins/ml2/test_rpc.py neutron-9.4.2.dev21/neutron/tests/unit/plugins/ml2/test_rpc.py
*** neutron-9.4.2.dev21-backup/neutron/tests/unit/plugins/ml2/test_rpc.py 2019-09-18 15:42:55.984627466 -0700
--- neutron-9.4.2.dev21/neutron/tests/unit/plugins/ml2/test_rpc.py 2019-09-18 15:45:14.004628908 -0700
***************
*** 315,323 ****
class RpcApiTestCase(base.BaseTestCase):
def _test_rpc_api(self, rpcapi, topic, method, rpc_method, **kwargs):
ctxt = oslo_context.RequestContext(user='fake_user',
tenant='fake_project')
! expected_retval = 'foo' if rpc_method == 'call' else None
expected_version = kwargs.pop('version', None)
fanout = kwargs.pop('fanout', False)
--- 315,331 ----
class RpcApiTestCase(base.BaseTestCase):
def _test_rpc_api(self, rpcapi, topic, method, rpc_method, **kwargs):
+ if method == "update_device_list":
+ expected = {'devices_up': [],
+ 'failed_devices_up': [],
+ 'devices_down': [],
+ 'failed_devices_down': []}
+ else:
+ expected = 'foo'
+
ctxt = oslo_context.RequestContext(user='fake_user',
tenant='fake_project')
! expected_retval = expected if rpc_method == 'call' else None
expected_version = kwargs.pop('version', None)
fanout = kwargs.pop('fanout', False)