Browse Source

Merge "load neutron objects using neutron-lib"

changes/85/572985/1
Zuul 3 years ago
committed by Gerrit Code Review
parent
commit
762824d24f
2 changed files with 8 additions and 6 deletions
  1. +1
    -1
      requirements.txt
  2. +7
    -5
      tricircle/network/central_qos_plugin.py

+ 1
- 1
requirements.txt View File

@ -16,7 +16,7 @@ keystoneauth1>=3.4.0 # Apache-2.0
keystonemiddleware>=4.17.0 # Apache-2.0
netaddr>=0.7.18 # BSD
netifaces>=0.10.4 # MIT
neutron-lib>=1.13.0 # Apache-2.0
neutron-lib>=1.14.0 # Apache-2.0
retrying!=1.3.0,>=1.2.3 # Apache-2.0
SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT
WebOb>=1.7.1 # MIT


+ 7
- 5
tricircle/network/central_qos_plugin.py View File

@ -14,9 +14,9 @@
# under the License.
from neutron.objects import ports as ports_object
from neutron.services.qos import qos_plugin
from neutron_lib.api.definitions import portbindings
from neutron_lib.objects import registry as obj_reg
from oslo_log import log
import tricircle.common.client as t_client
@ -41,7 +41,7 @@ class TricircleQosPlugin(qos_plugin.QoSPlugin):
def _get_ports_with_policy(self, context, policy):
networks_ids = policy.get_bound_networks()
ports_with_net_policy = ports_object.Port.get_objects(
ports_with_net_policy = obj_reg.load_class('Port').get_objects(
context, network_id=networks_ids)
# Filter only these ports which don't have overwritten policy
@ -51,7 +51,7 @@ class TricircleQosPlugin(qos_plugin.QoSPlugin):
]
ports_ids = policy.get_bound_ports()
ports_with_policy = ports_object.Port.get_objects(
ports_with_policy = obj_reg.load_class('Port').get_objects(
context, id=ports_ids)
t_ports = list(set(ports_with_policy + ports_with_net_policy))
@ -64,7 +64,8 @@ class TricircleQosPlugin(qos_plugin.QoSPlugin):
b_region_name = b_pod['region_name']
b_client = self._get_client(region_name=b_region_name)
b_port = b_client.get_ports(t_ctx, b_port_id)
new_binding = ports_object.PortBinding(
new_binding = obj_reg.new_instance(
'PortBinding',
port_id=t_port.id,
vif_type=b_port.get('binding:vif_type',
portbindings.VIF_TYPE_UNBOUND),
@ -73,7 +74,8 @@ class TricircleQosPlugin(qos_plugin.QoSPlugin):
)
t_port.binding = new_binding
else:
new_binding = ports_object.PortBinding(
new_binding = obj_reg.new_instance(
'PortBinding',
port_id=t_port.id,
vif_type=portbindings.VIF_TYPE_UNBOUND,
vnic_type=portbindings.VNIC_NORMAL


Loading…
Cancel
Save