Merge "Use Router OVO in metering_db"
This commit is contained in:
commit
fbea3e34f7
|
@ -19,16 +19,15 @@ from oslo_utils import uuidutils
|
|||
|
||||
from neutron.api.rpc.agentnotifiers import metering_rpc_agent_api
|
||||
from neutron.common import constants
|
||||
from neutron.db import _model_query as model_query
|
||||
from neutron.db import _utils as db_utils
|
||||
from neutron.db import api as db_api
|
||||
from neutron.db import common_db_mixin as base_db
|
||||
from neutron.db import l3_dvr_db
|
||||
from neutron.db.models import l3 as l3_models
|
||||
from neutron.db.models import metering as metering_models
|
||||
from neutron.extensions import metering
|
||||
from neutron.objects import base as base_obj
|
||||
from neutron.objects import metering as metering_objs
|
||||
from neutron.objects import router as l3_obj
|
||||
|
||||
|
||||
class MeteringDbMixin(metering.MeteringPluginBase,
|
||||
|
@ -181,15 +180,13 @@ class MeteringDbMixin(metering.MeteringPluginBase,
|
|||
return res
|
||||
|
||||
def _process_sync_metering_data(self, context, labels):
|
||||
all_routers = None
|
||||
routers = None
|
||||
|
||||
routers_dict = {}
|
||||
for label in labels:
|
||||
if label.shared:
|
||||
if not all_routers:
|
||||
all_routers = model_query.get_collection_query(
|
||||
context, l3_models.Router)
|
||||
routers = all_routers
|
||||
if not routers:
|
||||
routers = l3_obj.Router.get_objects(context)
|
||||
else:
|
||||
routers = label.routers
|
||||
|
||||
|
@ -214,10 +211,8 @@ class MeteringDbMixin(metering.MeteringPluginBase,
|
|||
metering_models.MeteringLabel).get(
|
||||
rule['metering_label_id'])
|
||||
|
||||
# TODO(electrocucaracha) This depends on the Router OVO implementation
|
||||
if label.shared:
|
||||
routers = model_query.get_collection_query(
|
||||
context, l3_models.Router)
|
||||
routers = l3_obj.Router.get_objects(context)
|
||||
else:
|
||||
routers = label.routers
|
||||
|
||||
|
|
|
@ -204,8 +204,12 @@ class Router(base.NeutronDbObject):
|
|||
'gw_port_id': common_types.UUIDField(nullable=True),
|
||||
'enable_snat': obj_fields.BooleanField(default=True),
|
||||
'flavor_id': common_types.UUIDField(nullable=True),
|
||||
'extra_attributes': obj_fields.ObjectField(
|
||||
'RouterExtraAttributes', nullable=True),
|
||||
}
|
||||
|
||||
synthetic_fields = ['extra_attributes']
|
||||
|
||||
|
||||
@base.NeutronObjectRegistry.register
|
||||
class FloatingIP(base.NeutronDbObject):
|
||||
|
|
|
@ -84,7 +84,7 @@ object_data = {
|
|||
'Reservation': '1.0-49929fef8e82051660342eed51b48f2a',
|
||||
'ResourceDelta': '1.0-a980b37e0a52618b5af8db29af18be76',
|
||||
'Route': '1.0-a9883a63b416126f9e345523ec09483b',
|
||||
'Router': '1.0-b8d482cf3164541da4edaec99a644507',
|
||||
'Router': '1.0-adb984d9b73aa11566d40abbeb790df1',
|
||||
'RouterExtraAttributes': '1.0-ef8d61ae2864f0ec9af0ab7939cab318',
|
||||
'RouterL3AgentBinding': '1.0-c5ba6c95e3a4c1236a55f490cd67da82',
|
||||
'RouterPort': '1.0-c8c8f499bcdd59186fcd83f323106908',
|
||||
|
|
Loading…
Reference in New Issue