]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove unused metaplugin agents
authorNachi Ueno <nachi@nttmcl.com>
Tue, 30 Oct 2012 22:30:21 +0000 (22:30 +0000)
committerNachi Ueno <nachi@nttmcl.com>
Tue, 30 Oct 2012 22:30:21 +0000 (22:30 +0000)
Fixes bug 1038840

Change-Id: I891247ebd4e58b950c9254d267a06aadc4602d18

quantum/plugins/metaplugin/agent/linuxbridge_quantum_agent.py [deleted file]
quantum/plugins/metaplugin/agent/ovs_quantum_agent.py [deleted file]

diff --git a/quantum/plugins/metaplugin/agent/linuxbridge_quantum_agent.py b/quantum/plugins/metaplugin/agent/linuxbridge_quantum_agent.py
deleted file mode 100755 (executable)
index 646702a..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-#!/usr/bin/env python
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-#
-# Copyright 2012 Cisco Systems, Inc.
-# Copyright 2012 NTT MCL, Inc.
-# All Rights Reserved.
-#
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
-#    not use this file except in compliance with the License. You may obtain
-#    a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-#    License for the specific language governing permissions and limitations
-#    under the License.
-#
-#
-# Performs per host Linux Bridge configuration for Quantum.
-# Based on the structure of the OpenVSwitch agent in the
-# Quantum OpenVSwitch Plugin.
-# @author: Sumit Naiksatam, Cisco Systems, Inc.
-
-import logging
-import sys
-import time
-
-from sqlalchemy.ext.sqlsoup import SqlSoup
-
-from quantum.openstack.common import cfg
-from quantum.common import config as logging_config
-from quantum.common import constants
-from quantum.plugins.linuxbridge.common import config
-import quantum.plugins.linuxbridge.agent.linuxbridge_quantum_agent as lb
-
-from quantum.agent.linux import utils
-
-logging.basicConfig()
-LOG = logging.getLogger(__name__)
-
-BRIDGE_NAME_PREFIX = "brq"
-VLAN_BINDINGS = "vlan_bindings"
-PORT_BINDINGS = "port_bindings"
-
-
-class MetaLinuxBridgeQuantumAgent(lb.LinuxBridgeQuantumAgent):
-
-    def manage_networks_on_host(self, db,
-                                old_vlan_bindings,
-                                old_port_bindings):
-        vlan_bindings = {}
-        try:
-            flavor_key = db.flavors.network_id
-            vlan_key = db.vlan_bindings.network_id
-            query = db.session.query(db.vlan_bindings)
-            joined = query.join((db.flavors,
-                                 flavor_key == vlan_key))
-            where = db.flavors.flavor == 'linuxbridge'
-            vlan_binds = joined.filter(where).all()
-        except Exception as e:
-            LOG.info("Unable to get vlan bindings! Exception: %s" % e)
-            self.db_connected = False
-            return {VLAN_BINDINGS: {},
-                    PORT_BINDINGS: []}
-
-        vlans_string = ""
-        for bind in vlan_binds:
-            entry = {'network_id': bind.network_id, 'vlan_id': bind.vlan_id}
-            vlan_bindings[bind.network_id] = entry
-            vlans_string = "%s %s" % (vlans_string, entry)
-
-        port_bindings = []
-        try:
-            flavor_key = db.flavors.network_id
-            port_key = db.ports.network_id
-            query = db.session.query(db.ports)
-            joined = query.join((db.flavors,
-                                 flavor_key == port_key))
-            where = db.flavors.flavor == 'linuxbridge'
-            port_binds = joined.filter(where).all()
-        except Exception as e:
-            LOG.info("Unable to get port bindings! Exception: %s" % e)
-            self.db_connected = False
-            return {VLAN_BINDINGS: {},
-                    PORT_BINDINGS: []}
-
-        all_bindings = {}
-        for bind in port_binds:
-            append_entry = False
-            if self.target_v2_api:
-                all_bindings[bind.id] = bind
-                entry = {'network_id': bind.network_id,
-                         'uuid': bind.id,
-                         'status': bind.status,
-                         'interface_id': bind.id}
-                append_entry = bind.admin_state_up
-            else:
-                all_bindings[bind.uuid] = bind
-                entry = {'network_id': bind.network_id, 'state': bind.state,
-                         'op_status': bind.op_status, 'uuid': bind.uuid,
-                         'interface_id': bind.interface_id}
-                append_entry = bind.state == constants.PORT_STATUS_ACTIVE
-            if append_entry:
-                port_bindings.append(entry)
-
-        plugged_interfaces = []
-        ports_string = ""
-        for pb in port_bindings:
-            ports_string = "%s %s" % (ports_string, pb)
-            port_id = pb['uuid']
-            interface_id = pb['interface_id']
-
-            vlan_id = str(vlan_bindings[pb['network_id']]['vlan_id'])
-            if self.process_port_binding(port_id,
-                                         pb['network_id'],
-                                         interface_id,
-                                         vlan_id):
-                if self.target_v2_api:
-                    all_bindings[port_id].status = constants.PORT_STATUS_ACTIVE
-                else:
-                    all_bindings[port_id].op_status = (
-                        constants.PORT_STATUS_ACTIVE)
-
-            plugged_interfaces.append(interface_id)
-
-        if old_port_bindings != port_bindings:
-            LOG.debug("Port-bindings: %s" % ports_string)
-
-        self.process_unplugged_interfaces(plugged_interfaces)
-
-        if old_vlan_bindings != vlan_bindings:
-            LOG.debug("VLAN-bindings: %s" % vlans_string)
-
-        self.process_deleted_networks(vlan_bindings)
-
-        try:
-            db.commit()
-        except Exception as e:
-            LOG.info("Unable to update database! Exception: %s" % e)
-            db.rollback()
-            vlan_bindings = {}
-            port_bindings = []
-
-        return {VLAN_BINDINGS: vlan_bindings,
-                PORT_BINDINGS: port_bindings}
-
-
-def main():
-    cfg.CONF(args=sys.argv, project='quantum')
-
-    # (TODO)  - swap with common logging
-    logging_config.setup_logging(cfg.CONF)
-
-    br_name_prefix = BRIDGE_NAME_PREFIX
-    physical_interface = cfg.CONF.LINUX_BRIDGE.physical_interface
-    polling_interval = cfg.CONF.AGENT.polling_interval
-    reconnect_interval = cfg.CONF.DATABASE.reconnect_interval
-    root_helper = cfg.CONF.AGENT.root_helper
-    'Establish database connection and load models'
-    db_connection_url = cfg.CONF.DATABASE.sql_connection
-    plugin = MetaLinuxBridgeQuantumAgent(br_name_prefix, physical_interface,
-                                         polling_interval, reconnect_interval,
-                                         root_helper,
-                                         cfg.CONF.AGENT.target_v2_api)
-    LOG.info("Agent initialized successfully, now running... ")
-    plugin.daemon_loop(db_connection_url)
-
-    sys.exit(0)
-
-if __name__ == "__main__":
-    main()
diff --git a/quantum/plugins/metaplugin/agent/ovs_quantum_agent.py b/quantum/plugins/metaplugin/agent/ovs_quantum_agent.py
deleted file mode 100755 (executable)
index e732924..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-#!/usr/bin/env python
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-# Copyright 2011 Nicira Networks, Inc.
-# All Rights Reserved.
-#
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
-#    not use this file except in compliance with the License. You may obtain
-#    a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-#    License for the specific language governing permissions and limitations
-#    under the License.
-# @author: Somik Behera, Nicira Networks, Inc.
-# @author: Brad Hall, Nicira Networks, Inc.
-# @author: Dan Wendlandt, Nicira Networks, Inc.
-# @author: Dave Lapsley, Nicira Networks, Inc.
-# @author: Aaron Rosen, Nicira Networks, Inc.
-
-import logging
-import sys
-import time
-
-from sqlalchemy.ext import sqlsoup
-
-from quantum.agent.linux import ovs_lib
-from quantum.common import config as logging_config
-from quantum.common import constants
-from quantum.openstack.common import cfg
-from quantum.plugins.openvswitch.common import config
-from quantum.plugins.openvswitch.agent.ovs_quantum_agent import OVSQuantumAgent
-
-logging.basicConfig()
-LOG = logging.getLogger(__name__)
-
-# A placeholder for dead vlans.
-DEAD_VLAN_TAG = "4095"
-
-
-class MetaOVSQuantumAgent(OVSQuantumAgent):
-
-    def daemon_loop(self, db_connection_url):
-        '''Main processing loop for Non-Tunneling Agent.
-
-        :param options: database information - in the event need to reconnect
-        '''
-        self.local_vlan_map = {}
-        old_local_bindings = {}
-        old_vif_ports = {}
-        db_connected = False
-
-        while True:
-            if not db_connected:
-                time.sleep(self.reconnect_interval)
-                db = sqlsoup.SqlSoup(db_connection_url)
-                db_connected = True
-                LOG.info("Connecting to database \"%s\" on %s" %
-                         (db.engine.url.database, db.engine.url.host))
-
-            all_bindings = {}
-            try:
-                flavor_key = db.flavors.network_id
-                port_key = db.ports.network_id
-                query = db.session.query(db.ports)
-                joined = query.join((db.flavors,
-                                     flavor_key == port_key))
-                where = db.flavors.flavor == 'openvswitch'
-                ports = joined.filter(where).all()
-            except Exception, e:
-                LOG.info("Unable to get port bindings! Exception: %s" % e)
-                db_connected = False
-                continue
-
-            for port in ports:
-                if self.target_v2_api:
-                    all_bindings[port.id] = port
-                else:
-                    all_bindings[port.interface_id] = port
-
-            vlan_bindings = {}
-            try:
-                flavor_key = db.flavors.network_id
-                vlan_key = db.vlan_bindings.network_id
-                query = db.session.query(db.vlan_bindings)
-                joined = query.join((db.flavors,
-                                     flavor_key == vlan_key))
-                where = db.flavors.flavor == 'openvswitch'
-                vlan_binds = joined.filter(where).all()
-            except Exception, e:
-                LOG.info("Unable to get vlan bindings! Exception: %s" % e)
-                db_connected = False
-                continue
-
-            for bind in vlan_binds:
-                vlan_bindings[bind.network_id] = bind.vlan_id
-
-            new_vif_ports = {}
-            new_local_bindings = {}
-            vif_ports = self.int_br.get_vif_ports()
-            for p in vif_ports:
-                new_vif_ports[p.vif_id] = p
-                if p.vif_id in all_bindings:
-                    net_id = all_bindings[p.vif_id].network_id
-                    new_local_bindings[p.vif_id] = net_id
-                else:
-                    # no binding, put him on the 'dead vlan'
-                    self.int_br.set_db_attribute("Port", p.port_name, "tag",
-                                                 DEAD_VLAN_TAG)
-                    self.int_br.add_flow(priority=2,
-                                         in_port=p.ofport,
-                                         actions="drop")
-
-                old_b = old_local_bindings.get(p.vif_id, None)
-                new_b = new_local_bindings.get(p.vif_id, None)
-
-                if old_b != new_b:
-                    if old_b is not None:
-                        LOG.info("Removing binding to net-id = %s for %s"
-                                 % (old_b, str(p)))
-                        self.port_unbound(p, True)
-                        if p.vif_id in all_bindings:
-                            all_bindings[p.vif_id].status = (
-                                constants.PORT_STATUS_DOWN)
-                    if new_b is not None:
-                        # If we don't have a binding we have to stick it on
-                        # the dead vlan
-                        net_id = all_bindings[p.vif_id].network_id
-                        vlan_id = vlan_bindings.get(net_id, DEAD_VLAN_TAG)
-                        self.port_bound(p, vlan_id)
-                        if p.vif_id in all_bindings:
-                            all_bindings[p.vif_id].status = (
-                                constants.PORT_STATUS_ACTIVE)
-                        LOG.info(("Adding binding to net-id = %s "
-                                  "for %s on vlan %s") %
-                                 (new_b, str(p), vlan_id))
-
-            for vif_id in old_vif_ports:
-                if vif_id not in new_vif_ports:
-                    LOG.info("Port Disappeared: %s" % vif_id)
-                    if vif_id in old_local_bindings:
-                        old_b = old_local_bindings[vif_id]
-                        self.port_unbound(old_vif_ports[vif_id], False)
-                    if vif_id in all_bindings:
-                        all_bindings[vif_id].status = (
-                            constants.PORT_STATUS_DOWN)
-
-            old_vif_ports = new_vif_ports
-            old_local_bindings = new_local_bindings
-            try:
-                db.commit()
-            except Exception, e:
-                LOG.info("Unable to commit to database! Exception: %s" % e)
-                db.rollback()
-                old_local_bindings = {}
-                old_vif_ports = {}
-
-            time.sleep(self.polling_interval)
-
-
-def main():
-    cfg.CONF(args=sys.argv, project='quantum')
-
-    # (TODO) gary - swap with common logging
-    logging_config.setup_logging(cfg.CONF)
-
-    # Determine which agent type to use.
-    enable_tunneling = cfg.CONF.OVS.enable_tunneling
-    integ_br = cfg.CONF.OVS.integration_bridge
-    db_connection_url = cfg.CONF.DATABASE.sql_connection
-    polling_interval = cfg.CONF.AGENT.polling_interval
-    reconnect_interval = cfg.CONF.DATABASE.reconnect_interval
-    root_helper = cfg.CONF.AGENT.root_helper
-
-    # Determine API Version to use
-    target_v2_api = cfg.CONF.AGENT.target_v2_api
-
-    # Get parameters for OVSQuantumAgent.
-    plugin = MetaOVSQuantumAgent(integ_br, root_helper, polling_interval,
-                                 reconnect_interval, target_v2_api)
-
-    # Start everything.
-    plugin.daemon_loop(db_connection_url)
-
-    sys.exit(0)
-
-if __name__ == "__main__":
-    main()