~ubuntu-branches/ubuntu/vivid/neutron/vivid-proposed

« back to all changes in this revision

Viewing changes to neutron/db/l3_dvrscheduler_db.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Corey Byrant
  • Date: 2015-10-15 08:56:04 UTC
  • mfrom: (1.1.25)
  • Revision ID: package-import@ubuntu.com-20151015085604-zmf42dhshxz2qjad
Tags: 1:2015.1.2-0ubuntu1
[ Chuck Short ]
* Resynchronize with stable/kilo (7dbaa12) (LP: #1506058):
  - [7dbaa12] Changed filter field to router_id
  - [6c55f58] Do not log an error when deleting a linuxbridge does not exist
  - [118a76f] metadata: don't crash proxy on non-unicode user data
  - [eec8c50] Only get host data for floating ips on DVR routers
  - [9950ce2] Update dhcp host portbinding on failover
  - [1c87d72] func: Don't use private method of AsyncProcess
  - [834279c] Allow setting Agents description to None
  - [2f85b22] Process user iptables rules before INVALID
  - [f232475] Execute ipset command using check_exit_code
  - [d78899d] Don't write DHCP opts for SLAAC entries
  - [cb0554f] Check idl.run() return value before blocking
  - [2224851] Stop sending gratuitous arp when ip version is 6
  - [96276d5] Fix _ensure_default_security_group logic
  - [66a5116] Remove hack for sending gratuitous arp from fip ns
  - [2394418] populate port security default into network
  - [fc1c812] Remove early yields in _iter_hosts in dhcp agent
  - [2ead51a] Enable servicing lbaasV2 vip by DVR
  - [9498ea2] Descheduling DVR routers when ports are unbound from VM
  - [c74b05e] Bug-Fix for unexpected DHCP agent redundant
  - [e6a0e7d] Switch to dictionary for iptables find
  - [c377330] Add configurable options for HA networks
  - [114949b] Fix ipset can't be destroyed when last rule is deleted
  - [aba5e82] Updated NSXv plugin parameter descriptions
  - [d1a48f7] ovs: don't use ARP responder for IPv6 addresses
  - [4d15b6f] Configure gw_iface for RAs only in Master HA Router
  - [6975b2b] Register extraroute extension
  - [19d5ba4] Broadcast service port's arp in DVR
  - [767cea2] Stop device_owner from being set to 'network:*'
  - [2a6b34e] Fix a wrong condition for the _purge_metering_info function
  - [bf28c72] Add ARP spoofing protection for LinuxBridge agent
  - [635d5cf] Correct neutron-ns-metadata-proxy command when watch_log is
              False
  - [cc791b0] Fix usage of netaddr '.broadcast'
  - [f57a90a] Switch to using os-testr's copy of subunit2html
  - [c1201a2] Add optional file permission argument to replace_file()
  - [533900c] Adding loadbalanacerv2 device owner constant to neutron
              constants
  - [2a00016] Don't fatal error during initialization for missing service
              providers
  - [7c2727c] Update port bindings for master router
  - [6298a90] Setup reference service providers for API test runs
  - [6167d44] Move away nested transaction from _ensure_default_security_group
  - [c129bfa] Reject router-interface-add with a port which doesn't have any
              addresses
  - [770a105] SR-IOV: Fix SR-IOV agent to run ip link commands as root
  - [a0632d7] Catch ObjectDeletedError and skip port or subnet removal
  - [c4c8686] Cleanup stale metadata processes on l3 agent sync
  - [0c22d15] Bump stable/kilo next version to 2015.1.2
  - [4f9409d] lb-agent: ensure tap mtu is the same as physical device
  - [5d38dc5] Adds garp_master_repeat and garp_master_refresh to
              keepalived.conf
  - [e759c1c] Lower log level of errors caused by user requests to INFO
  - [1a1cc3d] Fix race condition by using lock on enable_radvd
  - [5827664] Remove bridge cleanup call
  - [23f5134] Added networking-plumgrid in plugin requirements

[ Corey Byrant ]
* d/rules: Prevent dh_python2 from guessing dependencies.

Show diffs side-by-side

added added

removed removed

Lines of Context:
160
160
                return True
161
161
        return False
162
162
 
163
 
    def dvr_deletens_if_no_port(self, context, port_id):
 
163
    def dvr_deletens_if_no_port(self, context, port_id, port_host=None):
164
164
        """Delete the DVR namespace if no dvr serviced port exists."""
165
165
        admin_context = context.elevated()
166
166
        router_ids = self.get_dvr_routers_by_portid(admin_context, port_id)
167
 
        port_host = ml2_db.get_port_binding_host(admin_context.session,
168
 
                                                 port_id)
 
167
        if not port_host:
 
168
            port_host = ml2_db.get_port_binding_host(admin_context.session,
 
169
                                                     port_id)
 
170
            if not port_host:
 
171
                LOG.debug('Host name not found for port %s', port_id)
 
172
                return []
 
173
 
169
174
        if not router_ids:
170
175
            LOG.debug('No namespaces available for this DVR port %(port)s '
171
176
                      'on host %(host)s', {'port': port_id,
359
364
            context, router['agent_id'], router['router_id'])
360
365
 
361
366
 
 
367
def _notify_l3_agent_port_update(resource, event, trigger, **kwargs):
 
368
    new_port = kwargs.get('port')
 
369
    original_port = kwargs.get('original_port')
 
370
 
 
371
    if new_port and original_port:
 
372
        original_device_owner = original_port.get('device_owner', '')
 
373
        if (original_device_owner.startswith('compute') and
 
374
            not new_port.get('device_owner')):
 
375
            l3plugin = manager.NeutronManager.get_service_plugins().get(
 
376
                service_constants.L3_ROUTER_NAT)
 
377
            context = kwargs['context']
 
378
            removed_routers = l3plugin.dvr_deletens_if_no_port(
 
379
                context,
 
380
                original_port['id'],
 
381
                port_host=original_port['binding:host_id'])
 
382
            if removed_routers:
 
383
                removed_router_args = {
 
384
                    'context': context,
 
385
                    'port': original_port,
 
386
                    'removed_routers': removed_routers,
 
387
                }
 
388
                _notify_port_delete(
 
389
                    event, resource, trigger, **removed_router_args)
 
390
            return
 
391
 
 
392
    _notify_l3_agent_new_port(resource, event, trigger, **kwargs)
 
393
 
 
394
 
362
395
def subscribe():
363
396
    registry.subscribe(
364
 
        _notify_l3_agent_new_port, resources.PORT, events.AFTER_UPDATE)
 
397
        _notify_l3_agent_port_update, resources.PORT, events.AFTER_UPDATE)
365
398
    registry.subscribe(
366
399
        _notify_l3_agent_new_port, resources.PORT, events.AFTER_CREATE)
367
400
    registry.subscribe(