Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some patches to add #1118

Open
wants to merge 1 commit into
base: stable/pike
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion f5lbaasdriver/v2/bigip/driver_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
)
]
Expand Down Expand Up @@ -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 = {
Expand Down
28 changes: 28 additions & 0 deletions f5lbaasdriver/v2/bigip/plugin_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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(
Expand All @@ -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:
Expand All @@ -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 !=
Expand Down Expand Up @@ -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):
Expand All @@ -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)
Expand All @@ -265,13 +279,15 @@ 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,
loadbalancer_id,
status,
operating_status
)
LOG.info('after update_status')
except Exception as e:
LOG.error('Exception: update_loadbalancer_status: %s',
e.message)
Expand All @@ -288,13 +304,15 @@ 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,
listener_id,
provisioning_status,
operating_status
)
LOG.info('after update_status')
except Exception as e:
LOG.error('Exception: update_listener_status: %s',
e.message)
Expand All @@ -311,13 +329,15 @@ 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,
pool_id,
provisioning_status,
operating_status
)
LOG.info('after update_status')
except Exception as e:
LOG.error('Exception: update_pool_status: %s',
e.message)
Expand All @@ -334,13 +354,15 @@ 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,
member_id,
provisioning_status,
operating_status
)
LOG.info('after update_status')
except Exception as e:
LOG.error('Exception: update_member_status: %s',
e.message)
Expand All @@ -357,13 +379,15 @@ 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,
health_monitor_id,
provisioning_status,
operating_status
)
LOG.info('after update_status')
except Exception as e:
LOG.error('Exception: update_health_monitor_status: %s',
e.message)
Expand All @@ -380,13 +404,15 @@ 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,
l7policy_id,
provisioning_status,
operating_status
)
LOG.info('after update_status')
except Exception as e:
LOG.error('Exception: update_l7policy_status: %s',
e.message)
Expand All @@ -404,13 +430,15 @@ 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,
l7rule_id,
provisioning_status,
operating_status
)
LOG.info('after update_status')
except Exception as e:
LOG.error('Exception: update_l7rule_status: %s',
e.message)
Expand Down
4 changes: 3 additions & 1 deletion f5lbaasdriver/v2/bigip/service_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down