Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use context provided by request in rpc server #124

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions asr1k_neutron_l3/plugins/ml2/drivers/mech_asr1k/rpc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# License for the specific language governing permissions and limitations
# under the License.

from neutron_lib import context
from neutron_lib import rpc as n_rpc
from oslo_log import helpers as log_helpers
from oslo_log import log
Expand Down Expand Up @@ -72,38 +71,37 @@ class ASR1KPluginCallback(object):

def __init__(self):
self.db = asr1k_db.get_db_plugin()
self.context = context.get_admin_context()

@instrument.instrument()
def get_ports_with_extra_atts(self, rpc_context, ports, agent_id=None, host=None):
return self.db.get_ports_with_extra_atts(self.context, ports, host)
def get_ports_with_extra_atts(self, context, ports, agent_id=None, host=None):
return self.db.get_ports_with_extra_atts(context, ports, host)

@instrument.instrument()
def get_extra_atts(self, rpc_context, ports, agent_id=None, host=None):
return self.db.get_extra_atts(self.context, ports, host)
def get_extra_atts(self, context, ports, agent_id=None, host=None):
return self.db.get_extra_atts(context, ports, host)

def get_orphaned_extra_atts(self, rpc_context, agent_id=None, host=None):
return self.db.get_orphaned_extra_atts(self.context, host=host)
def get_orphaned_extra_atts(self, context, agent_id=None, host=None):
return self.db.get_orphaned_extra_atts(context, host=host)

@log_helpers.log_method_call
def delete_extra_atts(self, rpc_context, ports, agent_id=None, host=None):
def delete_extra_atts(self, context, ports, agent_id=None, host=None):
LOG.debug("Deleting extra atts for ports {}".format(ports))

for port_id in ports:
self.db.delete_extra_att(self.context, port_id, l2=True)
self.db.delete_extra_att(context, port_id, l2=True)

@instrument.instrument()
def get_interface_ports(self, rpc_context, limit=None, offset=None, host=None):
ports = self.db.get_interface_ports(self.context, limit=limit,
def get_interface_ports(self, context, limit=None, offset=None, host=None):
ports = self.db.get_interface_ports(context, limit=limit,
offset=offset, host=host)

LOG.debug("ports len %s", len(ports))

return ports

@instrument.instrument()
def get_networks_with_asr1k_ports(self, rpc_context, limit=None, offset=None, host=None, networks=None):
return self.db.get_networks_with_asr1k_ports(self.context, limit, offset, host, networks)
def get_networks_with_asr1k_ports(self, context, limit=None, offset=None, host=None, networks=None):
return self.db.get_networks_with_asr1k_ports(context, limit, offset, host, networks)

@instrument.instrument()
def get_device_info(self, context, host):
Expand Down
Loading