Improve logging in octavia.controller
We should delegate (when possible) formatting to the logger in order to perform formatting only when needed, by using: LOG.<level>(message, data) instead of: LOG.<level>(message % data) and try: ... except ...: LOG.exception("lorem ipsum") instead of: try: ... except ... as e: LOG.error("lorem ipsum: %s:", e) This change removes also some incorrect usages of _LW in debug logs. Change-Id: I6c62ceffbb99d2dee76160d398c6166132f6471c
This commit is contained in:
parent
cc67be5e5f
commit
c287c9f447
|
@ -48,12 +48,12 @@ class HealthManager(object):
|
|||
if amp is None:
|
||||
break
|
||||
failover_count += 1
|
||||
LOG.info(_LI("Stale amphora's id is: %s") %
|
||||
LOG.info(_LI("Stale amphora's id is: %s"),
|
||||
amp.amphora_id)
|
||||
executor.submit(self.cw.failover_amphora,
|
||||
amp.amphora_id)
|
||||
if failover_count > 0:
|
||||
LOG.info(_LI("Failed over %s amphora") %
|
||||
LOG.info(_LI("Failed over %s amphora"),
|
||||
failover_count)
|
||||
finally:
|
||||
executor.shutdown(wait=True)
|
||||
|
|
|
@ -41,8 +41,8 @@ class SpareAmphora(object):
|
|||
session = db_api.get_session()
|
||||
conf_spare_cnt = CONF.house_keeping.spare_amphora_pool_size
|
||||
curr_spare_cnt = self.amp_repo.get_spare_amphora_count(session)
|
||||
LOG.debug("Required Spare Amphora count : %d" % conf_spare_cnt)
|
||||
LOG.debug("Current Spare Amphora count : %d" % curr_spare_cnt)
|
||||
LOG.debug("Required Spare Amphora count : %d", conf_spare_cnt)
|
||||
LOG.debug("Current Spare Amphora count : %d", curr_spare_cnt)
|
||||
diff_count = conf_spare_cnt - curr_spare_cnt
|
||||
|
||||
# When the current spare amphora is less than required
|
||||
|
@ -52,7 +52,7 @@ class SpareAmphora(object):
|
|||
|
||||
# Call Amphora Create Flow diff_count times
|
||||
for i in range(1, diff_count + 1):
|
||||
LOG.debug("Starting amphorae number %d ..." % i)
|
||||
LOG.debug("Starting amphorae number %d ...", i)
|
||||
self.cw.create_amphora()
|
||||
|
||||
else:
|
||||
|
@ -76,6 +76,6 @@ class DatabaseCleanup(object):
|
|||
for amp in amphora:
|
||||
if self.amp_health_repo.check_amphora_expired(session, amp.id,
|
||||
exp_age):
|
||||
LOG.info(_LI('Attempting to delete Amphora id : %s') % amp.id)
|
||||
LOG.info(_LI('Attempting to delete Amphora id : %s'), amp.id)
|
||||
self.amp_repo.delete(session, id=amp.id)
|
||||
LOG.info(_LI('Deleted Amphora id : %s') % amp.id)
|
||||
LOG.info(_LI('Deleted Amphora id : %s'), amp.id)
|
||||
|
|
|
@ -41,53 +41,53 @@ class Endpoint(object):
|
|||
).driver
|
||||
|
||||
def create_load_balancer(self, context, load_balancer_id):
|
||||
LOG.info(_LI('Creating load balancer \'%s\'...') % load_balancer_id)
|
||||
LOG.info(_LI('Creating load balancer \'%s\'...'), load_balancer_id)
|
||||
self.worker.create_load_balancer(load_balancer_id)
|
||||
|
||||
def update_load_balancer(self, context, load_balancer_id,
|
||||
load_balancer_updates):
|
||||
LOG.info(_LI('Updating load balancer \'%s\'...') % load_balancer_id)
|
||||
LOG.info(_LI('Updating load balancer \'%s\'...'), load_balancer_id)
|
||||
self.worker.update_load_balancer(load_balancer_id,
|
||||
load_balancer_updates)
|
||||
|
||||
def delete_load_balancer(self, context, load_balancer_id):
|
||||
LOG.info(_LI('Deleting load balancer \'%s\'...') % load_balancer_id)
|
||||
LOG.info(_LI('Deleting load balancer \'%s\'...'), load_balancer_id)
|
||||
self.worker.delete_load_balancer(load_balancer_id)
|
||||
|
||||
def create_listener(self, context, listener_id):
|
||||
LOG.info(_LI('Creating listener \'%s\'...') % listener_id)
|
||||
LOG.info(_LI('Creating listener \'%s\'...'), listener_id)
|
||||
self.worker.create_listener(listener_id)
|
||||
|
||||
def update_listener(self, context, listener_id, listener_updates):
|
||||
LOG.info(_LI('Updating listener \'%s\'...') % listener_id)
|
||||
LOG.info(_LI('Updating listener \'%s\'...'), listener_id)
|
||||
self.worker.update_listener(listener_id, listener_updates)
|
||||
|
||||
def delete_listener(self, context, listener_id):
|
||||
LOG.info(_LI('Deleting listener \'%s\'...') % listener_id)
|
||||
LOG.info(_LI('Deleting listener \'%s\'...'), listener_id)
|
||||
self.worker.delete_listener(listener_id)
|
||||
|
||||
def create_pool(self, context, pool_id):
|
||||
LOG.info(_LI('Creating pool \'%s\'...') % pool_id)
|
||||
LOG.info(_LI('Creating pool \'%s\'...'), pool_id)
|
||||
self.worker.create_pool(pool_id)
|
||||
|
||||
def update_pool(self, context, pool_id, pool_updates):
|
||||
LOG.info(_LI('Updating pool \'%s\'...') % pool_id)
|
||||
LOG.info(_LI('Updating pool \'%s\'...'), pool_id)
|
||||
self.worker.update_pool(pool_id, pool_updates)
|
||||
|
||||
def delete_pool(self, context, pool_id):
|
||||
LOG.info(_LI('Deleting pool \'%s\'...') % pool_id)
|
||||
LOG.info(_LI('Deleting pool \'%s\'...'), pool_id)
|
||||
self.worker.delete_pool(pool_id)
|
||||
|
||||
def create_health_monitor(self, context, pool_id):
|
||||
LOG.info(_LI('Creating health monitor on pool \'%s\'...') % pool_id)
|
||||
LOG.info(_LI('Creating health monitor on pool \'%s\'...'), pool_id)
|
||||
self.worker.create_health_monitor(pool_id)
|
||||
|
||||
def update_health_monitor(self, context, pool_id, health_monitor_updates):
|
||||
LOG.info(_LI('Updating health monitor on pool \'%s\'...') % pool_id)
|
||||
LOG.info(_LI('Updating health monitor on pool \'%s\'...'), pool_id)
|
||||
self.worker.update_health_monitor(pool_id, health_monitor_updates)
|
||||
|
||||
def delete_health_monitor(self, context, pool_id):
|
||||
LOG.info(_LI('Deleting health monitor on pool \'%s\'...') % pool_id)
|
||||
LOG.info(_LI('Deleting health monitor on pool \'%s\'...'), pool_id)
|
||||
self.worker.delete_health_monitor(pool_id)
|
||||
|
||||
def create_member(self, context, member_id):
|
||||
|
|
|
@ -190,8 +190,8 @@ class AmphoraPostNetworkPlug(BaseAmphoraTask):
|
|||
for port in ports:
|
||||
self.amphora_driver.post_network_plug(amphora, port)
|
||||
LOG.debug("post_network_plug called on compute instance "
|
||||
"{compute_id} for port {port_id}".format(
|
||||
compute_id=amphora.compute_id, port_id=port.id))
|
||||
"%(compute_id)s for port %(port_id)s",
|
||||
{"compute_id": amphora.compute_id, "port_id": port.id})
|
||||
|
||||
def revert(self, result, amphora, *args, **kwargs):
|
||||
"""Handle a failed post network plug."""
|
||||
|
|
|
@ -54,8 +54,7 @@ class ComputeCreate(BaseComputeTask):
|
|||
"""
|
||||
ports = ports or []
|
||||
config_drive_files = config_drive_files or {}
|
||||
LOG.debug("Compute create execute for amphora with id %s"
|
||||
% amphora_id)
|
||||
LOG.debug("Compute create execute for amphora with id %s", amphora_id)
|
||||
|
||||
try:
|
||||
agent_cfg = agent_jinja_cfg.AgentJinjaTemplater()
|
||||
|
@ -71,15 +70,14 @@ class ComputeCreate(BaseComputeTask):
|
|||
port_ids=[port.id for port in ports],
|
||||
config_drive_files=config_drive_files)
|
||||
|
||||
LOG.debug("Server created with id: %s for amphora id: %s" %
|
||||
LOG.debug("Server created with id: %s for amphora id: %s",
|
||||
(compute_id, amphora_id))
|
||||
return compute_id
|
||||
|
||||
except Exception as e:
|
||||
LOG.error(_LE("Compute create for amphora id: %(amp)s "
|
||||
"failed: %(exp)s"),
|
||||
{'amp': amphora_id, 'exp': e})
|
||||
raise e
|
||||
except Exception:
|
||||
LOG.exception(_LE("Compute create for amphora id: %s failed"),
|
||||
amphora_id)
|
||||
raise
|
||||
|
||||
def revert(self, result, amphora_id, *args, **kwargs):
|
||||
"""This method will revert the creation of the
|
||||
|
@ -94,9 +92,8 @@ class ComputeCreate(BaseComputeTask):
|
|||
{'amp': amphora_id, 'comp': compute_id})
|
||||
try:
|
||||
self.compute.delete(compute_id)
|
||||
except Exception as e:
|
||||
LOG.error(_LE("Reverting compute create failed"
|
||||
" with exception %s"), e)
|
||||
except Exception:
|
||||
LOG.exception(_LE("Reverting compute create failed"))
|
||||
|
||||
|
||||
class CertComputeCreate(ComputeCreate):
|
||||
|
@ -126,22 +123,22 @@ class DeleteAmphoraeOnLoadBalancer(BaseComputeTask):
|
|||
for amp in loadbalancer.amphorae:
|
||||
try:
|
||||
self.compute.delete(amp.compute_id)
|
||||
except Exception as e:
|
||||
LOG.error(_LE("Compute delete for amphora id: %(amp)s failed:"
|
||||
"%(exp)s"), {'amp': amp.id, 'exp': e})
|
||||
raise e
|
||||
except Exception:
|
||||
LOG.exception(_LE("Compute delete for amphora id: %s failed"),
|
||||
amp.id)
|
||||
raise
|
||||
|
||||
|
||||
class ComputeDelete(BaseComputeTask):
|
||||
def execute(self, amphora):
|
||||
LOG.debug("Compute delete execute for amphora with id %s" % amphora.id)
|
||||
LOG.debug("Compute Delete execute for amphora with id %s", amphora.id)
|
||||
|
||||
try:
|
||||
self.compute.delete(compute_id=amphora.compute_id)
|
||||
except Exception as e:
|
||||
LOG.error(_LE("Compute delete for amphora id: %(amp)s failed:"
|
||||
"%(exp)s"), {'amp': amphora.id, 'exp': e})
|
||||
raise e
|
||||
except Exception:
|
||||
LOG.exception(_LE("Compute delete for amphora id: %s failed"),
|
||||
amphora.id)
|
||||
raise
|
||||
|
||||
|
||||
class ComputeWait(BaseComputeTask):
|
||||
|
|
|
@ -56,7 +56,7 @@ class CreateAmphoraInDB(BaseDatabaseTask):
|
|||
id=uuidutils.generate_uuid(),
|
||||
status=constants.PENDING_CREATE)
|
||||
|
||||
LOG.info(_LI("Created Amphora in DB with id %s") % amphora.id)
|
||||
LOG.info(_LI("Created Amphora in DB with id %s"), amphora.id)
|
||||
return amphora.id
|
||||
|
||||
def revert(self, result, *args, **kwargs):
|
||||
|
@ -89,7 +89,7 @@ class MarkLBAmphoraeDeletedInDB(BaseDatabaseTask):
|
|||
|
||||
"""
|
||||
for amp in loadbalancer.amphorae:
|
||||
LOG.debug(_LW("Marking amphora %s DELETED ") % amp.id)
|
||||
LOG.debug("Marking amphora %s DELETED ", amp.id)
|
||||
self.amphora_repo.update(db_apis.get_session(),
|
||||
id=amp.id, status=constants.DELETED)
|
||||
|
||||
|
@ -107,7 +107,7 @@ class DeleteHealthMonitorInDB(BaseDatabaseTask):
|
|||
:returns: None
|
||||
"""
|
||||
|
||||
LOG.debug("DB delete health monitor for id: %s " % pool_id)
|
||||
LOG.debug("DB delete health monitor for id: %s ", pool_id)
|
||||
self.health_mon_repo.delete(db_apis.get_session(), pool_id=pool_id)
|
||||
|
||||
def revert(self, pool_id, *args, **kwargs):
|
||||
|
@ -136,8 +136,7 @@ class DeleteMemberInDB(BaseDatabaseTask):
|
|||
:returns: None
|
||||
"""
|
||||
|
||||
LOG.debug("DB delete member for id: %s " %
|
||||
member_id)
|
||||
LOG.debug("DB delete member for id: %s ", member_id)
|
||||
self.member_repo.delete(db_apis.get_session(), id=member_id)
|
||||
|
||||
def revert(self, member_id, *args, **kwargs):
|
||||
|
@ -162,7 +161,7 @@ class DeleteListenerInDB(BaseDatabaseTask):
|
|||
:param listener: The listener to delete
|
||||
:returns: None
|
||||
"""
|
||||
LOG.debug(_LW("Delete in DB for listener id: %s") % listener.id)
|
||||
LOG.debug("Delete in DB for listener id: %s", listener.id)
|
||||
self.listener_repo.delete(db_apis.get_session(), id=listener.id)
|
||||
|
||||
def revert(self, listener_id, *args, **kwargs):
|
||||
|
@ -189,8 +188,7 @@ class DeletePoolInDB(BaseDatabaseTask):
|
|||
:returns: None
|
||||
"""
|
||||
|
||||
LOG.debug("Delete in DB for pool id: %s " %
|
||||
pool.id)
|
||||
LOG.debug("Delete in DB for pool id: %s ", pool.id)
|
||||
self.pool_repo.delete(db_apis.get_session(), id=pool.id)
|
||||
|
||||
def revert(self, pool_id, *args, **kwargs):
|
||||
|
@ -216,8 +214,7 @@ class ReloadAmphora(BaseDatabaseTask):
|
|||
:returns: The amphora object
|
||||
"""
|
||||
|
||||
LOG.debug("Get amphora from DB for amphora id: %s " %
|
||||
amphora_id)
|
||||
LOG.debug("Get amphora from DB for amphora id: %s ", amphora_id)
|
||||
return self.amphora_repo.get(db_apis.get_session(), id=amphora_id)
|
||||
|
||||
|
||||
|
@ -231,7 +228,7 @@ class ReloadLoadBalancer(BaseDatabaseTask):
|
|||
:returns: The load balancer object
|
||||
"""
|
||||
|
||||
LOG.debug("Get load balancer from DB for load balancer id: %s " %
|
||||
LOG.debug("Get load balancer from DB for load balancer id: %s ",
|
||||
loadbalancer_id)
|
||||
return self.loadbalancer_repo.get(db_apis.get_session(),
|
||||
id=loadbalancer_id)
|
||||
|
@ -281,19 +278,20 @@ class MapLoadbalancerToAmphora(BaseDatabaseTask):
|
|||
unable to allocate an Amphora
|
||||
"""
|
||||
|
||||
LOG.debug("Allocating an Amphora for load balancer with id %s" %
|
||||
LOG.debug("Allocating an Amphora for load balancer with id %s",
|
||||
loadbalancer_id)
|
||||
|
||||
amp = self.amphora_repo.allocate_and_associate(
|
||||
db_apis.get_session(),
|
||||
loadbalancer_id)
|
||||
if amp is None:
|
||||
LOG.debug("No Amphora available for load balancer with id %s" %
|
||||
LOG.debug("No Amphora available for load balancer with id %s",
|
||||
loadbalancer_id)
|
||||
raise exceptions.NoReadyAmphoraeException()
|
||||
|
||||
LOG.info(_LI("Allocated Amphora with id %(amp)s for load balancer "
|
||||
"with id %(lb)s") % {"amp": amp.id, "lb": loadbalancer_id})
|
||||
"with id %(lb)s"),
|
||||
{"amp": amp.id, "lb": loadbalancer_id})
|
||||
|
||||
return amp.id
|
||||
|
||||
|
@ -309,7 +307,7 @@ class MarkAmphoraAllocatedInDB(BaseDatabaseTask):
|
|||
"""Mark amphora as allocated to a load balancer in DB."""
|
||||
|
||||
LOG.info(_LI("Mark ALLOCATED in DB for amphora: %(amp)s with "
|
||||
"compute id %(comp)s for load balancer: %(lb)s") %
|
||||
"compute id %(comp)s for load balancer: %(lb)s"),
|
||||
{"amp": amphora.id, "comp": amphora.compute_id,
|
||||
"lb": loadbalancer_id})
|
||||
self.amphora_repo.update(db_apis.get_session(), amphora.id,
|
||||
|
@ -337,7 +335,7 @@ class MarkAmphoraBootingInDB(BaseDatabaseTask):
|
|||
def execute(self, amphora_id, compute_id):
|
||||
"""Mark amphora booting in DB."""
|
||||
|
||||
LOG.debug("Mark BOOTING in DB for amphora: %s with compute id %s" %
|
||||
LOG.debug("Mark BOOTING in DB for amphora: %s with compute id %s",
|
||||
(amphora_id, compute_id))
|
||||
self.amphora_repo.update(db_apis.get_session(), amphora_id,
|
||||
status=constants.AMPHORA_BOOTING,
|
||||
|
@ -366,8 +364,7 @@ class MarkAmphoraDeletedInDB(BaseDatabaseTask):
|
|||
def execute(self, amphora):
|
||||
"""Mark the amphora as pending delete in DB."""
|
||||
|
||||
LOG.debug("Mark DELETED in DB for amphora: %s "
|
||||
"with compute id %s" %
|
||||
LOG.debug("Mark DELETED in DB for amphora: %s with compute id %s",
|
||||
(amphora.id, amphora.compute_id))
|
||||
self.amphora_repo.update(db_apis.get_session(), amphora.id,
|
||||
status=constants.DELETED)
|
||||
|
@ -392,7 +389,7 @@ class MarkAmphoraPendingDeleteInDB(BaseDatabaseTask):
|
|||
"""Mark the amphora as pending delete in DB."""
|
||||
|
||||
LOG.debug("Mark PENDING DELETE in DB for amphora: %s "
|
||||
"with compute id %s" %
|
||||
"with compute id %s",
|
||||
(amphora.id, amphora.compute_id))
|
||||
self.amphora_repo.update(db_apis.get_session(), amphora.id,
|
||||
status=constants.PENDING_DELETE)
|
||||
|
@ -417,7 +414,7 @@ class MarkAmphoraPendingUpdateInDB(BaseDatabaseTask):
|
|||
"""Mark the amphora as pending upate in DB."""
|
||||
|
||||
LOG.debug("Mark PENDING UPDATE in DB for amphora: %s "
|
||||
"with compute id %s" %
|
||||
"with compute id %s",
|
||||
(amphora.id, amphora.compute_id))
|
||||
self.amphora_repo.update(db_apis.get_session(), amphora.id,
|
||||
status=constants.PENDING_UPDATE)
|
||||
|
@ -443,8 +440,8 @@ class MarkAmphoraReadyInDB(BaseDatabaseTask):
|
|||
"""Mark amphora as ready in DB."""
|
||||
|
||||
LOG.info(_LI("Mark READY in DB for amphora: %(amp)s with compute "
|
||||
"id %(comp)s") % {"amp": amphora.id,
|
||||
"comp": amphora.compute_id})
|
||||
"id %(comp)s"),
|
||||
{"amp": amphora.id, "comp": amphora.compute_id})
|
||||
self.amphora_repo.update(db_apis.get_session(), amphora.id,
|
||||
status=constants.AMPHORA_READY,
|
||||
compute_id=amphora.compute_id,
|
||||
|
@ -486,7 +483,7 @@ class MarkLBActiveInDB(BaseDatabaseTask):
|
|||
def execute(self, loadbalancer):
|
||||
"""Mark the load balancer as active in DB."""
|
||||
|
||||
LOG.info(_LI("Mark ACTIVE in DB for load balancer id: %s") %
|
||||
LOG.info(_LI("Mark ACTIVE in DB for load balancer id: %s"),
|
||||
loadbalancer.id)
|
||||
self.loadbalancer_repo.update(db_apis.get_session(),
|
||||
loadbalancer.id,
|
||||
|
@ -511,7 +508,7 @@ class MarkLBDeletedInDB(BaseDatabaseTask):
|
|||
def execute(self, loadbalancer):
|
||||
"""Mark the load balancer as deleted in DB."""
|
||||
|
||||
LOG.debug("Mark DELETED in DB for load balancer id: %s" %
|
||||
LOG.debug("Mark DELETED in DB for load balancer id: %s",
|
||||
loadbalancer.id)
|
||||
self.loadbalancer_repo.update(db_apis.get_session(),
|
||||
loadbalancer.id,
|
||||
|
@ -536,7 +533,7 @@ class MarkLBPendingDeleteInDB(BaseDatabaseTask):
|
|||
def execute(self, loadbalancer):
|
||||
"""Mark the load balancer as pending delete in DB."""
|
||||
|
||||
LOG.debug("Mark PENDING DELETE in DB for load balancer id: %s" %
|
||||
LOG.debug("Mark PENDING DELETE in DB for load balancer id: %s",
|
||||
loadbalancer.id)
|
||||
self.loadbalancer_repo.update(db_apis.get_session(),
|
||||
loadbalancer.id,
|
||||
|
@ -563,7 +560,7 @@ class MarkLBAndListenerActiveInDB(BaseDatabaseTask):
|
|||
"""Mark the load balancer and listener as active in DB."""
|
||||
|
||||
LOG.debug("Mark ACTIVE in DB for load balancer id: %s "
|
||||
"and listener id: %s" % (loadbalancer.id, listener.id))
|
||||
"and listener id: %s", (loadbalancer.id, listener.id))
|
||||
self.loadbalancer_repo.update(db_apis.get_session(),
|
||||
loadbalancer.id,
|
||||
provisioning_status=constants.ACTIVE)
|
||||
|
@ -598,8 +595,7 @@ class MarkListenerActiveInDB(BaseDatabaseTask):
|
|||
:returns: None
|
||||
"""
|
||||
|
||||
LOG.debug("Mark ACTIVE in DB for listener id: %s " %
|
||||
listener.id)
|
||||
LOG.debug("Mark ACTIVE in DB for listener id: %s ", listener.id)
|
||||
self.listener_repo.update(db_apis.get_session(), listener.id,
|
||||
provisioning_status=constants.ACTIVE)
|
||||
|
||||
|
@ -628,8 +624,7 @@ class MarkListenerDeletedInDB(BaseDatabaseTask):
|
|||
:returns: None
|
||||
"""
|
||||
|
||||
LOG.debug("Mark DELETED in DB for listener id: %s " %
|
||||
listener.id)
|
||||
LOG.debug("Mark DELETED in DB for listener id: %s ", listener.id)
|
||||
self.listener_repo.update(db_apis.get_session(), listener.id,
|
||||
provisioning_status=constants.DELETED)
|
||||
|
||||
|
@ -654,7 +649,7 @@ class MarkListenerPendingDeleteInDB(BaseDatabaseTask):
|
|||
def execute(self, listener):
|
||||
"""Mark the listener as pending delete in DB."""
|
||||
|
||||
LOG.debug("Mark PENDING DELETE in DB for listener id: %s" %
|
||||
LOG.debug("Mark PENDING DELETE in DB for listener id: %s",
|
||||
listener.id)
|
||||
self.listener_repo.update(db_apis.get_session(), listener.id,
|
||||
provisioning_status=constants.PENDING_DELETE)
|
||||
|
@ -682,8 +677,7 @@ class UpdateLoadbalancerInDB(BaseDatabaseTask):
|
|||
:returns: None
|
||||
"""
|
||||
|
||||
LOG.debug("Update DB for listener id: %s " %
|
||||
loadbalancer.id)
|
||||
LOG.debug("Update DB for listener id: %s ", loadbalancer.id)
|
||||
self.loadbalancer_repo.update(db_apis.get_session(), loadbalancer.id,
|
||||
**update_dict)
|
||||
|
||||
|
@ -714,8 +708,7 @@ class UpdateHealthMonInDB(BaseDatabaseTask):
|
|||
:returns: None
|
||||
"""
|
||||
|
||||
LOG.debug("Update DB for health monitor id: %s " %
|
||||
health_mon.pool_id)
|
||||
LOG.debug("Update DB for health monitor id: %s ", health_mon.pool_id)
|
||||
self.health_mon_repo.update(db_apis.get_session(), health_mon.pool_id,
|
||||
**update_dict)
|
||||
|
||||
|
@ -746,8 +739,7 @@ class UpdateListenerInDB(BaseDatabaseTask):
|
|||
:returns: None
|
||||
"""
|
||||
|
||||
LOG.debug("Update DB for listener id: %s " %
|
||||
listener.id)
|
||||
LOG.debug("Update DB for listener id: %s ", listener.id)
|
||||
self.listener_repo.update(db_apis.get_session(), listener.id,
|
||||
**update_dict)
|
||||
|
||||
|
@ -778,8 +770,7 @@ class UpdateMemberInDB(BaseDatabaseTask):
|
|||
:returns: None
|
||||
"""
|
||||
|
||||
LOG.debug("Update DB for member id: %s " %
|
||||
member.id)
|
||||
LOG.debug("Update DB for member id: %s ", member.id)
|
||||
self.member_repo.update(db_apis.get_session(), member.id,
|
||||
**update_dict)
|
||||
|
||||
|
@ -810,8 +801,7 @@ class UpdatePoolInDB(BaseDatabaseTask):
|
|||
:returns: None
|
||||
"""
|
||||
|
||||
LOG.debug("Update DB for pool id: %s " %
|
||||
pool.id)
|
||||
LOG.debug("Update DB for pool id: %s ", pool.id)
|
||||
self.pool_repo.update(db_apis.get_session(), pool.id,
|
||||
**update_dict)
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class CalculateAmphoraDelta(BaseNetworkTask):
|
|||
default_provides = constants.DELTA
|
||||
|
||||
def execute(self, loadbalancer, amphora):
|
||||
LOG.debug("Calculating network delta for amphora id: %s" % amphora.id)
|
||||
LOG.debug("Calculating network delta for amphora id: %s", amphora.id)
|
||||
|
||||
# Figure out what networks we want
|
||||
# seed with lb network(s)
|
||||
|
@ -129,7 +129,7 @@ class GetPlumbedNetworks(BaseNetworkTask):
|
|||
def execute(self, amphora):
|
||||
"""Get plumbed networks for the amphora."""
|
||||
|
||||
LOG.debug("Getting plumbed networks for amphora id: %s" % amphora.id)
|
||||
LOG.debug("Getting plumbed networks for amphora id: %s", amphora.id)
|
||||
|
||||
return self.network_driver.get_plugged_networks(amphora.compute_id)
|
||||
|
||||
|
@ -143,10 +143,10 @@ class PlugNetworks(BaseNetworkTask):
|
|||
def execute(self, amphora, delta):
|
||||
"""Update the amphora networks for the delta."""
|
||||
|
||||
LOG.debug("Plug or unplug networks for amphora id: %s" % amphora.id)
|
||||
LOG.debug("Plug or unplug networks for amphora id: %s", amphora.id)
|
||||
|
||||
if not delta:
|
||||
LOG.debug("No network deltas for amphora id: %s" % amphora.id)
|
||||
LOG.debug("No network deltas for amphora id: %s", amphora.id)
|
||||
return None
|
||||
|
||||
# add nics
|
||||
|
@ -181,20 +181,18 @@ class UnPlugNetworks(BaseNetworkTask):
|
|||
|
||||
LOG.debug("Unplug network for amphora")
|
||||
if not delta:
|
||||
LOG.debug("No network deltas for amphora id: %s" % amphora.id)
|
||||
LOG.debug("No network deltas for amphora id: %s", amphora.id)
|
||||
return None
|
||||
|
||||
for nic in delta.delete_nics:
|
||||
try:
|
||||
self.network_driver.unplug_network(amphora.compute_id,
|
||||
nic.network_id)
|
||||
except base.NetworkNotFound as e:
|
||||
LOG.debug("Network %d not found ", nic.network_id)
|
||||
except base.NetworkNotFound:
|
||||
LOG.debug("Network %d not found", nic.network_id)
|
||||
pass
|
||||
except Exception as e:
|
||||
LOG.error(
|
||||
_LE("Unable to unplug network - exception: %s"),
|
||||
str(e))
|
||||
except Exception:
|
||||
LOG.exception(_LE("Unable to unplug network"))
|
||||
pass # Todo(german) follow up if that makes sense
|
||||
|
||||
|
||||
|
@ -245,9 +243,8 @@ class HandleNetworkDeltas(BaseNetworkTask):
|
|||
nic.network_id)
|
||||
except base.NetworkNotFound:
|
||||
LOG.debug("Network %d not found ", nic.network_id)
|
||||
except Exception as e:
|
||||
LOG.error(
|
||||
_LE("Unable to unplug network - exception: %s"), e)
|
||||
except Exception:
|
||||
LOG.exception(_LE("Unable to unplug network"))
|
||||
return added_ports
|
||||
|
||||
def revert(self, result, deltas):
|
||||
|
@ -275,7 +272,7 @@ class PlugVIP(BaseNetworkTask):
|
|||
def execute(self, loadbalancer):
|
||||
"""Plumb a vip to an amphora."""
|
||||
|
||||
LOG.debug("Plumbing VIP for loadbalancer id: %s" % loadbalancer.id)
|
||||
LOG.debug("Plumbing VIP for loadbalancer id: %s", loadbalancer.id)
|
||||
|
||||
amps_data = self.network_driver.plug_vip(loadbalancer,
|
||||
loadbalancer.vip)
|
||||
|
@ -301,10 +298,9 @@ class UnplugVIP(BaseNetworkTask):
|
|||
LOG.debug("Unplug vip on amphora")
|
||||
try:
|
||||
self.network_driver.unplug_vip(loadbalancer, loadbalancer.vip)
|
||||
except Exception as e:
|
||||
LOG.error(_LE("Unable to unplug vip from load balancer"
|
||||
"{id}: exception: {ex}").format(id=loadbalancer.id,
|
||||
ex=e.message))
|
||||
except Exception:
|
||||
LOG.exception(_LE("Unable to unplug vip from load balancer %s"),
|
||||
loadbalancer.id)
|
||||
|
||||
|
||||
class AllocateVIP(BaseNetworkTask):
|
||||
|
@ -353,7 +349,7 @@ class UpdateVIP(BaseNetworkTask):
|
|||
"""Task to update a VIP."""
|
||||
|
||||
def execute(self, loadbalancer):
|
||||
LOG.debug("Updating VIP of load_balancer %s." % loadbalancer.id)
|
||||
LOG.debug("Updating VIP of load_balancer %s.", loadbalancer.id)
|
||||
|
||||
self.network_driver.update_vip(loadbalancer)
|
||||
|
||||
|
@ -368,8 +364,7 @@ class GetAmphoraeNetworkConfigs(BaseNetworkTask):
|
|||
amp_net_configs = {}
|
||||
for amp in loadbalancer.amphorae:
|
||||
if amp.status != constants.DELETED:
|
||||
LOG.debug("Retrieving network details for "
|
||||
"amphora {0}".format(amp.id))
|
||||
LOG.debug("Retrieving network details for amphora %s", amp.id)
|
||||
vrrp_port = self.network_driver.get_port(amp.vrrp_port_id)
|
||||
vrrp_subnet = self.network_driver.get_subnet(
|
||||
vrrp_port.get_subnet_id(amp.vrrp_ip))
|
||||
|
@ -392,7 +387,7 @@ class FailoverPreparationForAmphora(BaseNetworkTask):
|
|||
"""Task to prepare an amphora for failover."""
|
||||
|
||||
def execute(self, amphora):
|
||||
LOG.debug("Prepare amphora %s for failover." % amphora.id)
|
||||
LOG.debug("Prepare amphora %s for failover.", amphora.id)
|
||||
|
||||
self.network_driver.failover_preparation(amphora)
|
||||
|
||||
|
@ -401,7 +396,7 @@ class RetrievePortIDsOnAmphoraExceptLBNetwork(BaseNetworkTask):
|
|||
"""Task retrieving all the port ids on an amphora, except lb network."""
|
||||
|
||||
def execute(self, amphora):
|
||||
LOG.debug("Retrieve all but the lb network port id on amphora %s." %
|
||||
LOG.debug("Retrieve all but the lb network port id on amphora %s.",
|
||||
amphora.id)
|
||||
|
||||
interfaces = self.network_driver.get_plugged_networks(
|
||||
|
|
Loading…
Reference in New Issue