Pass context as kwarg instead of positional arg to get_engine

There are a couple of places in nova/db/api/sqlalchemy.py where the
context argument is passed as a positional arg instead of a kwarg,
causing it to be erroneously mapped to the use_slave kwarg:

  def get_engine(use_slave=False, context=None):

This corrects to calls to pass context=context instead.

Change-Id: I8fb7f04a54d9f7f645df8287cdda0ae665a22368
This commit is contained in:
melanie witt 2016-12-06 16:35:22 +00:00
parent f61db221f3
commit b26db1752a

View File

@ -630,7 +630,7 @@ def _compute_node_select(context, filters=None, limit=None, marker=None):
def _compute_node_fetchall(context, filters=None, limit=None, marker=None):
select = _compute_node_select(context, filters, limit=limit, marker=marker)
engine = get_engine(context)
engine = get_engine(context=context)
conn = engine.connect()
results = conn.execute(select).fetchall()
@ -748,7 +748,7 @@ def compute_node_delete(context, compute_id):
@pick_context_manager_reader
def compute_node_statistics(context):
"""Compute statistics over all compute nodes."""
engine = get_engine(context)
engine = get_engine(context=context)
services_tbl = models.Service.__table__
inner_sel = sa.alias(_compute_node_select(context), name='inner_sel')