From a8d9ed9181dda83b7f500f86d2d4486603f4781d Mon Sep 17 00:00:00 2001 From: Dan Wendlandt Date: Fri, 10 Aug 2012 19:37:34 -0700 Subject: [PATCH] linux bridge fixes following v1 code removal. Change-Id: I4ad84421757db271904c8704a12b2e7abdfa8a0e --- quantum/api/api_common.py | 5 ++++- quantum/plugins/linuxbridge/db/l2network_db.py | 2 +- quantum/plugins/linuxbridge/lb_quantum_plugin.py | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/quantum/api/api_common.py b/quantum/api/api_common.py index 8debe36f49..8f54d35379 100644 --- a/quantum/api/api_common.py +++ b/quantum/api/api_common.py @@ -19,12 +19,15 @@ import logging from webob import exc -from quantum.api import faults from quantum import wsgi LOG = logging.getLogger(__name__) +# Port Status +PORT_STATUS_UP = "UP" +PORT_STATUS_DOWN = "DOWN" + class QuantumController(object): """ Base controller class for Quantum API """ diff --git a/quantum/plugins/linuxbridge/db/l2network_db.py b/quantum/plugins/linuxbridge/db/l2network_db.py index 25c3aa02f6..498fdcb633 100644 --- a/quantum/plugins/linuxbridge/db/l2network_db.py +++ b/quantum/plugins/linuxbridge/db/l2network_db.py @@ -303,7 +303,7 @@ def set_port_status(port_id, status): try: port = session.query(models_v2.Port).filter_by(id=port_id).one() port['status'] = status - if status == api_common.OperationalStatus.DOWN: + if status == api_common.PORT_STATUS_DOWN: port['device_id'] = '' session.merge(port) session.flush() diff --git a/quantum/plugins/linuxbridge/lb_quantum_plugin.py b/quantum/plugins/linuxbridge/lb_quantum_plugin.py index 13aaa7d154..1b0507c8d5 100644 --- a/quantum/plugins/linuxbridge/lb_quantum_plugin.py +++ b/quantum/plugins/linuxbridge/lb_quantum_plugin.py @@ -64,7 +64,7 @@ class LinuxBridgeRpcCallbacks(): 'port_id': port['id'], 'admin_state_up': port['admin_state_up']} # Set the port status to UP - cdb.set_port_status(port['id'], api_common.OperationalStatus.UP) + cdb.set_port_status(port['id'], api_common.PORT_STATUS_UP) else: entry = {'device': device} LOG.debug("%s can not be found in database", device) @@ -81,7 +81,7 @@ class LinuxBridgeRpcCallbacks(): entry = {'device': device, 'exists': True} # Set port status to DOWN - cdb.set_port_status(port['id'], api_common.OperationalStatus.DOWN) + cdb.set_port_status(port['id'], api_common.PORT_STATUS_UP) else: entry = {'device': device, 'exists': False}