Fix AttributeError on port_bound for missing ports
If the port is concurrently deleted, db_get_val returns None, and
that causes the Exception to be raised. However, the exception is just
log noise if the port has been deleted concurrently and it does not
lead to failures.
This can happen if port_update and port_delete operations occur
in short sequence and interleave. To prevent this trace from
occurring, this patch checks that the port is being eliminated and
emits an error trace only if the port is indeed to be expected
amongst the list of ports to be updated.
We do not raise an exception to avoid disrupting the agent sync
process, and leave to the admin the investigation of the issue
(should that be cronic rather than transient).
Under normal circumstances, if the port is expected it should
be there, and if it isn't this should be treated as a bug to be
investigated further.
Sachi King [Mon, 28 Sep 2015 05:20:19 +0000 (15:20 +1000)]
Add -constraints sections for base CI jobs
Using factors with sections is not a thing and likely will not be for
a while, as such we are going to have to duplicate sections to be able
to set the constraints based install_command.
Liberty is behind us. The RFE process has been in place for a cycle
and some refinements have been necessary to make it more streamlined.
The cut-over section has outlived its purpose so it can be removed.
In its place, this patch clarifies how we are going to track RFE in
Launchpad, once the RFE has been 'approved'.
The tl;dr version of this patch is: from Mitaka onwards, feature
submission must happen via RFE bug report submission. Launchpad
blueprints are going to become a tool to be used at discretion of
the project release manager for milestone tracking purposes.
Sergey Belous [Tue, 13 Oct 2015 14:50:05 +0000 (17:50 +0300)]
Avoid DuplicateOptError in functional tests
Some test require to register options with oslo.Config,
but now some of them use global cfg.CONF for it.
This can cause the DuplicateOptError if two tests tried to
register the same option with different values of config.
We should use the oslo_config fixture [1]
in functional tests to avoid it.
Ihar Hrachyshka [Tue, 13 Oct 2015 12:46:02 +0000 (14:46 +0200)]
Make test_server work with older versions of oslo.service
Change I18a11283925369bc918002477774f196010a1bc3 fixed the test for
oslo.service >= 0.10.0, but it also broke it for older versions of
oslo.service. Since the library has minimal version of >= 0.7.0 in
requirements.txt, test should pass for those versions too.
Now, instead of validating that either reset() or restart() of workers
are triggered on SIGHUP, just validate that .start() is triggered the
expected number of times (either way, no matter how oslo.service decide
to clean up the children, they exit and then are respawned).
Fix inconsistency in DHCPv6 hosts and options generation
The DHCP agent is inconsistent in how it handles subnets whose
ipv6_address_mode is not slaac. While the DHCP agent writes out both
DHCPv6 host entries and DHCPv6 options for ports scoped by the subnet
for dnsmasq to use, subnet specific options are not written.
This patch addresses this inconsistency by generating subnet specific
options when the subnet's ipv6_address_mode is not slaac.
Assaf Muller [Mon, 12 Oct 2015 20:17:13 +0000 (16:17 -0400)]
Fix error returned when an HA router is updated to DVR
Before this patch, the code compares the 'ha' flag that
comes in from the user, and the current state of the 'distributed'
flag in the DB. This is wrong because if a router is currently
HA in the DB, and the update request contains only
{'distributed': True}, then the 'ha' flag from the request
is None and the error condition is never raised!
The reason the unit tests
(Specifically test_migrate_ha_router_to_distributed)
did not catch this issue is because
of another bug: The _update_router helper method in the L3 HA
unit tests had an 'ha' default value of True, when it should
have had a default value of None. Setting it to None fails
the unit test (Because it raises the wrong exception),
and the contents of the patch makes the unit test pass.
Assaf Muller [Mon, 12 Oct 2015 14:40:49 +0000 (10:40 -0400)]
Remove disable_service from DBs configuration
Remove disable_service from configure_for_func_testing.
A recent Devstack patch (Linked in bug report) checks
that a disabled service is not enabled later. This breaks
the code this patch touches. I believe the DBs were disabled
and enabled with the assumption that Devstack expects only
a single DB to be configured at a time, but that doesn't
seem to be the case. Simply removing the disable calls seems
to work fine.
Also exclude oslo.messaging==2.6.0 as per global-requirements.txt.
Kevin Benton [Thu, 8 Oct 2015 19:31:32 +0000 (12:31 -0700)]
Add OpenFixture and get rid of 'open' mocks
This patch adds a new fixture that allows a specific
file to be mocked for 'open' calls while leaving the
normal 'open' behavior for everything else. This is to
prevent cases like the related bug where a library we
depend on can unexpectedly call 'open' on its own
(in that case it was debtcollector->warnings->linecache).
It also replaces all open mocks in the unit tests with
this new fixture.
Moshe Levi [Thu, 8 Oct 2015 19:41:06 +0000 (22:41 +0300)]
QoS SR-IOV: allow to reset vf rate when VF is assigend to VM
delete_bandwidth_limit method is called in 2 scenarios:
1. when deleting a port
2. when removing a policy from a port
self.eswitch_mgr.clear_max_rate is valdating if VF is not assigned to VM
which is good for case 1, but prevent reseting the max rate for case 2.
for case 2 the delete_bandwidth_limit should call _set_vf_max_rate with max_kbps=0
to reset VF max rate for assigned VM.
Kevin Benton [Mon, 5 Oct 2015 14:57:54 +0000 (07:57 -0700)]
Only lock in set_members on mutating operations
ipset was locking on every set_members call with an external
filesystem lock. This was expensive when lots of ports that
were a part of the same security group were on the same agent.
This patch adjusts it to check if it needs to make a change before
acquiring the semaphore.
Kevin Benton [Mon, 5 Oct 2015 14:06:54 +0000 (07:06 -0700)]
Remove excessive fallback iptables ACCEPT rules
The previous code was generating a fallback ACCEPT rule for every
port when there should only be one at the very end. The reason that
this wasn't causing a bug is because we have a duplicate rule remover
that was silently throwing away the extras and it happened to get them
in the right order.
This will remove the need of import random in unit/objects/test_base.py
as its already done in tests/tools.py and some of the functions are
called from there.
Ihar Hrachyshka [Thu, 8 Oct 2015 12:56:30 +0000 (14:56 +0200)]
Cleaned up remaining incorrect usage for LOG.exception
- callers should not explicitly pass exceptions into LOG.exception
because it's already implicitly included in the message by stdlib
logging module.
- callers should not call to LOG.exception when there is no exception to
log about (known to fail in Python 3.x < 3.5).
Kevin Benton [Wed, 7 Oct 2015 03:16:15 +0000 (20:16 -0700)]
Fixed multiple py34 gate issues
1. Scope mock of 'open' to module
By mocking 'open' at the module level, we can avoid affecting
'open' calls from other modules.
2. Stop using LOG.exception in contexts with no sys.exc_info set
Python 3.4 logger fills in record.exc_info with sys.exc_info() result
[1], and then it uses it to determine the current exception [2] to
append to the log message. Since there is no exception, exc_info[1] is
None, and we get AttributeError inside traceback module.
It's actually a bug in Python interpreter that it attempt to access the
attribute when there is no exception. It turns out that it's fixed in
latest master of cPython [3] (the intent of the patch does not seem
relevant, but it removes the offending code while reshuffling the code).
Note that now cPython correctly checks the exception value before
accessing its attributes [4].
The patch in cPython that resulted in the failure is [5] and is present
since initial Python 3k releases.
Ihar Hrachyshka [Mon, 5 Oct 2015 15:46:33 +0000 (17:46 +0200)]
Removed neutronclient option from metadata agent
The new RPC interface has proved itself for two cycles, I don't
recollect any serious issues with it, so let's just clean up the
obsolete neutronclient based fallback mechanism.
The metadata agent configuration documentation should be updated
to not require API configuration values for the agent to talk to
neutron-server.
The Drivers team realized that with the current model, RFE
bugs were never off their radar even though RFE proposals were
approved and ready to be worked on. As a result it was becoming
tricky to handle the RFE backlog during the drivers meeting.
These changes are aimed at keeping the list of RFE bugs to a
manageable size, irrespective of how fast code gets submitted
and merged: the responsibilities of vetting feature proposals
and reviewing code are very much different, and this policy
changes try to reflect that.
Michael Smith [Fri, 5 Dec 2014 00:15:43 +0000 (16:15 -0800)]
L3 Agent support for routers with HA and DVR
The main difference for DVR HA routers is where
the VRRP/keepalived logic is run and which ports
fall in the HA domain for DVR. Instead of running
in the qrouter namespace, keepalived will run inside
the snat-namespace. Therefore only snat ports will
fall under the control of the HA domain.
Change-Id: If2962580397d39f72fd1fbbc1188a6958f00ff0c Co-Authored-By: Michael Smith <michael.smith6@hp.com> Co-Authored-By: Hardik Italia <hardik.italia@hp.com> Co-Authored-By: Adolfo Duarte <adolfo.duarte@hp.com> Co-Authored-By: John Schwarz <jschwarz@redhat.com>