diff --git a/f5lbaasdriver/v2/bigip/driver_v2.py b/f5lbaasdriver/v2/bigip/driver_v2.py index 9d0ee79d3..4f43110c9 100644 --- a/f5lbaasdriver/v2/bigip/driver_v2.py +++ b/f5lbaasdriver/v2/bigip/driver_v2.py @@ -64,7 +64,7 @@ ), cfg.StrOpt( 'unlegacy_setting_placeholder_driver_side', - default=None, + default='special_driver_side', help=('used in certain hpb cases to differenciate legacy scenarios') ) ] @@ -318,6 +318,11 @@ def create(self, context, loadbalancer): agent_config_dict = \ scheduler.deserialize_agent_configurations(agent_config) + if agent in context.session: + LOG.info('inside here') + context.session.expire(agent, ['heartbeat_timestamp']) + LOG.info(agent) + if not agent_config_dict.get('nova_managed', False): # Update the port for the VIP to show ownership by this driver port_data = { diff --git a/f5lbaasdriver/v2/bigip/plugin_rpc.py b/f5lbaasdriver/v2/bigip/plugin_rpc.py index 727eed3fb..5561e46cb 100644 --- a/f5lbaasdriver/v2/bigip/plugin_rpc.py +++ b/f5lbaasdriver/v2/bigip/plugin_rpc.py @@ -105,15 +105,19 @@ def get_service_by_loadbalancer_id( % loadbalancer_id) try: + LOG.info('before get_loadbalancer') lb = self.driver.plugin.db.get_loadbalancer( context, id=loadbalancer_id ) + LOG.info('after get_loadbalancer') lb = LoadBalancer(**lb) if type(lb) == dict else lb + LOG.info('before get_agent_hosting_loadbalancer') agent = self.driver.plugin.db.get_agent_hosting_loadbalancer( context, loadbalancer_id ) + LOG.info('before get_agent_hosting_loadbalancer') # the preceeding get call returns a nested dict, unwind # one level if necessary agent = (agent['agent'] if 'agent' in agent else agent) @@ -135,10 +139,12 @@ def get_all_loadbalancers(self, context, env, group=None, host=None): agents = self.driver.scheduler.get_agents_in_env( context, plugin, env, group, active=None) for agent in agents: + LOG.info('before list_loadbalancers_on_lbaas_agent') agent_lbs = plugin.db.list_loadbalancers_on_lbaas_agent( context, agent.id ) + LOG.info('after list_loadbalancers_on_lbaas_agent') for lb in agent_lbs: lbobj = LoadBalancer(**lb) if type(lb) == dict else lb loadbalancers.append( @@ -164,10 +170,12 @@ def get_active_loadbalancers(self, context, env, group=None, host=None): agents = self.driver.scheduler.get_agents_in_env( context, plugin, env, group, active=None) for agent in agents: + LOG.info('before list_loadbalancers_on_lbaas_agent') agent_lbs = plugin.db.list_loadbalancers_on_lbaas_agent( context, agent.id ) + LOG.info('after list_loadbalancers_on_lbaas_agent') for lb in agent_lbs: lbobj = LoadBalancer(**lb) if type(lb) == dict else lb if lbobj.provisioning_status == plugin_constants.ACTIVE: @@ -194,10 +202,12 @@ def get_pending_loadbalancers(self, context, env, group=None, host=None): agents = self.driver.scheduler.get_agents_in_env( context, plugin, env, group, active=None) for agent in agents: + LOG.info('before list_loadbalancers_on_lbaas_agent') agent_lbs = plugin.db.list_loadbalancers_on_lbaas_agent( context, agent.id ) + LOG.info('after list_loadbalancers_on_lbaas_agent') for lb in agent_lbs: lbobj = LoadBalancer(**lb) if type(lb) == dict else lb if (lbobj.provisioning_status != @@ -227,10 +237,12 @@ def get_errored_loadbalancers(self, context, env, group=None, host=None): agents = self.driver.scheduler.get_agents_in_env( context, plugin, env, group, active=None) for agent in agents: + LOG.info('before list_loadbalancers_on_lbaas_agent') agent_lbs = plugin.db.list_loadbalancers_on_lbaas_agent( context, agent.id ) + LOG.info('after list_loadbalancers_on_lbaas_agent') for lb in agent_lbs: lbobj = LoadBalancer(**lb) if type(lb) == dict else lb if (lbobj.provisioning_status == plugin_constants.ERROR): @@ -252,9 +264,11 @@ def update_loadbalancer_stats( """Update service stats.""" with context.session.begin(subtransactions=True): try: + LOG.info('before update_loadbalancer_stats') self.driver.plugin.db.update_loadbalancer_stats( context, loadbalancer_id, stats ) + LOG.info('after update_loadbalancer_stats') except Exception as e: LOG.error('Exception: update_loadbalancer_stats: %s', e.message) @@ -265,6 +279,7 @@ def update_loadbalancer_status(self, context, loadbalancer_id=None, """Agent confirmation hook to update loadbalancer status.""" with context.session.begin(subtransactions=True): try: + LOG.info('before update_status') self.driver.plugin.db.update_status( context, models.LoadBalancer, @@ -272,6 +287,7 @@ def update_loadbalancer_status(self, context, loadbalancer_id=None, status, operating_status ) + LOG.info('after update_status') except Exception as e: LOG.error('Exception: update_loadbalancer_status: %s', e.message) @@ -288,6 +304,7 @@ def update_listener_status(self, context, listener_id=None, """Agent confirmation hook to update listener status.""" with context.session.begin(subtransactions=True): try: + LOG.info('before update_status') self.driver.plugin.db.update_status( context, models.Listener, @@ -295,6 +312,7 @@ def update_listener_status(self, context, listener_id=None, provisioning_status, operating_status ) + LOG.info('after update_status') except Exception as e: LOG.error('Exception: update_listener_status: %s', e.message) @@ -311,6 +329,7 @@ def update_pool_status(self, context, pool_id=None, """Agent confirmations hook to update pool status.""" with context.session.begin(subtransactions=True): try: + LOG.info('before update_status') self.driver.plugin.db.update_status( context, models.PoolV2, @@ -318,6 +337,7 @@ def update_pool_status(self, context, pool_id=None, provisioning_status, operating_status ) + LOG.info('after update_status') except Exception as e: LOG.error('Exception: update_pool_status: %s', e.message) @@ -334,6 +354,7 @@ def update_member_status(self, context, member_id=None, """Agent confirmations hook to update member status.""" with context.session.begin(subtransactions=True): try: + LOG.info('before update_status') self.driver.plugin.db.update_status( context, models.MemberV2, @@ -341,6 +362,7 @@ def update_member_status(self, context, member_id=None, provisioning_status, operating_status ) + LOG.info('after update_status') except Exception as e: LOG.error('Exception: update_member_status: %s', e.message) @@ -357,6 +379,7 @@ def update_health_monitor_status( """Agent confirmation hook to update health monitor status.""" with context.session.begin(subtransactions=True): try: + LOG.info('before update_status') self.driver.plugin.db.update_status( context, models.HealthMonitorV2, @@ -364,6 +387,7 @@ def update_health_monitor_status( provisioning_status, operating_status ) + LOG.info('after update_status') except Exception as e: LOG.error('Exception: update_health_monitor_status: %s', e.message) @@ -380,6 +404,7 @@ def update_l7policy_status(self, context, l7policy_id=None, """Agent confirmation hook to update l7 policy status.""" with context.session.begin(subtransactions=True): try: + LOG.info('before update_status') self.driver.plugin.db.update_status( context, models.L7Policy, @@ -387,6 +412,7 @@ def update_l7policy_status(self, context, l7policy_id=None, provisioning_status, operating_status ) + LOG.info('after update_status') except Exception as e: LOG.error('Exception: update_l7policy_status: %s', e.message) @@ -404,6 +430,7 @@ def update_l7rule_status(self, context, l7rule_id=None, l7policy_id=None, """Agent confirmation hook to update l7 policy status.""" with context.session.begin(subtransactions=True): try: + LOG.info('before update_status') self.driver.plugin.db.update_status( context, models.L7Rule, @@ -411,6 +438,7 @@ def update_l7rule_status(self, context, l7rule_id=None, l7policy_id=None, provisioning_status, operating_status ) + LOG.info('after update_status') except Exception as e: LOG.error('Exception: update_l7rule_status: %s', e.message) diff --git a/f5lbaasdriver/v2/bigip/service_builder.py b/f5lbaasdriver/v2/bigip/service_builder.py index bcb573a34..8c89bd6ae 100644 --- a/f5lbaasdriver/v2/bigip/service_builder.py +++ b/f5lbaasdriver/v2/bigip/service_builder.py @@ -312,7 +312,9 @@ def _populate_member_network(self, context, member, network): 'fixed_ips': {'subnet_id': [member['subnet_id']]}, 'binding:host_id': [host_id] } - port = self.plugin.db._core_plugin.get_ports(context, filters) + port = self.plugin.db._core_plugin.get_ports( + context, filters=filters, limit=1 + ) if port: port_id = port[0]['id'] segment_data = self.disconnected_service.get_segment_id(