Fix log printings for controller

Log printings were wrong, we need to call the objects
__str__() method in order to actually see the
details.

Change-Id: I83979c09f16a4eca35eb217351b71b9d07cb7371
This commit is contained in:
Gal Sagie
2016-01-03 16:01:41 +02:00
parent a0b538b6f1
commit bc85c610a3

View File

@@ -121,7 +121,8 @@ class DfLocalController(object):
# Check if tunnel already exists to this chassis
# Create tunnel port to this chassis
LOG.info(_LI("Adding tunnel to remote chassis = %s") % chassis)
LOG.info(_LI("Adding tunnel to remote chassis = %s") %
chassis.__str__())
self.vswitch_api.add_tunnel_port(chassis).execute()
def chassis_deleted(self, chassis_id):
@@ -142,14 +143,15 @@ class DfLocalController(object):
return
#Make sure we have a local network_id mapped before we dispatch
network_id = self.get_network_id(lswitch.get_id())
lswitch_conf = {'network_id': network_id, 'lswitch': lswitch}
lswitch_conf = {'network_id': network_id, 'lswitch':
lswitch.__str__()}
LOG.info(_LI("Adding/Updating Logical Switch = %s") % lswitch_conf)
self.db_store.set_lswitch(lswitch.get_id(), lswitch)
self.dispatcher.dispatch('logical_switch_updated', lswitch=lswitch)
def logical_switch_deleted(self, lswitch_id):
lswitch = self.db_store.get_lswitch(lswitch_id)
LOG.info(_LI("Removing Logical Switch = %s") % lswitch)
LOG.info(_LI("Removing Logical Switch = %s") % lswitch.__str__())
self.dispatcher.dispatch('logical_switch_deleted',
lswitch=lswitch)
self.db_store.del_lswitch(lswitch_id)
@@ -173,7 +175,8 @@ class DfLocalController(object):
if ofport != 0:
lport.set_external_value('ofport', ofport)
lport.set_external_value('is_local', True)
LOG.info(_LI("Adding new local Logical Port = %s") % lport)
LOG.info(_LI("Adding new local Logical Port = %s") %
lport.__str__())
self.dispatcher.dispatch('add_local_port', lport=lport)
self.db_store.set_port(lport.get_id(), lport, True)
else:
@@ -181,7 +184,8 @@ class DfLocalController(object):
if ofport != 0:
lport.set_external_value('ofport', ofport)
lport.set_external_value('is_local', False)
LOG.info(_LI("Adding new remote Logical Port = %s") % lport)
LOG.info(_LI("Adding new remote Logical Port = %s") %
lport.__str__())
self.dispatcher.dispatch('add_remote_port', lport=lport)
self.db_store.set_port(lport.get_id(), lport, False)
@@ -190,18 +194,21 @@ class DfLocalController(object):
if lport is None:
return
if lport.get_external_value('is_local'):
LOG.info(_LI("Removing local Logical Port = %s") % lport)
LOG.info(_LI("Removing local Logical Port = %s") %
lport.__str__())
self.dispatcher.dispatch('remove_local_port', lport=lport)
self.db_store.delete_port(lport.get_id(), True)
else:
LOG.info(_LI("Removing remote Logical Port = %s") % lport)
LOG.info(_LI("Removing remote Logical Port = %s") %
lport.__str__())
self.dispatcher.dispatch('remove_remote_port', lport=lport)
self.db_store.delete_port(lport.get_id(), False)
def router_updated(self, lrouter):
old_lrouter = self.db_store.get_router(lrouter.get_name())
if old_lrouter is None:
LOG.info(_LI("Logical Router created = %s") % lrouter)
LOG.info(_LI("Logical Router created = %s") %
lrouter.__str__())
self._add_new_lrouter(lrouter)
return
self._update_router_interfaces(old_lrouter, lrouter)
@@ -274,7 +281,8 @@ class DfLocalController(object):
self._delete_router_port(old_port)
def _add_new_router_port(self, router, router_port):
LOG.info(_LI("Adding new logical router interface = %s") % router_port)
LOG.info(_LI("Adding new logical router interface = %s") %
router_port.__str__())
local_network_id = self.db_store.get_network_id(
router_port.get_lswitch_id())
self.dispatcher.dispatch('add_new_router_port', router=router,
@@ -282,7 +290,8 @@ class DfLocalController(object):
local_network_id=local_network_id)
def _delete_router_port(self, router_port):
LOG.info(_LI("Removing logical router interface = %s") % router_port)
LOG.info(_LI("Removing logical router interface = %s") %
router_port.__str__())
local_network_id = self.db_store.get_network_id(
router_port.get_lswitch_id())
self.dispatcher.dispatch('delete_router_port',