Remove _get_trunks method for openstacksdk client.

We already bumped version of openstacksdk, so now we can get all trunk
ports without any hacks. This patch is fixing it.

Change-Id: I766024502b23f46c42b985d00616cdd0bb442123
This commit is contained in:
Roman Dobosz 2020-01-28 10:04:53 +01:00
parent 0388766386
commit 6cc473ba50
2 changed files with 3 additions and 15 deletions

View File

@ -91,17 +91,6 @@ def _create_ports(self, payload):
return (os_port.Port(**item) for item in response.json()['ports'])
def _get_trunks(self, payload):
"""Return trunks filtered by whatever"""
# TODO(gryf): Trunk object have been updated in OpenStackSDK 0.21. After
# we bump to this version (or higher), this method can be safely removed,
# and its call replaced with:
# os_net.trunks(tags=[...])
response = self.get(os_trunk.Trunk.base_path, params=payload)
os_exc.raise_from_response(response)
return (os_trunk.Trunk(**item) for item in response.json()['trunks'])
def _add_trunk_subports(self, trunk, subports):
"""Set sub_ports on trunk
@ -152,7 +141,6 @@ def setup_openstacksdk():
session=session,
region_name=getattr(config.CONF.neutron, 'region_name', None))
conn.network.create_ports = partial(_create_ports, conn.network)
conn.network.get_trunks = partial(_get_trunks, conn.network)
conn.network.add_trunk_subports = partial(_add_trunk_subports,
conn.network)
conn.network.delete_trunk_subports = partial(_delete_trunk_subports,

View File

@ -676,12 +676,12 @@ class NestedVIFPool(BaseVIFPool):
def _get_parent_port_id(self, vif):
os_net = clients.get_network_client()
args = {}
tags = []
if config.CONF.neutron_defaults.resource_tags:
args['tags'] = config.CONF.neutron_defaults.resource_tags
tags = config.CONF.neutron_defaults.resource_tags
trunks = os_net.get_trunks(args)
trunks = os_net.trunks(tags=tags)
for trunk in trunks:
for sp in trunk.sub_ports: