Prevent possible server list damage in BigSwitch plugin

The old failover logic for the BigSwitch plugin modified a
list of controllers as it tested them. If the code for one
thread unexpectedly raised an exception or died, the global
server list could lose a server permanently.
This patch addresses that by flagging servers as failed instead
so the global server list is never modified.

Fixes: bug #1200022

(cherry picked from commit 3732f022778a7c4a47c58029ae77e32a0a4a6ee9)

Conflicts:

	quantum/plugins/bigswitch/plugin.py

Change-Id: Id2dcb820ef9f62fd03e3215bff3345e56c78afe2
Fix DHCP agent to work with latest dnsmasq

The latest dnsmasq no longer accepts hostnames which begin with a number. This
affects Fedora 19 right now, and will mean Fedora 19 will not work with Neutron
DHCP. dnsmasq should work with hostnames beginning with a number (RFC 1123 says
this is valid), but until this is fixed, many users will be left unable to use
Fedora 19 with Neutron.

This patch adds a "host-" prefix to each hostname entry generated by the DHCP
agent. This fixes the issue in Neutron.

Fixes bug 1204125

Change-Id: I0e29ec033969c3fb958ed3a12b8962b73b0e3d94
(cherry picked from commit acebf769a41a9a55cdc6789bf4962ea64cf87773)
Ensure that L3 managed port have status ACTIVE

Some plugins may set the port status as DOWN when it is created. This was not
updated when the port was actually up. This patch ensures that gateway and
router ports that are created will be set as ACTIVE when they are actually
up and running.

Ports that are attached to additional bridges in the OVS will only update the
port status as ACTIVE. There will be no tags set on the specific ports as this
will break the existing functionality.

Fixes bug 1192883

(cherry picked from commit d88ea97228ec8bb38f071c3969fdbb3abf6ab575)

Conflicts:

	quantum/tests/unit/openvswitch/test_ovs_quantum_agent.py
	quantum/agent/linux/ovs_lib.py
	quantum/plugins/openvswitch/agent/ovs_quantum_agent.py
	quantum/tests/unit/openvswitch/test_ovs_tunnel.py

Change-Id: I9993f56963ac704f0f345102d2e8b2d99dd9ad9e
do not raise exception on ip address recycle operation

Currenty a exception will raise on ip address recycle operation if the ip
address doesn't belong to any allocation pool which will make user unable
to update port, even worse it will make user unable to create new port.
So do not raise exception if the ip address to be recycled doesn't belong
to any allocation, just delete it from the ip allocation table.

fixes bug 1201692

Change-Id: Icfbded5158f1f4043f69bb1463fd4c830c9714a9
(cherry picked from commit d6cddd430c237c9496a97978070e6891d4625d00)
Allow gateway address to be unset for an existing subnet

Validation of the gateway IP address was taken place even
if the gateway IP was set to None; this was causing an
AddrFormatError exception to be raised by method
'_validate_gw_out_of_pools'. With this change we skip
the validation in case the gateway is set to None.

Fixes bug #1178273

Change-Id: Ib84378a4fd2cefdbbcacce695abbfaf82c647dd3
(cherry picked from commit 40a5853970cdd1555dfb5ebce81c6babf2e445da)
Merge "Fix DHCP agent to work with latest dnsmasq" into stable/grizzly
Merge "Allow gateway address to be unset for an existing subnet" into stable/grizzly
Fix Cisco Nexus plugin failures for vlan IDs 1006-4094

Fixes bug 1174593

VLAN IDs in the range 1006-4094 are considered to be in the extended
range by the Cisco Nexus 3K switch. As such, the 3K rejects any
state change configuration commands for VLANs in this range, including
"state active" and "no shutdown". The errors returned by the 3K for
these commands can be ignored, since the default states for these commands
are acceptable for the 3K.

For the 5K and 7K versions of the Nexus switch, on the other hand, the
"state active" and "no shutdown" commands are required for proper VLAN
configuration, regardless of VLAN ID.

This fix splits the configuration commands which are used to create a
VLAN on the Nexus switch into three separate configurations:
  - VLAN creation
  - state active
  - no shutdown
For the "state active" and "no shutdown" configurations, the Cisco Nexus
plugin will tolerate (ignore) errors involving invalid setting of state
for VLANs in the extended VLAN range. These specific errors can be
identified by looking for the appearance of certain signature strings
in the associated exception's message string, i.e. "Can't modify
state for extended" or "Command is allowed on VLAN".

This approach will yield a very small hit in performance, but the solution
is much less error prone than requiring customers to configure the
Cisco plugin for 3K vs. 5K vs. 7K, or perhaps even specific software
versions of the 3K, in order to inform the Cisco plugin whether
VLAN state configuration commands should be used or not.

Change-Id: I1be4966ddc6f462bca38428c4f904f8c982f318f
(cherry picked from commit fc914f66502ee066f41780e10b0e659334ffd060)
Merge "Ensure that L3 managed port have status ACTIVE" into stable/grizzly
Merge "Fix Cisco Nexus plugin failures for vlan IDs 1006-4094" into stable/grizzly
defer firewall updates to iptables data structures

One of two patches that fixes bug #1194438.

In the iptables firewall driver, each port method (update_port_filter,
prepare_port_filter, remove_port_filter) makes O(N) calls, where
N=len(firewall.ports), to IptablesManager methods that update dozens
of data structures. When the firewall methods are called in sequence,
e.g., by SecurityGroupAgentRpcMixin, the calls to IptablesManager's
methods start to add up.

This patch changes IptablesFirewallDriver to defer and coalesce calls
to IptablesManager. Now a sequence of M port method calls results in
O(N) calls to IptablesManager methods instead of O(N*M) as before.

Conflicts:
	quantum/agent/linux/iptables_firewall.py

Change-Id: If17eeaec197beae8b8aecffca1f19d4535a7226e
(cherry picked from commit e31c9fd3fed661e850fb149bf3005051e3a7c7f8)
Address config incompatibility introduced with oslo.config >= 1.2.0

This patch changes how nvp cluster specific configuration is retrieved
from nvp.ini so that it no longer relies on _cparser, which has been
removed in newer versions of oslo.config.

Fixes bug #1200609

Change-Id: I631c6584ca6b45d0f716533bd1d711d049c6f157
Bump stable/grizzly next version to 2013.1.4

Change-Id: I817767bcb618edf94363aa34dd0eb6ce897ce141
Merge "Address config incompatibility introduced with oslo.config >= 1.2.0" into stable/grizzly
Merge branch 'stable/grizzly' into mirantis/grizzly-rh