Assaf Muller [Mon, 23 Feb 2015 22:07:30 +0000 (17:07 -0500)]
Change L3 agent AdvancedService class to be non-singleton
The idea behind the AdvancedServices (Metadata, *aaS) services
to be singletons was to (1) offer a way to get an instance of such
a service in a convinient manner, and to (2) ensure that only one
service registered per service type.
(1) Since the AdvancedService.instance method required an instance
of a L3 agent, this point was kind of missed. If you have a L3 agent
instance in your hand, just use it to access the service you're looking
for.
(2) This is now fulfilled by asserting that only one driver is registered
(per type) in the .add method.
The motivation to make them non-singletons is that:
a) They don't need to be
b) The code is simplified this way
c) I've been facing crazy issues during functional testing where we're
constantly instantiating L3 agents, and the (singleton) metadata
service was referencing the wrong configuration object. The service
was re-initialized during a test, screwing up the configuration of
other mid-run tests.
Oleg Bondarev [Fri, 20 Feb 2015 14:11:44 +0000 (17:11 +0300)]
Improve exception handling in _process_router_update()
in _process_router_update() where _process_router_if_compatible()
method is called only RouterNotCompatibleWithAgent exception is handled.
In case any other (intermittent) exception happens inside
_process_router_if_compatible() (e.g. MessagingTimeout on fetching
external net from server) it results in a situation where agent completely
forgets about the router and continues working as usual while server
shows router hosted by agent.
This patch adds handler for broader exception there and set
fullsync = True like it's done earlier in _process_router_update()
when getting routers from server.
Sam Betts [Wed, 4 Feb 2015 15:58:42 +0000 (15:58 +0000)]
Cisco Nexus ML2 Vendor decomposition
This adds a thin shim replacing the Cisco Nexus mech driver so that it
may use the code now stored in the networking-cisco stackforge. The code
for this driver that has been moved into the stackforge is also removed by
this patch.
Andrey Kurilin [Wed, 4 Feb 2015 13:10:57 +0000 (15:10 +0200)]
Remove versioning import of novaclient
novaclient has specific function novaclient.client.Client for obtaining
client object. This fuction should be used instead of direct import.
Also, contrib path dependends on version, so we should get it based on
versioned client.
Terry Wilson [Wed, 11 Feb 2015 06:53:57 +0000 (00:53 -0600)]
Remove remaining uses of passing root_helper
This should remove the last bits of passing root_helper around
for execute(). Some tests store and pass the root_helper argument
outside of this, and have been left alone.
Carl Baldwin [Thu, 19 Feb 2015 16:35:01 +0000 (16:35 +0000)]
Mock link local allocator write so UT doesn't write a file
The UTs recently started writing a fip-linklocal-networks file in
test_l3_agent. This is due to a recently added test. This patch adds
a mock to it so that the file is not written.
Miguel Angel Ajo [Tue, 17 Feb 2015 12:28:46 +0000 (12:28 +0000)]
Remove error logs for a common situation (non created ipsets)
The log message was initially added by me as part of a
iptables_firewall refactor.
Ipsets for empty IP address lists aren't currently created,
that means that we can't reference empty security groups
(as ipsets) via iptable rules, and that's a normal condition,
not an error.
Unify logic that determines liveliness of DHCP agent
For DHCP agents sometimes it's not enough to check agent's last heartbeat
time because in its starting period the agent may fail to send state reports
because it's busy processing networks.
In rescheduling logic such DHCP agent is given additional time after start.
Additional time is proportional to amount of networks the agent is hosting.
Need to apply the same logic to DHCP agent scheduler to avoid a case
when starting agent is considered dead and a network gets more hosting
agents than configured.
rajeev [Fri, 13 Feb 2015 21:58:53 +0000 (16:58 -0500)]
fix for _get_external_device_interface_name trace
On removal of external gateway from DVR the code path
external_gateway_removed(...) was trying to access the
agent gateway port interface even when no fip namespace exists.
This change checks for existence of namespace before
accessing the agent gateway port interface through
_get_external_device_interface_name(...) or looking for
floating ips that may have been configured on the
port.
This patch is dependent on the plugin side patch
Change-Id: Ieaa79c8bf2b1e03bc352f9252ce22286703e3715
for retrieving the fip agent port from the
router_update message.
Kobi Samoray [Wed, 18 Feb 2015 17:25:27 +0000 (19:25 +0200)]
VMWare NSXv: id fields should be nullable
To handle concurrency issues when two neutron nodes initialize at the same
time, we use the following solution:
- Each neutron node attempts to create a record with id value=NULL
- One which inserts successfully, resumes to create the resource and once
the resource is created, it updates its id in the database
- One which fails with duplicate entry exception, busy-waits until the id
field is populated, of terminates on timeout.
Relevant resources are internal edges, and internal networks.
To implement the above, id fields should be nullable.
Brian Haley [Fri, 30 Jan 2015 18:22:17 +0000 (13:22 -0500)]
Check if routing rule exists before adding
Since there is no equivalent to 'ip route replace...' with
'ip rule...', we need to check the existence first before
adding, as otherwise we'll end up with multiple identical
routing rules.
Ihar Hrachyshka [Wed, 18 Feb 2015 10:42:43 +0000 (11:42 +0100)]
Monkey patch all the code inside neutron/cmd/eventlet/...
The directory is initially empty.
We are going to maintain entry points for all services and agents that
run in eventlet mode in this directory, and monkey patch them from
there, instead of spreading monkey_patch() calls throughout the library.
This will guarantee us that all the services that are maintained in this
part of the tree monkey patch stdlib properly, before doing any other
imports.
This is also useful to track which parts of the project require
eventlet. This will later help to migrate services one by one out of
eventlet to real threads in case we decide to move this direction.
Ihar Hrachyshka [Thu, 5 Feb 2015 13:21:38 +0000 (14:21 +0100)]
tests: monkey patch stdlib before importing other modules
Some oslo libraries assume that stdlib is already patched when they are
imported (f.e. oslo.concurrency.processutils currently checks whether
time module is monkey patched on import to detect which subprocess
module should be used).
For services, we achieve this by moving monkey_patch() calls as high in
import list as possible. But for tests, we don't control the order in
which testr loads test cases. So to be on safe side, we should make sure
any attempt to load a test case from the tree results in eventlet patch.
We can't put the monkey_patch() call into e.g. neutron/__init__.py to
reuse it both for tests and for services, because in that case we may
break flake8 that loads hacking checks from neutron.* namespace and
relies on proper (unpatched) subprocess module.
Ihar Hrachyshka [Thu, 12 Feb 2015 12:51:21 +0000 (13:51 +0100)]
Don't monkey patch netns_cleanup
There is no reason to monkey patch the tool (it does not rely on any
special kind of model of concurrency). It's better to avoid eventlet
wherever possible, and there are discussions on whether we want to start
dropping eventlet usage agent by agent, so it's worth keeping as much of
code out of monkey business.
YAMAMOTO Takashi [Tue, 17 Feb 2015 05:11:11 +0000 (14:11 +0900)]
OVS UT: Fix some confusions between local vlan id and segmentation id
Also, use different values for them to expose mistakes.
Details:
There are two kinds of vlan ids involved here:
* local vlan id, which is managed by each agents in a node-local manner.
* segmentation id, which is managed by the corresponding ML2 type driver.
These tests use the distinct variables for them.
(LV_ID and LS_ID respectively)
However, these variables are misused in some places, relying on the fact
that their values are same. (42)