Skip to content

Commit

Permalink
unstaged changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminLudwigSAP committed Nov 4, 2024
1 parent f440c6f commit 11cad11
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 24 deletions.
34 changes: 17 additions & 17 deletions octavia_f5/controller/worker/controller_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@ class ControllerWorker(object):
'octavia_as3_worker_queue', 'Number of items in AS3 worker queue', ['octavia_host'])

def __init__(self):
# self._repositories = repo.Repositories()
# self._loadbalancer_repo = f5_repos.LoadBalancerRepository()
# self._amphora_repo = repo.AmphoraRepository()
# self._health_mon_repo = repo.HealthMonitorRepository()
# self._listener_repo = f5_repos.ListenerRepository()
# self._member_repo = repo.MemberRepository()
# self._pool_repo = f5_repos.PoolRepository()
# self._l7policy_repo = f5_repos.L7PolicyRepository()
# self._l7rule_repo = repo.L7RuleRepository()
# self._vip_repo = repo.VipRepository()
# self._quota_repo = f5_repos.QuotasRepository()
# self._az_repo = repo.AvailabilityZoneRepository()
# self._azp_repo = repo.AvailabilityZoneProfileRepository()
# self.queue = SetQueue()
self._repositories = repo.Repositories()
self._loadbalancer_repo = f5_repos.LoadBalancerRepository()
self._amphora_repo = repo.AmphoraRepository()
self._health_mon_repo = repo.HealthMonitorRepository()
self._listener_repo = f5_repos.ListenerRepository()
self._member_repo = repo.MemberRepository()
self._pool_repo = f5_repos.PoolRepository()
self._l7policy_repo = f5_repos.L7PolicyRepository()
self._l7rule_repo = repo.L7RuleRepository()
self._vip_repo = repo.VipRepository()
self._quota_repo = f5_repos.QuotasRepository()
self._az_repo = repo.AvailabilityZoneRepository()
self._azp_repo = repo.AvailabilityZoneProfileRepository()
self.queue = SetQueue()

# instantiate managers/drivers
# self.status = status_manager.StatusManager()
Expand All @@ -79,9 +79,9 @@ def __init__(self):

# start thread for reconciliation loop, full sync loop, orphan cleanup loop
worker = periodics.PeriodicWorker(
[(self.pending_sync, None, None),
(self.full_sync_reappearing_devices, None, None),
(self.cleanup_orphaned_tenants, None, None),
[#(self.pending_sync, None, None),
#(self.full_sync_reappearing_devices, None, None),
#(self.cleanup_orphaned_tenants, None, None),
(self.full_sync_l2, None, None)]
)
t = threading.Thread(target=worker.start)
Expand Down
7 changes: 5 additions & 2 deletions octavia_f5/controller/worker/flows/f5_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@

class F5Flows(object):

def __init__(self):#, f5os_a_api=CONF.networking.vcmp_rseries):
self.f5os_a_api = False#f5os_a_api
def __init__(self, f5os_a_api=None):
if f5os_a_api is None:
self.f5os_a_api = CONF.networking.vcmp_rseries
else:
self.f5os_a_api = f5os_a_api
# TODO use f5os_a_api to distinguish, which tasks to use

def make_ensure_l2_flow(self, selfips: [network_models.Port], store: dict) -> flow.Flow:
Expand Down
10 changes: 5 additions & 5 deletions octavia_f5/controller/worker/l2_sync_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class L2SyncManager(BaseTaskFlowEngine):
_metric_failed_futures = prometheus.metrics.Counter(
'octavia_l2_failed_futures', 'Failed l2 task futures', ['device', 'task'])

def __init__(self, foo=CONF.networking.vcmp_urls):
def __init__(self):
super(L2SyncManager).__init__()
self._bigips = list(self.initialize_bigips(CONF.f5_agent.bigip_urls))
self._vcmps = list(self.initialize_bigips(CONF.networking.vcmp_urls,
Expand Down Expand Up @@ -177,13 +177,13 @@ def ensure_l2_flow(self, selfips: [network_models.Port], network_id: str, device
:param network_id: Neutron Network ID
:param device: optional device host to sync, defaults to all devices to sync
"""
if not selfips:
return
# if not selfips:
# return

# get and check network
network = self._network_driver.get_network(network_id)
if not network.has_bound_segment():
raise Exception(f"Failed ensure_l2_flow for network_id={network_id}: No segment bound")
# if not network.has_bound_segment():
# raise Exception(f"Failed ensure_l2_flow for network_id={network_id}: No segment bound")

# run l2 flow for all devices in parallel
fs = {}
Expand Down
6 changes: 6 additions & 0 deletions octavia_f5/network/drivers/neutron/neutron_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,12 @@ def _get_f5_hostnames(self, host: str) -> [str]:
raise Exception(f"Hostname not found for host {host}")

def _get_subnets_chunks(self, subnets: list, max_size: int = 100):
""" Splits a list of subnets into chunks of a maximum size.
This can be used to make sure that requests to Neutron don't become too big.
:param subnets: List of subnets
:param max_size: Maximum size of each chunk
"""
for i in range(0, len(subnets), max_size):
yield subnets[i:i + max_size]

Expand Down

0 comments on commit 11cad11

Please sign in to comment.