diff --git a/doc/source/devref/rpc_callbacks.rst b/doc/source/devref/rpc_callbacks.rst index 514c8224594..1b1111eefa2 100644 --- a/doc/source/devref/rpc_callbacks.rst +++ b/doc/source/devref/rpc_callbacks.rst @@ -86,8 +86,8 @@ upgrade the server first and then upgrade the agents: :doc:`More information about the upgrade strategy `. -The plan is to provide a semi-automatic method which avoids manual pinning and -unpinning of versions by the administrator which could be prone to error. +We provide an automatic method which avoids manual pinning and unpinning +of versions by the administrator which could be prone to error. Resource pull requests ~~~~~~~~~~~~~~~~~~~~~~ @@ -120,33 +120,35 @@ want the queues cleaned up. Leveraging agent state reports for object version discovery +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -We would add a row to the agent db for tracking agent known objects and version -numbers. This would resemble the implementation of the configuration column. +We add a row to the agent db for tracking agent known objects and version +numbers. This resembles the implementation of the configuration column. -Agents would report at start not only their configuration now, but also -their subscribed object type / version pairs, that would be stored in the -database and would be available to any neutron-server requesting it:: +Agents report at start not only their configuration now, but also +their subscribed object type / version pairs, that are stored in the +database and made available to any neutron-server requesting it:: - 'subscribed_versions': {'QoSPolicy': '1.1', - 'SecurityGroup': '1.0', - 'Port': '1.0'} + 'resource_versions': {'QosPolicy': '1.1', + 'SecurityGroup': '1.0', + 'Port': '1.0'} -There's a subset of Liberty agents depending on QoSPolicy that will -require 'QoSPolicy': '1.0' if the qos plugin is installed. We will be able -to identify those by the binary name (included in the report): +There was a subset of Liberty agents depending on QosPolicy that required +'QosPolicy': '1.0' if the qos plugin is installed. We were able to identify +those by the binary name (included in the report): * 'neutron-openvswitch-agent' * 'neutron-sriov-nic-agent' +This transition was handled in the Mitaka version, but it's not handled +anymore in Newton, since only one major version step upgrades are supported. + Version discovery +++++++++++++++++ With the above mechanism in place and considering the exception of neutron-openvswitch-agent and neutron-sriov-agent requiring QoSpolicy 1.0, -we could discover the subset of versions to be sent on every push -notification. +we discover the subset of versions to be sent on every push notification. -Agents that are in down state would be excluded from this calculation. -We would use an extended timeout for agents in this calculation to make sure +Agents that are in down state are excluded from this calculation. +We use an extended timeout for agents in this calculation to make sure we're on the safe side, specially if deployer marked agents with low timeouts. @@ -165,16 +167,16 @@ The AgentDbMixin provides:: Caching mechanism ''''''''''''''''' -The version subset per object will be cached to avoid DB requests on every push +The version subset per object is cached to avoid DB requests on every push given that we assume that all old agents are already registered at the time of upgrade. -Cached subset will be re-evaluated (to cut down the version sets as agents -upgrade) after configured TTL. +Cached subset is re-evaluated (to cut down the version sets as agents +upgrade) after neutron.api.rpc.callbacks.version_manager.VERSIONS_TTL. As a fast path to update this cache on all neutron-servers when upgraded agents come up (or old agents revive after a long timeout or even a downgrade) the -server registering the new status update will notify the other servers about +server registering the new status update notifies the other servers about the new consumer resource versions via cast. All notifications for all calculated version sets must be sent, as non-upgraded diff --git a/neutron/api/rpc/callbacks/version_manager.py b/neutron/api/rpc/callbacks/version_manager.py index 2e0ffcc7743..ffd005bcec9 100644 --- a/neutron/api/rpc/callbacks/version_manager.py +++ b/neutron/api/rpc/callbacks/version_manager.py @@ -15,7 +15,6 @@ import copy import pprint import time -from neutron_lib import constants from oslo_log import log as logging from oslo_utils import importutils @@ -26,14 +25,6 @@ LOG = logging.getLogger(__name__) VERSIONS_TTL = 60 -# This is the list of agents that started using this rpc push/pull mechanism -# for versioned objects, but at that time stable/liberty, they were not -# reporting versions, so we need to assume they need QosPolicy 1.0 -#TODO(mangelajo): Remove this logic in Newton, since those agents will be -# already reporting From N to O -NON_REPORTING_AGENT_TYPES = [constants.AGENT_TYPE_OVS, - constants.AGENT_TYPE_NIC_SWITCH] - # NOTE(mangelajo): if we import this globally we end up with a (very # long) circular dependency, this can be fixed if we @@ -157,14 +148,6 @@ class ResourceConsumerTracker(object): def _handle_no_set_versions(self, consumer): """Handle consumers reporting no versions.""" - if isinstance(consumer, AgentConsumer): - if consumer.agent_type in NON_REPORTING_AGENT_TYPES: - resources = _import_resources() - self._versions_by_consumer[consumer] = { - resources.QOS_POLICY: '1.0'} - self._versions[resources.QOS_POLICY].add('1.0') - return - if self._versions_by_consumer[consumer]: self._needs_recalculation = True self._versions_by_consumer[consumer] = {} diff --git a/neutron/tests/unit/api/rpc/callbacks/test_version_manager.py b/neutron/tests/unit/api/rpc/callbacks/test_version_manager.py index 6400cbe7133..9e9bf0e63c3 100644 --- a/neutron/tests/unit/api/rpc/callbacks/test_version_manager.py +++ b/neutron/tests/unit/api/rpc/callbacks/test_version_manager.py @@ -10,7 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -import collections import mock from neutron.api.rpc.callbacks import exceptions @@ -85,26 +84,6 @@ class ResourceConsumerTrackerTest(base.BaseTestCase): self.assertEqual(set(), cv.get_resource_versions(resource_type)) - def test_compatibility_liberty_sriov_and_ovs_agents(self): - - def _fake_local_versions(self): - local_versions = collections.defaultdict(set) - local_versions[resources.QOS_POLICY].add('1.11') - return local_versions - - for agent_type in version_manager.NON_REPORTING_AGENT_TYPES: - consumer_id = version_manager.AgentConsumer(agent_type, - AGENT_HOST_1) - - cv = version_manager.ResourceConsumerTracker() - cv._get_local_resource_versions = _fake_local_versions - cv._versions = _fake_local_versions(mock.ANY) - - cv.set_versions(consumer_id, {}) - - self.assertEqual(set(['1.0', '1.11']), - cv.get_resource_versions(resources.QOS_POLICY)) - def test_different_adds_triggers_recalculation(self): cv = version_manager.ResourceConsumerTracker()